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 3 1 1 0.59 4 1 1 0.33 5 1 1 0.38 6 1 1 0.37 7 1 1 0.47 8 1 1 0.2 9 1 1 0.29 10 1 1 0.41 11 1 1 0.24 12 1 1 0.28 13 1 1 0.32 14 1 1 0.26 15 2 1 0.65 16 2 1 0.41 17 2 1 0.62 18 2 1 0.39 19 2 1 0.81 20 2 1 0.34 21 2 1 0.32 22 2 1 0.33 23 2 1 0.33 24 2 1 0.38 1 1 2 0.46 2 1 2 0.27 3 1 2 0.41 4 1 2 0.13 5 1 2 0.41 6 1 2 0.36 7 1 2 0.32 8 1 2 0.33 9 1 2 0.44 10 1 2 0.36 11 1 2 0.2 12 1 2 0.3 13 1 2 0.27 14 1 2 0.4 15 2 2 0.35 16 2 2 0.37 17 2 2 0.34 18 2 2 0.24 19 2 2 0.44 20 2 2 0.34 21 2 2 0.4 22 2 2 0.28 23 2 2 0.32 24 2 2 0.33 -- View this message in context: http://www.nabble.com/Repeated-Measure-different-results-to-spss-tf4054506.html#a11516870 Sent from the R help mailing list archive at Nabble.com.
We don't know what you are after (or what you did in SPSS), but> dat <- read.table("mb2.dat", header=TRUE,colClasses=c(rep("factor",3), "double"))> summary(aov(Score ~ Group * Task + Error(Id), dat))would seem to be the sort of thing your description indicates. If you tell us what you are looking for (and why) we may be able to tell you how to get it in R. On Tue, 10 Jul 2007, mb2 wrote:> > 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 > 3 1 1 0.59 > 4 1 1 0.33 > 5 1 1 0.38 > 6 1 1 0.37 > 7 1 1 0.47 > 8 1 1 0.2 > 9 1 1 0.29 > 10 1 1 0.41 > 11 1 1 0.24 > 12 1 1 0.28 > 13 1 1 0.32 > 14 1 1 0.26 > 15 2 1 0.65 > 16 2 1 0.41 > 17 2 1 0.62 > 18 2 1 0.39 > 19 2 1 0.81 > 20 2 1 0.34 > 21 2 1 0.32 > 22 2 1 0.33 > 23 2 1 0.33 > 24 2 1 0.38 > 1 1 2 0.46 > 2 1 2 0.27 > 3 1 2 0.41 > 4 1 2 0.13 > 5 1 2 0.41 > 6 1 2 0.36 > 7 1 2 0.32 > 8 1 2 0.33 > 9 1 2 0.44 > 10 1 2 0.36 > 11 1 2 0.2 > 12 1 2 0.3 > 13 1 2 0.27 > 14 1 2 0.4 > 15 2 2 0.35 > 16 2 2 0.37 > 17 2 2 0.34 > 18 2 2 0.24 > 19 2 2 0.44 > 20 2 2 0.34 > 21 2 2 0.4 > 22 2 2 0.28 > 23 2 2 0.32 > 24 2 2 0.33 >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
mb2 wrote:> 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 . > >Did you mean Error(factor(Id)) ? With that modification, things look sane. Can't vouch for SPSS... (As a general matter, I prefer to do the factor conversions up front, rather than inside model formulas.) -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
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