I am in the process of transferring from an old version of S+ to using R having used a variety of other packages in the past. I'm hugely impressed with R but it has an excellent but depressing habit of exposing that I'm not a professional statistician and has done so again. Someone has run a nice little repeated measures design on my advice, students randomised to four orders of a condition that can be N or E: four orders used: NEEN, NENE, ENEN, ENNE, ten students in each block. I've inherited the data (in SPSS but I can deal with that!) with variables like: ID GENDER ORDER C1 C2 C3 C4 RESP1 RESP2 RESP3 RESP4 ... ORDER is the order as a/b/c/d; C1:C4 has the N or E for each occasion, and RESP1:RESP4 the response variables. (There are a number of these but looking at each separately is justifiable theoretically). I've had a look around the R help and some S+ books I've got and I realise I'm seriously out of my depth and my repeated measures ANOVA knowledge is rusty and very different from the way that more modern statistics handles such designs. Can anyone point me to an idiot's guide to the syntax that would help me test: a) that there is a change (probably a fall in RESPn) over the four repeats (probable through a practice effect) b) whether that shows any sign of higher than linear change c) whether on top of that, there are N/E differences. I realise that this is probably trivially easy but I'm staring at all sorts of wonderful things in Venables & Ripley (S+ 2nd ed.) and in Chambers & Hastie (S, 1st ed.) but nothing is quite near enough to what I need to help me overcome my limitations! TIA, Chris
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