I've tried without success to calculate interaction and main effects
contrasts using R. I've found the functions C(), contrasts(),
se.contrasts() and fit.contrasts() in package gmodels. Given the url
for a small dataset and the two-way anova model below, I'd like to
reproduce the results from appended SAS code. Thanks. --Dale.
## the dataset (from Montgomery)
twoway <- read.table("http://dsteele.veryspeedy.net/sta501/twoway.txt",
col.names=c('material', 'temp','voltage'),colClasses=c('factor',
'factor', 'numeric'))
## the model
fit <- aov(voltage ~ material*temp, data=twoway)
/* SAS code */
proc glm data=twoway;
class material temp;
model voltage = material temp material*temp;
contrast '21-22-31+32' material*temp 0 0 0 1 -1 0 -1 1 0;
estimate '21-22-31+32' material*temp 0 0 0 1 -1 0 -1 1 0;
contrast 'material1-material2' material 1 -1 0;
estimate 'material1-material2' material 1 -1 0;
contrast 'temp50 - temp80' temp 1 0 -1;
estimate 'temp50 - temp80' temp 1 0 -1;
run;