5

I was wondering what is the F test (in general) that is done by the function $\texttt{lm()}$ in R.

I mean you can do different F tests, which one does it chose and how? For instance in a linear regression setting, I can fit a certain model with $\texttt{lm()}$ , but (before running the code) how do we know against which model it will be compared to?

For instance look at this: enter image description here

For instance my model here is of the form $$Y_i= \beta_0+\beta_1x_{i1}+\beta_2x_{i2}+\beta_3x_{i1}^2+\beta_4x_{i2}^2+\beta_5x_{i1}x_{i2}+\epsilon_i$$ but, before running this code, what F-test could I have expected to get out of $\texttt{lm()}$? And what test (here) has actually been performed?

Euler_Salter
  • 2,196

1 Answers1

7

The $F$ test always tests against the intercept-only model (y ~ 1) unless the model has not intercept, then a zero-mean model is used (y ~ 0). In your case, this means that the null hypothesis $\beta_1 = \dots = \beta_5 = 0$ is tested.

Achim Zeileis
  • 15,515
  • 2
  • 38
  • 62
  • Thank you! So If I wanted to test only $\beta_3=\beta_4=\beta_5=0$, what should I do? Should I fit the model (using $\texttt{lm()}$) with less explanatory variables? – Euler_Salter May 11 '17 at 10:51
  • You appear to have a sample size of 11. This is too low for this number of predictors. – dbwilson May 11 '17 at 11:36
  • 4
    @Euler_Salter Fit both models explicitly and then run anova() on it, e.g., m1 <- lm(y ~ x1 + x2 + I(x1^2) + I(x2^2) + I(x1 * x2)) and m2 <- lm(y ~ x1 + x2) and finally anova(m2, m1). – Achim Zeileis May 11 '17 at 12:36