Hi, all.
I have a simple design I'm comparing to output from SPSS.
the design is 1 repeated measure (session) and 1 between measure
(cond). my dependent measure is rl. here is the data I'm using (in a
data.frame):
mig <- data.frame(subj=factor(rep(subj,3)),
cond=factor(rep(cond,3)),
session=factor(c(rep(1,nsubj),rep(2,nsubj),rep(3,nsubj))),
rl)> mig
subj cond session rl
1 401.1 NW 1 6.4081
2 402.1 NW 1 5.8861
3 500.1 NWC 1 5.3492
4 502.1 NWC 1 8.5302
5 601.1 NWR 1 2.7519
6 602.1 NWR 1 4.5404
7 603.1 NWR 1 4.3442
8 604.1 NWR 1 3.6722
9 401.1 NW 2 6.1492
10 402.1 NW 2 5.0506
11 500.1 NWC 2 6.5625
12 502.1 NWC 2 11.4430
13 601.1 NWR 2 2.8450
14 602.1 NWR 2 5.6558
15 603.1 NWR 2 3.3340
16 604.1 NWR 2 5.0548
17 401.1 NW 3 5.2717
18 402.1 NW 3 3.7337
19 500.1 NWC 3 3.6659
20 502.1 NWC 3 5.9463
21 601.1 NWR 3 2.3356
22 602.1 NWR 3 7.5458
23 603.1 NWR 3 5.0322
24 604.1 NWR 3 4.1381
I'm interested in the main effect of cond, session, and the
interaction between the two.
and here is what I get:
> tapply(mig$rl,IND=list(mig$cond, mig$session),FUN=mean)
1 2 3
NW 6.147100 5.59990 4.502700
NWC 6.939700 9.00275 4.806100
NWR 3.827175 4.22240 4.762925
(the means are correct, duh ;-)
> summary(aov(rl ~ cond * session + Error(subj), data=mig))
Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
cond 2 28.305 14.153 1.9916 0.2311
Residuals 5 35.531 7.106
Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
session 2 4.4502 2.2251 2.9868 0.09616 .
cond:session 4 17.7335 4.4334 5.9509 0.01024 *
Residuals 10 7.4499 0.7450
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1
` ' 1
(the cond effect is consistent with SPSS)
> summary(aov(rl ~ cond * session + Error(subj/(session)), data=mig))
Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
cond 2 28.305 14.153 1.9916 0.2311
Residuals 5 35.531 7.106
Error: subj:session
Df Sum Sq Mean Sq F value Pr(>F)
session 2 4.4502 2.2251 2.9868 0.09616 .
cond:session 4 17.7335 4.4334 5.9509 0.01024 *
Residuals 10 7.4499 0.7450
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1
` ' 1
(I ran this one this way b/c of a similar example from Baron's "Notes
for psychology experiments. Unfortunately, neither the session nor
the interaction cond:session are the same as SPSS's output, though the
degrees of freedom are correct in both, of course).
I'm certainly able to believe that SPSS is wrong and R is right, but
thought I'd check with this list to make sure I'm not doing something
completely stupid...
(this is only a partial dataset; I'm using it just to test for now)
thanks!
greg
(I'm drawing heavily on "Notes on the use of R for psychology
experiments and questionnaires" by Jonathan Baron.)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Oct-08 21:15 UTC
[R] repeated measures help; disagreement with SPSS
Greg Trafton <trafton at itd.nrl.navy.mil> writes:> > summary(aov(rl ~ cond * session + Error(subj/(session)), data=mig)) > > Error: subj > Df Sum Sq Mean Sq F value Pr(>F) > cond 2 28.305 14.153 1.9916 0.2311 > Residuals 5 35.531 7.106 > > Error: subj:session > Df Sum Sq Mean Sq F value Pr(>F) > session 2 4.4502 2.2251 2.9868 0.09616 . > cond:session 4 17.7335 4.4334 5.9509 0.01024 * > Residuals 10 7.4499 0.7450 > --- > Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > > (I ran this one this way b/c of a similar example from Baron's "Notes > for psychology experiments. Unfortunately, neither the session nor > the interaction cond:session are the same as SPSS's output, though the > degrees of freedom are correct in both, of course). > > I'm certainly able to believe that SPSS is wrong and R is right, but > thought I'd check with this list to make sure I'm not doing something > completely stupid...This is consistent with both lm() (using subj as a systematic effect) and lme(), so I'd strongly suspect that SPSS is getting it wrong. What does SPSS give? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Oct-08 22:27 UTC
[R] repeated measures help; disagreement with SPSS
Greg Trafton <trafton at itd.nrl.navy.mil> writes:> Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes: > > > Greg Trafton <trafton at itd.nrl.navy.mil> writes: > > > >> > summary(aov(rl ~ cond * session + Error(subj/(session)), data=mig)) > >> > >> Error: subj > >> Df Sum Sq Mean Sq F value Pr(>F) > >> cond 2 28.305 14.153 1.9916 0.2311 > >> Residuals 5 35.531 7.106 > >> > >> Error: subj:session > >> Df Sum Sq Mean Sq F value Pr(>F) > >> session 2 4.4502 2.2251 2.9868 0.09616 . > >> cond:session 4 17.7335 4.4334 5.9509 0.01024 * > >> Residuals 10 7.4499 0.7450 > >> --- > >> Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > >> > >> (I ran this one this way b/c of a similar example from Baron's "Notes > >> for psychology experiments. Unfortunately, neither the session nor > >> the interaction cond:session are the same as SPSS's output, though the > >> degrees of freedom are correct in both, of course). > >> > >> I'm certainly able to believe that SPSS is wrong and R is right, but > >> thought I'd check with this list to make sure I'm not doing something > >> completely stupid... > > > > This is consistent with both lm() (using subj as a systematic effect) > > and lme(), so I'd strongly suspect that SPSS is getting it wrong. What > > does SPSS give? > > OK, now I get to show off my ignorance of SPSS ;-) Perhaps I'm using > it wrong, arg. > > I'm including the spool file and a word copy of it (which looks pretty > ugly):Argh. You have no idea how difficult it is to read that stuff when you're not on a Windows machine... But I suppose that converting it to plain text is a pain even *on* Windows. Anyways, as far as I can see, you are in fact getting the same interaction test (RL*COND, Sphericity Assumed, Type III SS=17.734), so I'd suspect that the test for the main effect is one of those weird things where you take the average over the three levels of cond, ignoring the fact that one level occurs twice as often as the others. What happens if you run the SPSS analysis without the interaction term? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, all. I'm working on post hoc comparisons on anovas with multiple
factors. the design is 1 repeated measure (session) and 1 between measure
(cond). my dependent measure is rl. here is the data I'm using (in a
data.frame):
mig <- data.frame(subj=factor(rep(subj,3)),
cond=factor(rep(cond,3)),
session=factor(c(rep(1,nsubj),rep(2,nsubj),rep(3,nsubj))),
rl)> mig
subj cond session rl
1 401.1 NW 1 6.4081
2 402.1 NW 1 5.8861
3 500.1 NWC 1 5.3492
4 502.1 NWC 1 8.5302
5 601.1 NWR 1 2.7519
6 602.1 NWR 1 4.5404
7 603.1 NWR 1 4.3442
8 604.1 NWR 1 3.6722
9 401.1 NW 2 6.1492
10 402.1 NW 2 5.0506
11 500.1 NWC 2 6.5625
12 502.1 NWC 2 11.4430
13 601.1 NWR 2 2.8450
14 602.1 NWR 2 5.6558
15 603.1 NWR 2 3.3340
16 604.1 NWR 2 5.0548
17 401.1 NW 3 5.2717
18 402.1 NW 3 3.7337
19 500.1 NWC 3 3.6659
20 502.1 NWC 3 5.9463
21 601.1 NWR 3 2.3356
22 602.1 NWR 3 7.5458
23 603.1 NWR 3 5.0322
24 604.1 NWR 3 4.1381
summary(mgroup <- aov(rl ~ cond * session + Error(subj/(session)), data=mig))
I'm interested in posthoc comparisons between:
various levels of condition (I can get this with TukeyHSD,
pairwise.t.test, or multcomp)
various levels of session (ditto)
the full 6 comparisons (3 sessions by 2 conditions). that is, I want
to know if NW-session1 is diff from NW-session2, etc.
> tapply(mig$rl,IND=list(mig$cond, mig$session),FUN=mean)
1 2 3
NW 6.147100 5.59990 4.502700
NWC 6.939700 9.00275 4.806100
NWR 3.827175 4.22240 4.762925
Each of the earlier tests I've tried (TukeyHSD, pairwise.*, and
multcomp) all seem to do only one factor at a time.
Suggestions?
thanks!
greg
(I know my dataset is small, doesn't give appropriate omnibus stats to
run the post-hocs, but I'm currently in testing mode.)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._