[R] repeated measures with a group factor
Jerome L. Myers
jlmyers at psych.umass.edu
Mon Aug 2 20:44:25 CEST 2010
I have a between-subjects factor, A, with three levels, and a
within-subjects factor with 4 levels. There are 6 subjects at each A
level. I get the correct F tests using the aov function with the stack
form of the data frame but I want the epsilon adjustment
(Greenhouse-Geisser, Huynh-Feldt). for nonspheriicty as well. I got the
SPSS results using the standard broad data frame (a row for each subject
with two within-subject variables) in a simple repeated measures design
but get an error message when one factor is between subjects.. I tried
what I thought was a simple extension of this approach with one between-
and one within-subject factor. I tried
B = factor(c("B1","B2","B3","B4"))
A=factor(rep(c("A1","A2","A3"),each=6))
Bdf=data.frame(B)
attach(Bdf)
model.lm = lm(cbind(B1,B2,B3,B4) ~A,data=mix.data)
mix.model=Anova(model.lm, idata=Bdf, idesign=
B,Type="III",data=mix.data)
summary(mix.model,multivariate=FALSE)
This gives some output but it yields an error message:
"Error in x$terms : $ operator is invalid for atomic vectors
In addition: Warning message:
In Anova.mlm(model.lm, idata = Bdf, idesign = B, Type = "III") :
the model contains only an intercept: equivalent Type III test
substituted"
I've tried variations of the lm parameters (e.g., ~1 inserted) but it
still yields an error message. I'd appreciate suggestions.
Jerry Myers
--
Jerome L. Myers
Department of Psychology, Tobin Hall
University of Massachusetts
Box 37710
Amherst, MA 01003-7710
Phone: (413) 545-2331
Fax: (413) 545-0996
http://www.psych.umass.edu/people/jeromemyers/home/
More information about the R-help
mailing list