[R] MANOVA with random factor

peter dalgaard pdalgd at gmail.com
Sat May 19 10:22:00 CEST 2012


On May 18, 2012, at 16:15 , David Costantini wrote:

> Sorry about that.
> Basically I have two fixed factors (experimental group and sex) and a random factor
> (brood). I need the random factor to control for pseudoreplication because I have siblings,
> which are pseudoreplicates because share genes/environment.
> however, it is not a nested design. Then I have 8 variables.
> so I want to compare the covariance structures among groups while controlling for
> the random factor. I was told that R might do that, I mean a manova with mixed effects.

It might but it isn't easy. And especially in small samples it might not do it reliably.

First, is this a balanced design? I.e. for each brood, you have say two males and two females one of each allocated to each experimental group. In such models, the analysis can be partitioned in an analysis of brood averages and within-brood differences, where the latter can be obtained by adding brood as a fixed effect. In fact, you can do that if you just have the same number of observations per brood, but without balancing, you'll get information on some effects from multiple strata. All of this carries over to multivariate responses, but it isn't implemented for aov()/manova() so you'd have to do the averages yourself.

For arbitrary designs, lme() is probably the best/only route. The trick there is to pretend that the variables are repeated measures on the same unit and then specify an arbitrary within-unit covariance structure. It does get rather involved and I'm afraid I don't recall exactly how to do it --- it's something with correlation=, weights= for the finest-level effect (variable within individual within brood) and pdSymm for the coarser level (variable within brood). 

lme() is a bit old and has known issues with degrees-of-freedom calculations so works best if you have a sizable number of broods so that df are large enough not to matter.

Notice also, that this is the basic R-help group. There is also R-sig-ME which specializes in mixed effects, and it might be better to take the issue there. (In particular, some people there may have better memory than I do...)

-pd



> 
> Cheers
> David
> 
> ______________________________________________ 
> 
> David Costantini, PhD
> 
> http://www.davidcostantini.it
> NERC Postdoctoral research associate
> 
> Institute of Biodiversity, Animal Health and Comparative Medicine
> School of Life Sciences
> College of Medical, Veterinary and Life Sciences
> University of Glasgow
> Graham Kerr Building, room 511
> Glasgow G12 8QQ, UK
> 
> See also my association Ornis italica
> http://www.ornisitalica.com
> http://www.birdcam.it
> ____________________________________________________
> 
> 
> ________________________________
> 
> From: Helios de Rosario [mailto:helios.derosario at ibv.upv.es]
> Sent: Fri 18/05/2012 15.14
> To: David Costantini; r-help at r-project.org
> Subject: Re: [R] MANOVA with random factor
> 
> 
> 
> Hi, after re-reading I think that I misunderstood your question. You
> don't provide many details, but I suppose that the "brood" effect is
> nested within the fixed effects, so you don't mean a multivariate
> approach for a split-plot or a repeated-measures design, but the
> analysis of a multivariate mixed effects model. Do you?
> 
> In that case, perhaps the package MCMCglmm may help, although I have
> never used it, so I can't tell anything for sure.
> 
> Helios
> 
>>>> El día 17/05/2012 a las 12:05, "David Costantini"
> <David.Costantini at glasgow.ac.uk> escribió:
>> Dear All
>> I would need to perform a MANOVA with both fixed (group, sex,
> group*sex) and
>> random (brood) effects. I wonder if this is at all possible and if R
> does
>> that.
>> At the moment, I only know that I can run a classic MANOVA with R.
>> 
>> Thank you
>> David
>> 
>> ______________________________________________
>> 
>> David Costantini, PhD
>> 
>> http://www.davidcostantini.it <http://www.davidcostantini.it/> 
>> NERC Postdoctoral research associate
>> 
>> Institute of Biodiversity, Animal Health and Comparative Medicine
>> School of Life Sciences
>> College of Medical, Veterinary and Life Sciences
>> University of Glasgow
>> Graham Kerr Building, room 511
>> Glasgow G12 8QQ, UK
>> 
>> See also my association Ornis italica
>> http://www.ornisitalica.com <http://www.ornisitalica.com/> 
>> http://www.birdcam.it <http://www.birdcam.it/> 
>> ____________________________________________________
>> 
>> 
>> 
>> 
>>      [[alternative HTML version deleted]]
> 
> INSTITUTO DE BIOMECÁNICA DE VALENCIA
> Universidad Politécnica de Valencia * Edificio 9C
> Camino de Vera s/n * 46022 VALENCIA (ESPAÑA)
> Tel. +34 96 387 91 60 * Fax +34 96 387 91 69
> www.ibv.org
> 
>  Antes de imprimir este e-mail piense bien si es necesario hacerlo.
> En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección
> de Datos de Carácter Personal, le informamos de que el presente mensaje
> contiene información confidencial, siendo para uso exclusivo del
> destinatario arriba indicado. En caso de no ser usted el destinatario
> del mismo le informamos que su recepción no le autoriza a su divulgación
> o reproducción por cualquier medio, debiendo destruirlo de inmediato,
> rogándole lo notifique al remitente.
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list