[R] problem with se.contrast()

Jamie Jarabek jjarabek at stat.ufl.edu
Wed Feb 16 20:16:07 CET 2005


I am having trouble getting standard errors for contrasts using se.contrast() in 
what appears to be a simple case to me. The following test example illustrates 
my problem:

Lab <- factor(rep(c("1","2","3"),each=12))
Material <- factor(rep(c("A","B","C","D"),each=3,times=3))
Measurement <- c(12.20,12.28,12.16,15.51,15.02,15.29,18.14,18.08,18.21,18.54,18.36
,18.45,12.59,12.30,12.67,14.98,15.46,15.22,18.54,18.31,18.60,19.21,18.77
,18.69,12.72,12.78,12.66,15.33,15.19,15.24,18.00,18.15,17.93,18.88,18.12,18.03)

testdata <- data.frame(Lab,Material,Measurement)
rm(list=c("Lab","Material","Measurement"))

test.aov <- with(testdata,aov(Measurement ~ Material + Error(Lab/Material)))

This gives me the desired ANOVA table. I next want to get the standard
errors for certain contrasts and following the help page for
se.contrast() I tried the following but I get an error:

>se.contrast(test.aov,list(Material=="A",Material=="B",Material=="C",Material=="D"),coef=c(1,1,-1,-1),data=testdata)
Error in matrix(0, length(asgn), ncol(effects), dimnames = list(nm[1 + :
         length of dimnames [1] not equal to array extent

I have tested this on R 2.0.1 on Windows XP and Solaris and get the same
error on both systems. I am unsure as to what I am doing wrong here. Thanks for 
any help.

Jamie Jarabek




More information about the R-help mailing list