ANOVA
Study guides: Exam MAS-I, Exam ACIA-CAPSTONE
ANOVA, the analysis of variance, is the division of the total sum of squares of a response into the part a model explains and the part it leaves unexplained, used to test whether the model explains any of the variation. Regression software prints the division as an ANOVA table. For a linear regression with an intercept, p predictors and n observations, the ANOVA table is:
| Source | Sum of squares | Degrees of freedom | Mean square |
|---|---|---|---|
| Regression | \text{TSS} - \text{RSS} |
p |
(\text{TSS} - \text{RSS})/p |
| Residual | \text{RSS} |
n - p - 1 |
\text{RSS}/(n - p - 1) |
| Total | \text{TSS} |
n - 1 |
In both the sum of squares and the degrees of freedom columns, the regression and residual rows add up to the total row. The residual mean square is \hat\sigma^2, the estimate of the error variance. The test of H_0\colon \beta_1 = \cdots = \beta_p = 0, that no predictor is related to the response, against the alternative that at least one \beta_j is not zero, uses the statistic
F = \frac{(\text{TSS} - \text{RSS})/p}{\text{RSS}/(n - p - 1)}
- Under
H_0,Fhas anFdistribution withpandn - p - 1degrees of freedom.
H_0 is rejected at level \alpha when F exceeds the upper-\alpha critical value of that distribution. Software output gives p as the numerator degrees of freedom of F and n - p - 1 as the residual degrees of freedom, from which n follows.
A regression with 2 predictors and an intercept is fitted to 50 observations, with
\text = 1000and\text = 320. Is the regression significant at the 5% level?
- The regression sum of squares is
1{,}000 - 320 = 680onp = 2degrees of freedom, a mean square of 340.- The residual sum of squares is 320 on
50 - 2 - 1 = 47degrees of freedom, a mean square of6.8.F = 340/6.8 = 50.- The 5% critical value of
Fwith 2 and 47 degrees of freedom is3.195, soH_0is rejected: at least one predictor is related to the response.
One-way analysis of variance
One-way ANOVA tests whether the means of J groups are equal. It is the regression of the response on J - 1 group indicators, so the regression sum of squares is the between-group sum of squares, and the RSS is the within-group sum of squares \sum_j \sum_i (y_{ij} - \bar{y}_j)^2. The statistic is
F = \frac{(\text{TSS} - \text{RSS})/(J - 1)}{\text{RSS}/(n - J)}
\bar{y}_jis the mean of groupj, andnis the total number of observations.- Under
H_0that all the group means are equal,Fhas anFdistribution withJ - 1andn - Jdegrees of freedom.
When H_0 is rejected, multiple comparison procedures find which means differ. Adding a continuous covariate to the group indicators gives an analysis of covariance.
Claim severities from three territories, 10 claims each, give a between-group sum of squares of 1,200 and a within-group sum of squares of 5,400. Do the mean severities differ at the 5% level?
- The between-group mean square is
1{,}200/(3 - 1) = 600.- The within-group mean square is
5{,}400/(30 - 3) = 200.F = 600/200 = 3.0.- The 5% critical value of
Fwith 2 and 27 degrees of freedom is3.354, soH_0is not rejected: the data do not show different mean severities.
F test for nested models
To test whether q of the coefficients of a model with p predictors are all zero, the restricted model without them is compared with the full model by the statistic
F = \frac{(\text{RSS}_0 - \text{RSS})/q}{\text{RSS}/(n - p - 1)}
\text{RSS}_0is the residual sum of squares of the restricted model, and\text{RSS}is that of the full model.- Under
H_0,Fhas anFdistribution withqandn - p - 1degrees of freedom.
The overall test is the case q = p, in which the restricted model has only the intercept and \text{RSS}_0 = \text{TSS}. A sequential ANOVA table lists, for each predictor in the order it entered the model, the drop in RSS from adding it, so a predictor's row depends on the predictors entered before it.
With 24 observations, a model with 1 predictor has
\text_0 = 18.0. Adding a 3-level factor, as 2 indicators, gives\text = 12.0. Is the factor significant at the 5% level?
- The full model has
p = 3predictors, so its residual degrees of freedom are24 - 3 - 1 = 20.- The numerator is
(18.0 - 12.0)/2 = 3.0and the denominator is12.0/20 = 0.6, soF = 5.0.- The 5% critical value of
Fwith 2 and 20 degrees of freedom is3.493, so the factor is significant.
Analysis of deviance
A generalized linear model is compared with a smaller model nested in it by the change in deviance. Scaled by the dispersion parameter \phi, the change is approximately chi-squared:
\frac{D_0 - D}{\phi} \sim \chi^2_q
D_0is the deviance of the smaller model andDthat of the larger model.qis the number of parameters the larger model adds, which is the difference in their residual degrees of freedom.
A categorical predictor with J levels adds J - 1 parameters. For the Poisson and binomial distributions \phi = 1, so the change in deviance itself is compared with the chi-squared critical value. When \phi is estimated, the statistic F = (D_0 - D)/(q\hat\phi) is compared with an F distribution. A significant drop in deviance means the added terms are needed, and otherwise they can be dropped.
A Poisson log-linear model has deviance 25.3 on 12 degrees of freedom. Adding an interaction gives deviance 14.1 on 9 degrees of freedom. Is the interaction needed at the 5% level?
- The change in deviance is
25.3 - 14.1 = 11.2on12 - 9 = 3degrees of freedom.- The 5% critical value of
\chi^2_3is7.815.11.2 > 7.815, so the interaction is needed.