I'm trying to understand the exact meaning of the $F$-values and what are we testing in the ANOVA table for a simple linear model in R
:
> asdf=lm(carb~weight+protein+age)
> anova(asdf)
Analysis of Variance Table
Response: carb
Df Sum Sq Mean Sq F value Pr(>F)
weight 1 181.38 181.378 5.1123 0.03804 *
protein 1 305.40 305.400 8.6079 0.00973 **
age 1 38.36 38.359 1.0812 0.31389
Residuals 16 567.66 35.479
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
If we have two nested linear models $A$ in $B$ with $p_0$ and $p$ covariates respectively, we use the $F$-statistic obtained from the likelihood ratio test:
$$
\frac{(n-p-1)}{(p-p_0)}\cdot\frac{RSS(A)-RSS(B)}{RSS(B)}
$$
to find if we prefer $B$ over $A$. The $F$-value 1.0812
in the third line makes sense, as it is exactly this statistic to compare the full model and the model omitting the covariate age
. We could justify omitting the age
covariate by this result.
I'm puzzled about $F$ values in the first two lines. I see the first value is obtained by taking ratio of: $$ 16\cdot\frac{(RSS({\rm null})-RSS({\rm incl.weight})}{RSS({\rm full model})} $$ and the second line is similar. What exact hypothesis is this testing, and how is it more logical than using: $$ 18\cdot\frac{(RSS({\rm null})-RSS({\rm incl.weight})}{RSS({\rm incl.weight})} $$ as for the third value in the explanation above?
I think my question wasn't completely clear, so I'll clarify. Let's say we try further:
> a=lm(carb~1)
> as=lm(carb~weight)
> anova(a,as)
Analysis of Variance Table
Model 1: carb ~ 1
Model 2: carb ~ weight
Res.Df RSS Df Sum of Sq F Pr(>F)
1 19 1092.80
2 18 911.42 1 181.38 3.5821 0.0746 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Why when we use anova
on the full model alone, we get $F$ value for weight vs null $5.1123$, different from $3.5821$ here, and how are these different?