I am working with a RCB 2x2x3 ANCOVA, and I have noticed a difference in the calculation of sum of squares in a Type III calculation.

Anova output is a follows:

> Anova(aov(MSOIL~Forest+Burn*Thin*Moisture+ROCK,data=env3l),type=3)
Anova Table (Type III tests)

Response: MSOIL
                    Sum Sq Df F value    Pr(>F)
(Intercept)        22.3682  1 53.2141 3.499e-07 ***
Forest              1.0954  2  1.3029   0.29282
Burn                2.6926  1  6.4058   0.01943 *
Thin                0.0494  1  0.1176   0.73503
Moisture            1.2597  2  1.4984   0.24644
ROCK                2.1908  1  5.2119   0.03296 *
Burn:Thin           0.2002  1  0.4764   0.49763
Burn:Moisture       1.0612  2  1.2623   0.30360
Thin:Moisture       1.6590  2  1.9734   0.16392
Burn:Thin:Moisture  1.1175  2  1.3292   0.28605
Residuals           8.8272 21


However, I would like to calculate some a priori contrasts within the Moisture factor as follows:

Transect_moisture_contrasts<-matrix(c(-1,2,-1,1,0,-1),3,2)
dimnames(Transect_moisture_contrasts)<-list(levels(env$Moisture),c("I vs. X&M","X vs. M"))
contrasts(env$Moisture)<-Transect_moisture_contrasts
> contrasts(env3l$Moisture)
  I vs. X&M X vs. M
X        -1       1
I         2       0
M        -1      -1


soilmodel<-lm(MSOIL~Forest+Burn*Thin*Moisture+ROCK,data=env3l)
> linearHypothesis(soilmodel,"MoistureI vs. X&M")
Linear hypothesis test

Hypothesis:
MoistureI vs. X&M = 0

Model 1: restricted model
Model 2: MSOIL ~ Forest + Burn * Thin * Moisture + ROCK

  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1     22 9.4106
2     21 8.8272  1   0.58333 1.3877  0.252
> linearHypothesis(soilmodel,"MoistureX vs. M")
Linear hypothesis test

Hypothesis:
MoistureX vs. M = 0

Model 1: restricted model
Model 2: MSOIL ~ Forest + Burn * Thin * Moisture + ROCK

  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1     22 9.6359
2     21 8.8272  1   0.80871 1.9239   0.18

The sum of squares for these two contrasts do not add up to the sum of squares of the main effect Moisture
> .80871+.58333
[1] 1.39204
> 1.39204-1.2596
[1] 0.13244

Checking them together produces the correct sum of squares for the main effect
> linearHypothesis(soilmodel,c("MoistureI vs. X&M","MoistureX vs. M"))
Linear hypothesis test

Hypothesis:
MoistureI vs. X&M = 0
MoistureX vs. M = 0

Model 1: restricted model
Model 2: MSOIL ~ Forest + Burn * Thin * Moisture + ROCK

  Res.Df     RSS Df Sum of Sq      F Pr(>F)
1     23 10.0869
2     21  8.8272  2    1.2596 1.4984 0.2464


So my question is:
Should the sum of squares for the two contrasts add to the main effect here?
If they should, maybe we can figure out why mine do not.

Thanks in advance for any assistance.

Cheers,
John


John J. Wiley, Jr.
PhD Candidate
State University of New York
College of Environmental Science and Forestry
Department of Environmental and Forest Biology
460 Illick Hall
Syracuse, NY 13210
315.470.4825 (office)
740.590.6121 (cell)

	[[alternative HTML version deleted]]

