2
$\begingroup$

I've been struggling to understand what the intercept sums of squares and p-value correspond to when I run a one-way ANOVA with Type "III" sums of squares using the Anova() function in the car package.

Here is a reproducible example:

data(iris)
Lm_object <- lm(Sepal.Length ~ Species, data = iris)
Anova(Lm_object, type = "III")
Anova Table (Type III tests)

Response: Sepal.Length
               Sum Sq  Df F value    Pr(>F)    
(Intercept)    1253.00   1 4728.16 < 2.2e-16 ***
Species          63.21   2  119.26 < 2.2e-16 ***
Residuals        38.96 147                      

Signif. codes:  0 ‘***’ 0.001 ‘’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Any insight would greatly be appreciated,

$\endgroup$
2
  • $\begingroup$ This sounds more like a question about statistical methods rather than a specific programming question. This is probably better suited for Cross Validated. $\endgroup$
    – MrFlick
    Commented Oct 23, 2014 at 18:50
  • $\begingroup$ There is now capital Anova function in R. What does type = "III" mean? $\endgroup$ Commented Oct 24, 2014 at 1:43

1 Answer 1

4
$\begingroup$

I see this is an old question. But I had the same question recently, so I looked into it.

The Anova function from car calculates this in a somewhat backwards way because it's easiest to grab numbers that are available to it from the lm object.

Start with the intercept from the model:

coef(Lm_object)[1]

This is 5.006.

Calculate the variance of the estimate of the intercept:

vcov(Lm_object)[1, 1]

This is 0.005300163.

Suppose we want to test the null hypothesis that the intercept term is zero. The t-score for this hypothesis test is

$$t = \frac{\hat{\beta}_{0}}{SD(\hat{\beta}_{0})} = \frac{5.006}{\sqrt{0.005300163}} = 68.76164.$$

In the case of simple regression (which this is), the F-score is just the square of the t-score:

$$F = \frac{\hat{\beta}_{0}^{2}}{Var(\hat{\beta}_{0})} = \frac{5.006^{2}}{0.005300163} = 4728.16.$$

That's the F score in the Anova output.

Okay, now the usual way to compute the F-score is to use the sums of squares:

$$F = \frac{SS_{Model}/df_{Model}}{SS_{Error}/df_{Error}}.$$

We know all these numbers except $SS_{Model}$:

$$4728.16 = \frac{SS_{Model}/1}{38.9562/147}.$$

Solving for $SS_{Model}$, you get 1253.00, which is what you want.

Now it's likely that there is also a direct way to calculate $SS_{Model}$ using something like an intercept-only model, but I can't seem to figure out how. All I can do at the moment is reproduce how Anova calculates it.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.