[R] mixed model MANCOVA

Adam D. I. Kramer adik-rhelp at ilovebacon.org
Thu Sep 11 02:31:12 CEST 2008


Hi Erika,

 	As mentioned, I haven't run the model before and I don't have access
to your data set, so you might want to post your reply to the list as well
(cc'd again).

 	As another guessing-without-trying-anything, I'd first make sure
that in fact pop and family are factor variables with the same length as
a,b,c,treat,centroidsize.

 	Also having not used glmer before, I'm not sure how to get the p
values...since estimates and std. errors and t-values are reported, the df's
are likely known and so they probably exist in the "model" object you
created. Of course, your highest t-value is 1.92, so none of your fixed
effects would be significant at the .05 level (the two-tailed z-score cutoff
is 1.93, which is the limit for t).

--Adam

On Wed, 10 Sep 2008, Erika Crispo wrote:

> Thanks! I am still having some problems. I have tried the following:
>
>> model=glmer(cbind(a,b,c)~pop*treat+centroidsize+(1|pop/family))
> Error: Matrices must have same number of columns in rbind2(..1, r)
> In addition: Warning messages:
> 1: In family:pop :
> numerical expression has 104 elements: only the first used
> 2: In family:pop :
> numerical expression has 104 elements: only the first used
>> 
>
> I don't get the error messages if I exclude the nesting (i.e. exclude pop on 
> the RHS). But even then, I don't know how to interpret the output. How can I 
> get P values for pop and treat? I've attached my data file.
>
>> summary(model)
> Linear mixed model fit by REML
> Formula: cbind(a, b, c) ~ pop * treat + centroidsize + (1 | family)
>   AIC    BIC logLik deviance REMLdev
> -685.3 -656.2  353.6   -822.8  -707.3
> Random effects:
> Groups   Name        Variance   Std.Dev.
> family   (Intercept) 9.8877e-13 9.9437e-07
> Residual             2.3502e-05 4.8478e-03
> Number of obs: 104, groups: family, 28
>
> Fixed effects:
>                Estimate Std. Error t value
> (Intercept)     4.518e-03  4.329e-03  1.0438
> popkah         -2.338e-03  1.902e-03 -1.2297
> popkant        -2.328e-03  1.881e-03 -1.2380
> poprwe         -3.728e-03  1.941e-03 -1.9204
> treatn         -8.703e-04  1.957e-03 -0.4448
> centroidsize    -1.886e-06  2.464e-06 -0.7656
> popkah:treatn   3.440e-03  2.695e-03  1.2765
> popkant:treatn  1.198e-03  2.699e-03  0.4439
> poprwe:treatn   4.662e-03  2.746e-03  1.6976
>
> Correlation of Fixed Effects:
>           (Intr) popkah popknt poprwe treatn cntdsz ppkh:t ppknt:
> popkah      -0.228
> popkant     -0.335  0.507
> poprwe      -0.193  0.490  0.492
> treatn      -0.092  0.485  0.476  0.479
> centroidsize -0.951  0.009  0.119 -0.023 -0.128
> popkah:trtn  0.121 -0.705 -0.352 -0.346 -0.719  0.036
> popknt:trtn  0.095 -0.352 -0.680 -0.347 -0.721  0.063  0.520
> poprwe:trtn  0.117 -0.346 -0.346 -0.707 -0.706  0.037  0.510  0.511
>
>
> <><     <><     <><     <><     <><     <><     <><
> Erika Crispo, PhD candidate
> McGill University, Department of Biology
> http://www.biology.mcgill.ca/grad/erika/index.htm
>> <>     ><>     ><>     ><>     ><>     ><>     ><>
> ----- Original Message ----- From: "Adam D. I. Kramer" 
> <adik-rhelp at ilovebacon.org>
> To: "Erika Crispo" <erika.crispo at mail.mcgill.ca>
> Cc: <r-help at r-project.org>
> Sent: Wednesday, September 10, 2008 5:47 PM
> Subject: Re: [R] mixed model MANCOVA
>
>
>> Hi Erika,
>>
>>  I have not tried this before, and I hope that somebody will correct
>> me if I'm wrong, but the glmer function in the lme4 library appears to do
>> what you want. From examples(lmer):
>> 
>> lmer> (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |
>> herd), family = binomial, data = cbpp))
>> 
>> ...I guess that this will do what you want it to because it has multiple
>> variables on the LHS and both continuous and categorical variables on the
>> RHS, along with an explicit grouping structure.
>> 
>> In your case, you probably want to leave the family= argument out, as noted
>> in ?glmer, "If 'family' is missing then a linear mixed model is fit;
>> otherwise a generalized linear mixed model is fit." ...MANCOVA tend to be
>> generalized linear models.
>> 
>> Once again, though, I have not used this system personally, haven't seen
>> your data, and don't know what output to expect. Hopefully somebody else 
>> can
>> confirm or deny this solution's efficacy.
>> 
>> --Adam
>> 
>> On Mon, 8 Sep 2008, Erika Crispo wrote:
>> 
>>> Hello,
>>> 
>>> I need to perform a mixed-model (with nesting) MANCOVA, using Type III
>>> sums of squares. I know how to perform each of these types of tests
>>> individually, but I am not sure if performing a mixed-model MANCOVA is
>>> possible. Please let me know.
>>> 
>>> Erika
>>> 
>>> <><     <><     <><     <><     <><     <><     <><
>>> Erika Crispo, PhD candidate
>>> McGill University, Department of Biology
>>> http://www.biology.mcgill.ca/grad/erika/index.htm
>>>> <>     ><>     ><>     ><>     ><>     ><>     ><>
>>> [[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.
>>> 
>
>
> --------------------------------------------------------------------------------
>
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.169 / Virus Database: 270.6.19/1663 - Release Date: 9/9/2008 
> 7:04 PM
>



More information about the R-help mailing list