[R] simple repeated measures model: dumb user baffled!

chris1 chris1 at psyctc.org
Thu Apr 29 14:51:54 CEST 2004


On Thursday, April 29, 2004, 10:17:46 AM, Christophe Pallier wrote:

CP> Hi,

CP> Here is how I would go:

CP> suj <- gl(40,4)
CP> order <- gl(4,40)
CP> time <- gl(4,1,160)
CP> cond <- factor(c(rep(c('N','E','E','N'),10),
CP>          rep(c('N','E','N','E'),10),
CP>          rep(c('E','N','E','N'),10),
CP>          rep(c('E','N','N','E'),10)))

CP> resp <-rnorm(40*4) # you should use your actual data, just contatening
CP> the 4 columns RESP1 to RESP4:

CP> interaction.plot(time,cond,resp)
CP> summary(aov(resp~+time*cond+Error(suj/(time*cond))))

CP> There is a warning message that bothers me a bit (Warning message: Error
CP> model is singular),
CP> but the degrees of freedom on the table using the Error:suj:time seem fine.

CP> If you try it with your actual data and compare this output with your
CP> statistical package, I would like you know if
You didn't say what you'd want to know but it certainly worked:

summary(aov(nrs~+OCC*LANG+Error(ID/(OCC*LANG))))

Error: ID
          Df  Sum Sq Mean Sq F value Pr(>F)
OCC:LANG   2  0.6794  0.3397  0.5776 0.5662
Residuals 37 21.7594  0.5881               

Error: ID:OCC
           Df Sum Sq Mean Sq F value  Pr(>F)   
OCC         3 0.7196  0.2399  4.3846 0.00586 **
LANG        1 0.3702  0.3702  6.7665 0.01053 * 
OCC:LANG    3 0.0850  0.0283  0.5180 0.67073   
Residuals 113 6.1815  0.0547                   

CP> Concerning the test of higher than linear change, I am not sure how to
CP> handle it. Probaly using a contrast,
CP> but this is an area where I am still not at ease with R.
I thought I could just put "ordered(OCC)" but that didn't do it.
Anyone else help us here?

CP> Hope this helps,
Wonderful.  I probably should have been able to see this but sometimes
I can't unless someone kindly leads the way.  Much appreciated.

Chris




More information about the R-help mailing list