I have reformatted the data input in the following ways, and I get the normal results: >subject<-factor(c("s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10")) >condition<-factor(c("c1","c1","c1","c1","c1","c1","c1","c1","c1","c1","c2","c2","c2","c2","c2","c2","c2","c2","c2","c2","c5","c5","c5","c5","c5","c5","c5","c5","c5","c5")) > recall<-c(10,6,11,22,16,15,1,12,9,8,13,8,14,23,18,17,1,15,12,9,13,8,14,25,20,17,4,17,12,12) > example<-data.frame(subject,condition,recall) > aov.recall <- aov(recall~condition + Error(subject/condition),data=example) > summary(aov.recall) Error: subject Df Sum Sq Mean Sq F value Pr(>F) Residuals 9 942.53 104.73
Error: subject:condition Df Sum Sq Mean Sq F value Pr(>F) condition 2 52.267 26.133 42.506 1.519e-07 *** Residuals 18 11.067 0.615 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 But I have some follow-up questions: 1. In aov, why IVs (subject & condition) cannot be in number format? 2. Why I need to use factor() on IVs (subject & condition) but I cannot use factor() on DV (recall)? Thanks a lot! - John On Mon, Jun 1, 2009 at 6:31 PM, tsunhin wong <thjw...@gmail.com> wrote: > Dear R users, > > I have copied for following table from an article on "Using confidence > intervals in within-subject designs": > > Subject 1sec 2sec 5sec > 1 10 13 13 12.00 > 2 6 8 8 7.33 > 3 11 14 14 13.00 > 4 22 23 25 23.33 > 5 16 18 20 18.00 > 6 15 17 17 16.33 > 7 1 1 4 2.00 > 8 12 15 17 14.67 > 9 9 12 12 11.00 > 10 8 9 12 9.67 > > I rearranged the data this way: >>subject<-factor(c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10)) >>condition<-factor(c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5)) >>recall<-factor(c(10,6,11,22,16,15,1,12,9,8,13,8,14,23,18,17,1,15,12,9,13,8,14,25,20,17,4,17,12,12)) >>example<-cbind(subject,condition,recall) > > Using ANOVA (aov), I should have DF for condition = 2, DF of subjects > = 9, Interaction DF = 18 > And a term for mean square of interaction. (0.61) > > But, I have something like below instead: >>aov.recall <- aov(recall~condition + >>Error(subject/condition),data=as.data.frame(example)) >>summary(aov.recall) > > Error: subject > Df Sum Sq Mean Sq F value Pr(>F) > Residuals 1 12.898 12.898 > > Error: subject:condition > Df Sum Sq Mean Sq > condition 1 34.505 34.505 > > Error: Within > Df Sum Sq Mean Sq F value Pr(>F) > condition 1 3.22 3.22 0.1378 0.7135 > Residuals 26 607.54 23.37 > > The within-subject (repeated measure) anova of R seems to be a bit > subtle for me, please point out the errors that I have made if you > can. > Thank you very much! > > - John > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.