Dear Lisa, > -----Original Message----- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of peter > dalgaard > Sent: Friday, November 23, 2018 10:16 AM > To: Lisa van der Burgh <40760...@student.eur.nl> > Cc: r-help@R-project.org > Subject: Re: [R] Question Mixed-Design Anova in R > > You seem to be bringing in a ton of stuff without looking at features in base > R... > > Check > > help(mauchly.test) > help(anova.mlm) > > and examples therein. There are also options in the "car" package.
With respect to the latter, see in particular the O'Brien-Kaiser example in ?Anova. I hope this helps, John ----------------------------------------------------------------- John Fox Professor Emeritus McMaster University Hamilton, Ontario, Canada Web: https://socialsciences.mcmaster.ca/jfox/ > > -pd > > > On 23 Nov 2018, at 11:43 , Lisa van der Burgh <40760...@student.eur.nl> > wrote: > > > > Hi Everyone, > > > > > > > > I have a question about Mixed-Design Anova in R. I want to obtain Mauchly s > test of Sphericity and the Greenhouse-Geisser correction. I have managed to > do it in SPSS: > > > > > > > > GLM Measure1 Measure2 Measure3 Measure4 Measure5 Measure6 BY > Grouping > > > > /WSFACTOR=Measure 6 Polynomial > > > > /METHOD=SSTYPE(3) > > > > /PLOT=PROFILE(Measure*Grouping) > > > > /CRITERIA=ALPHA(.05) > > > > /WSDESIGN=Measure > > > > /DESIGN=Grouping. > > > > > > > > I have tried to replicate this in R: > > > > library("dplyr") > > > > library("tidyr") > > > > library("ggplot2") > > > > library("ez") > > > > > > > > PatientID <- c(1:10) > > > > Measure1 <- c(3,5,7,4,NA,7,4,4,7,2) > > > > Measure2 <- c(1,2,5,6,8,9,5,NA,6,7) > > > > Measure3 <- c(3,3,5,7,NA,4,5,7,8,1) > > > > Measure4 <- c(1,2,5,NA,3,NA,6,7,3,6) > > > > Measure5 <- c(2,3,NA,8,3,5,6,3,6,4) > > > > Measure6 <- c(1,2,4,6,8,3,5,6,NA,4) > > > > Grouping <- c(1,0,1,1,1,0,0,1,1,0) > > > > dataframe <- data.frame(PatientID, Measure1, Measure2, Measure3, > > Measure4, Measure5, Measure6, Grouping) > > > > dataframe$Grouping <- as.factor(dataframe$Grouping) > > > > dataframe > > > > > > > > ezPrecis(dataframe) > > > > glimpse(dataframe) > > > > > > > > dataframe %>% count(PatientID) > > > > > > > > dataframe %>% count(PatientID, Grouping, Measure1, Measure2, > Measure3, > > Measure4, Measure5, Measure6) %>% > > > > filter(PatientID %in% c(1:243)) %>% > > > > print(n = 10) > > > > > > > > # So, we have a mixed design with one between factor (Grouping) and 6 > within factors (Measure 1 to 6). > > > > > > > > dat_means <- dataframe %>% > > > > group_by(Grouping, Measure1, Measure2, Measure3, Measure4, > Measure5, > > Measure6) %>% > > > > summarise(mRT = mean(c(Measure1, Measure2, Measure3, Measure4, > > Measure5, Measure6))) %>% ungroup() > > > > View(dat_means) > > > > > > > > ggplot(dat_means, aes(c(Measure1, Measure2, Measure3, Measure4, > > Measure5, Measure6), mRT, colour = Grouping)) + > > > > geom_line(aes(group = Grouping)) + > > > > geom_point(aes(shape = Grouping), size = 3) + > > > > facet_wrap(~group) > > > > > > > > ANOVA <- ezANOVA(dat, x, PatientID, within = .( c(Measure1, Measure2, > > Measure3, Measure4, Measure5, Measure6)), > > > > between = Grouping, type = 3) > > > > > > > > print(ANOVA) > > > > > > > > > > > > However, this does not work. I know I am probably doing it completely > wrong, but I do not know how to solve it. Besides that, I do not know what to > fill in at the x . > > > > Can somebody help me? > > > > > > > > Thank you in advance. > > > > Lisa > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 > Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd....@cbs.dk Priv: pda...@gmail.com > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.