Juan Andres Hernandez
2011-Mar-19 12:44 UTC
[R] how to access the elements of a univariate results table with Anova (library car)
Dear R users, I use the excelent Anova function of the library car because the easy way to get sphericity correction. Unless I use the scan function. I have not been able to access the values of sum squares and degrees of freedom for each effect in the univariate summary table. Example of the car library for Anova function: library(car) phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)), levels=c("pretest", "posttest", "followup")) hour <- ordered(rep(1:5, 3)) idata <- data.frame(phase, hour) mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, post.1, post.2, post.3, post.4, post.5, fup.1, fup.2, fup.3, fup.4, fup.5) ~ treatment*gender, data=OBrienKaiser) av.ok <- Anova(mod.ok, idata=idata, idesign=~phase*hour) summary(av.ok, multivariate=FALSE) If you assign the above line to a new object you will get a multivariate summary and not the univariate one. my.summary <- summary(av.ok, multivariate=FALSE) my.summary Does anyone know how to assign the full univariate output to a new object or variable. The logical way does not produce the desired result. Than'ks in advance. Juan Hernández Cabrera Facultad de Psicología Universidad de La Laguna Spain [[alternative HTML version deleted]]
David Winsemius
2011-Mar-19 14:27 UTC
[R] how to access the elements of a univariate results table with Anova (library car)
On Mar 19, 2011, at 8:44 AM, Juan Andres Hernandez wrote:> Dear R users, I use the excelent Anova function of the library car > because > the easy way to get sphericity correction. Unless I use the scan > function. I > have not been able to access the values ??of sum squares and > degrees of > freedom for each effect in the univariate summary table. > > Example of the car library for Anova function: > > library(car) > phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)), > levels=c("pretest", "posttest", "followup")) > hour <- ordered(rep(1:5, 3)) > idata <- data.frame(phase, hour) > > mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, > post.1, post.2, post.3, post.4, post.5, > fup.1, fup.2, fup.3, fup.4, fup.5) ~ > treatment*gender, > data=OBrienKaiser) > av.ok <- Anova(mod.ok, idata=idata, idesign=~phase*hour) > > summary(av.ok, multivariate=FALSE) > > If you assign the above line to a new object you will get a > multivariate > summary and not the univariate one. > > my.summary <- summary(av.ok, multivariate=FALSE) > my.summary > > Does anyone know how to assign the full univariate output to a new > object > or variable. The logical way does not produce the desired result. > Than'ks in advance.summary,Anova.mlm appears to returns the object that was passed to it. How to I know this (despite never having used the function before and having tried unsuccessfully to access the answer with help(summary.Anova.mlm))? I looked at the code. You are getting console output that varies a bit with different parameters to summary, but the object av.ok being passed as the value of summary and is not changing. > all.equal(av.ok, my.summary) [1] TRUE If you want to capture the text output that appears on the console display then you need to use either sink() or capture.output().> > Juan Hern?ndez Cabrera > Facultad de Psicolog?a > Universidad de La Laguna > Spain-- David Winsemius, MD West Hartford, CT
Possibly Parallel Threads
- car::Anova - Can it be used for ANCOVA with repeated-measures factors.
- [package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?
- Wrapper of linearHypothesis (car) for post-hoc of repeated measures ANOVA
- new to repeated measures anova in R
- mixed effects or fixed effects?