[R] Repeated Measure different results to spss
John Vokey
vokey at uleth.ca
Tue Jul 10 22:11:53 CEST 2007
This should work (with x containing the dataframe):
> x$Id=factor(x$Id)
> x$Group=factor(x$Group)
> x$Task=factor(x$Task)
> str(x)
'data.frame': 48 obs. of 4 variables:
$ Id : Factor w/ 24 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9
10 ...
$ Group: Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
$ Task : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
$ Score: num 0.39 0.48 0.59 0.33 0.38 0.37 0.47 0.2 0.29 0.41 ...
> out.aov = aov(Score~Group*Task+Error(Id+Id:Task),data=x)
> summary(out.aov)
Error: Id
Df Sum Sq Mean Sq F value Pr(>F)
Group 1 0.03420 0.03420 2.1382 0.1578
Residuals 22 0.35189 0.01600
Error: Id:Task
Df Sum Sq Mean Sq F value Pr(>F)
Task 1 0.048133 0.048133 5.2144 0.03242 *
Group:Task 1 0.024687 0.024687 2.6743 0.11621
Residuals 22 0.203080 0.009231
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
out.aov = aov(Score~Group*Task+Error(Id),data=x) will work as well,
but the error-term will be labelled simply as ``Within'', rather than
as the interaction of Id*Task
>
> Hi,
>
> I have some problems with my repeated measures analysis. When I
> compute it
> with SPSS I get different results than with R. Probably I am doing
> something
> wrong in R.
> I have two groups (1,2) both having to solve a task under two
> conditions
> (1,2). That is one between subject factor (group) and one within
> subject
> factor (task). I tried the following:
>
> aov(Score ~factor(Group)*factor(Task)+Error(Id)))
> aov(Score ~factor(Group)*factor(Task))
> but it leads to different results than my spss. I definitely miss
> some point
> here .
>
> Thanks for you help.
>
> Id Group Task Score
> 1 1 1 0.39
> 2 1 1 0.48
More information about the R-help
mailing list