The holistic answer to your question is contained here http://stats.stackexchange.com/a/23198/11523https://stats.stackexchange.com/a/23198/11523
To answer your specific question regarding creating contrast matrices
Once you have set options(contrasts=c("contr.sum","contr.poly"))
then you can use
contrasts(x1)
## [,1] [,2]
## 1 1 0
## 2 0 1
## 3 -1 -1
contrasts(x2)
## [,1]
## 1 1
## 2 -1
contrasts(interaction(x1,x2))
## [,1] [,2] [,3] [,4] [,5]
## 1.1 1 0 0 0 0
## 2.1 0 1 0 0 0
## 3.1 0 0 1 0 0
## 1.2 0 0 0 1 0
## 2.2 0 0 0 0 1
## 3.2 -1 -1 -1 -1 -1
to create valid contrast matrices and to recreate your tables by hand..
Read the answers (an links) from the linked questions to decide whether type III SS are useful or not.
To avoid the tedious hand-calculations, use the following (from http://stats.stackexchange.com/a/23198/11523https://stats.stackexchange.com/a/23198/11523)
model <- lm(y ~ pre + x1*x2)
drop1(.model, .~., test = 'F')
Single term deletions
Model:
y ~ pre + x1 * x2
Df Sum of Sq RSS AIC F value Pr(>F)
<none> 2.8750 -3.1462
pre 1 3.1250 6.0000 3.6822 5.4348 0.06711 .
x1 2 4.5806 7.4556 4.2888 3.9832 0.09234 .
x2 1 3.0179 5.8929 3.4660 5.2484 0.07057 .
x1:x2 2 1.2500 4.1250 -2.8141 1.0870 0.40554