[R] extracting elements from print object of Manova()

Michael Friendly friendly at yorku.ca
Wed Jul 16 17:00:38 CEST 2008


Michael,

If you mean Manova in the car package (or manova in stats), just use 
str() on the resulting object to see the slots.  However, Manova() 
doesn't return F values, since these depend on the type of test
statistic used for the multivariate test.

 > library(car)
 > ?Manova
 > soils.mod <- lm(cbind(pH,N,Dens,P,Ca,Mg,K,Na,Conduc) ~ Block + 
Contour*Depth,
+     data=Soils)
 > man <-Manova(soils.mod)
 > str(man)
List of 8
  $ SSP     :List of 4
   ..$ Block        : num [1:9, 1:9]   1.2325  -0.0466   0.2716 -62.6558 
  -0.6192 ...
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   ..$ Contour      : num [1:9, 1:9]  0.2607 -0.0172  0.1002 23.9644 
-1.5842 ...
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   ..$ Depth        : num [1:9, 1:9]   14.96    1.45   -4.30 1703.12 
74.47 ...
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   ..$ Contour:Depth: num [1:9, 1:9]   0.5159   0.0137   0.0457 -30.9419 
   1.5070 ...
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   .. .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
  $ SSPE    : num [1:9, 1:9]    4.247   -0.049   -0.201 -118.777 
9.368 ...
   ..- attr(*, "dimnames")=List of 2
   .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
   .. ..$ : chr [1:9] "pH" "N" "Dens" "P" ...
  $ df      : Named num [1:4] 3 2 3 6
   ..- attr(*, "names")= chr [1:4] "Block" "Contour" "Depth" "Contour:Depth"
  $ error.df: int 33
  $ terms   : chr [1:4] "Block" "Contour" "Depth" "Contour:Depth"
  $ repeated: logi FALSE
  $ type    : chr "II"
  $ test    : chr "Pillai"
  - attr(*, "class")= chr "Anova.mlm"


Michael Rennie wrote:
> Hi there,
> 
> Does anyone know how to extract elements from the table returned by Manova()?
> 
> Using the univariate equivalent, Anova(), it's easy:
> 
> a.an<-Anova(lm(y~x1*x2))
> 
> a.an$F
> 
> This will return a vector of the F-values in order of the terms of the model.
> 
> However, a similar application using Manova():
> 
> m.an<-Manova(lm(Y~x1~x2))
> 
> m.an$F
> 
> Returns NULL. So does any attempt at calling the headers in the MANOVA table.
> 
> Any thoughts?
> 
> Mike


-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list