# Why do type III sums of squares require orthogonal contrasts?

I have read many times that one has to set orthogonal contrast to get correct type III sums of square. E.g. John Fox says

To compute Type-III tests using incremental F-tests, one needs contrasts that are orthogonal in the row-basis of the model matrix.

Can someone give a good intuition why this is the case?

If contrasts are orthogonal, then it is possible to meaningfully say "adjust x1 separately from x2" to see effect of one predictor in isolation. Type iii idea is aiming for that.

If predictors are not orthogonal, then not meaningful to do this. Cannot look at data and adjust x1 without also adjusting x2.

I think the linked r-help message by Fox explains it well, so I'll quote him more and annotate

(1) In balanced designs, so-called "Type I," "II," and "III" sums of squares are identical. If the STATA manual says that Type II tests are only appropriate in balanced designs, then that doesn't make a whole lot of sense (unless one believes that Type-II tests are nonsense, which is not the case).

So, he's not making the argument that it's improper to do Type III (or II) tests when the predictors aren't orthogonal. In fact, he's taking it for granted that that isn't true.

(2) One should concentrate not directly on different "types" of sums of squares, but on the hypotheses to be tested.

The main point under discussion is: what do you need to be true for the test labelled A on the output to be the test of your hypothesis about $$A$$?

Type-II sums of squares are constructed obeying the principle of marginality, so the kinds of contrasts employed to represent factors are irrelevant to the sums of squares produced.

With Type II tests, you can code factors however you like. Which is nice, because you can code them so the coefficients mean what you want them to mean.

in a three-way ANOVA with factors A, B, and C, the Type-II test for the AB interaction assumes that the ABC interaction is absent, and the test for the A main effect assumes that the ABC, AB, and AC interaction are absent (but not necessarily the BC interaction, since the A main effect is not marginal to this term)

But the price is that Type II tests of main effects assume the interactions are zero. Now, you might think you aren't interested in tests of main effects when there are interactions. In that case, you can be happy with Type II tests and stop reading here.

Type-III tests do not assume that terms higher-order to the term in question are zero. For example, in a two-way design with factors A and B, the type-III test for the A main effect tests whether the population marginal means at the levels of A (i.e., averaged across the levels of B) are the same.

So you can, meaningfully, test hypotheses about main effects in the presence of interactions using Type III tests.

To compute Type-III tests using incremental F-tests, one needs contrasts that are orthogonal in the row-basis of the model matrix.

You can even do the tests in the usual way, by comparing the residual sums of squares in models with and without the term of interest (that's what 'incremental $$F$$-tests' means)

But, the hypotheses you can test this way depend on how the factors are coded.

If you use 'treatment' or 'corner-point' contrasts, with an indicator variable for each level of the factor except the reference level, the 'main effect' test will be the test for an effect of A at the level of B that's coded zero. This is typically not what you wanted. If you wanted the test based on averaged effects, you would need to do the test by setting up some complicated linear combination of coefficients, which would be no fun at all.

On the other hand, if you use orthogonal contrasts, the main-effect tests are tests for an average effect of A across all levels of B. The orthogonality here is not orthogonality of A and B; they are either independent or not, as Nature made them. The orthogonality is about the relationship between tests for main effects and for interactions (and higher order interactions).