# Re: [R] MANOVA proportion of variance explained

From: Michael Friendly <friendly_at_yorku.ca>
Date: Mon, 21 Jun 2010 12:09:36 -0400

Sam Brown wrote:
> Hi Michael
>
> Thank you very much for the intel regarding eta^2. It is pretty much the sort of thing that I am wanting.
>
The latest developer version of the heplots package on R-Forge now includes an initial implementation of etasq() for multivariate linear models. Note that for s>1 dimensional tests, the values of eta^2 differ according to the test statistic: Pillai trace (default), Hotelling-Lawley trace, Wilks' Lambda, Roy maximum root test. See ?heplots:::etasq for details.

``` > # install.packages("heplots",repos="http://R-Forge.R-project.org")
> library(heplots)
> data(Soils)  # from car package
> soils.mod <- lm(cbind(pH,N,Dens,P,Ca,Mg,K,Na,Conduc) ~ Block +
```
Contour*Depth, data=Soils)
> etasq(Anova(soils.mod))
```                  eta^2
Block         0.5585973
Contour       0.6692989
Depth         0.5983772
```

Contour:Depth 0.2058495
> etasq(soils.mod) # same
```                  eta^2
Block         0.5585973
Contour       0.6692989
Depth         0.5983772
```

Contour:Depth 0.2058495
> etasq(Anova(soils.mod), anova=TRUE)

Type II MANOVA Tests: Pillai test statistic

```                eta^2 Df test stat approx F num Df den Df    Pr(>F)
Block         0.55860  3    1.6758   3.7965     27     81 1.777e-06 ***
Contour       0.66930  2    1.3386   5.8468     18     52 2.730e-07 ***
Depth         0.59838  3    1.7951   4.4697     27     81 8.777e-08 ***
Contour:Depth 0.20585  6    1.2351   0.8640     54    180    0.7311
```
```---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>

>
> Found a good paper regarding all this:

>
> Estimating an Effect Size in One-Way Multivariate Analysis of Variance (MANOVA)
> H. S. Steyn Jr; S. M. Ellisa
> Multivariate Behavioral Research
> 2009 44: 1, 106 — 129
>
This paper may be more confusing than helpful, since the emphasis is on
the use of eta^2 as measures of multivariate
'effect size' and I think they try to blend in too many different
threads from the effect-size literature.  And they don't
discuss what happens in designs with more than one factor or regressor.
In the general case, etasq() calculates
measures of partial eta^2, reflecting the *additional* proportion of
variance associated with a given term in the
full model that includes it, relative to the reduced model that excludes
it, analogous to partial R^2 in univariate
regression models.

>
>> Date: Wed, 16 Jun 2010 10:11:05 -0400
>> From: friendly_at_yorku.ca
>> To: s_d_j_brown_at_hotmail.com
>> CC: r-help_at_r-project.org
>> Subject: Re: MANOVA proportion of variance explained
>>
>> I think you are looking for a multivariate measure of association,
>> analogous to R^2 for a univariate linear model. If so, there are
>> extensions of eta^2 from univariate ANOVAs for each of the multivariate
>> test statistics, e.g.,
>>
>> for Pillai (-Bartlett) trace and Hotelling-Lawley trace and a given
>> effect tested on p response measures
>>
>> eta2(Pillai) = Pillai / s
>> eta2(HLT) = HLT / (HLT+s)
>> where s = min(df_h, p)
>>
>> Alternatively, you could look at the candisc package which, for an
>> s-dimensional effect, gives a breakdown of the variance reflected in
>> each dimension of the latents roots of HE^{-1}
>>
>>
>> Sam Brown wrote:
>>
>>> Hello everybody
>>>
>>> After doing a MANOVA on a bunch of data, I want to be able to make some comment on the amount of variation in the data that is explained by the factor of interest. I want to say this in the following way: XX% of the data is explained by A.
>>>
>>> I can acheive something like what I want by doing the following:
>>>
>>> X <- structure(c(9, 6, 9, 3, 2, 7), .Dim = as.integer(c(3, 2)))
>>> Y <- structure(c(0, 2, 4, 0), .Dim = as.integer(c(2, 2)))
>>> Z <- structure(c(3, 1, 2, 8, 9, 7), .Dim = as.integer(c(3, 2)))
>>> U <- rbind(X,Y,Z)
>>> m <- manova(U~as.factor(rep(1:3, c(3, 2, 3))))
>>> summary(m,test="Wilks")
>>> SS<-summary(m)\$SS
>>> (a<-mean(SS[[1]]/(SS[[1]]+SS[[2]])))
>>>
>>> and concluding that 94% of variation is explained.
>>>
>>> Is my desire misguided? If it is a worthy aim, is this a valid way of acheiving it?
>>>
>>> Thanks a lot!
>>>
>>> Sam
>>>
>>> Samuel Brown
>>> Research assistant
>>> Bio-Protection Research Centre
>>> PO Box 84
>>> Lincoln University
>>> Lincoln 7647
>>> Canterbury
>>> New Zealand
>>> sam.brown_at_lincolnuni.ac.nz
>>> http://www.the-praise-of-insects.blogspot.com
>>>
>>>
>

>
>> --
>> 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 Web: http://www.datavis.ca
>> Toronto, ONT M3J 1P3 CANADA
>>
>>

> _________________________________________________________________
> Find a way to cure that travel bug MSN NZ Travel

> http://travel.msn.co.nz/

--
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    Web:   http://www.datavis.ca