[R-sig-ME] Lmer and variance-covariance matrix
Douglas Bates
bates at stat.wisc.edu
Fri Mar 11 14:18:53 CET 2011
On Thu, Mar 3, 2011 at 7:03 AM, Antoine Paccard
<antoine.paccard at unine.ch> wrote:
> Dear modelers,
> I have been trying in the past few months to obtain a variance-
> covariance matrix using lmer. I failed multiple times until I decided
> to do it under SAS. Now, I am going back on it and would like to run
> it with R.
> I measured 15 different traits and my data is organized this way:
> fam id trait score
> 57 1 1 0.047207645
> 57 2 1 1.420790311
> 57 3 1 -0.290782077
> 57 1 2 -0.585655473
> 57 2 2 -0.986483343
> 57 3 2 0.290187057
> 57 1 3 0.741162271
> 57 2 3 1.59448736
> 57 3 3 .
> . . . .
> . . . .
> . . . .
> 57 1 15 .
> 57 2 15 .
> 57 3 15 .
> 58 1 1 .
> 58 2 1 .
> 58 3 1 .
> . . . .
> . . . .
> . . . .
> 58 1 15 .
> 58 2 15
> 58 3 15
> .
> .
> .
> 100 1 15
> 100 2 15
> 100 3 15
> with “fam” being the family, “id” the individual, “trait”
> the traits measured and “score” the result of each measures.
> So far I have been trying to fit this model:
> d <- data
> d$fam1 <- factor(d$fam)
> d$id1 <- factor(d$id)
> d$trait1 <- factor(d$trait)
> w.family <- lmer(score ~ (trait1 | fam1/id1 ), data=d)
> But I was getting some “stack overflow” error messages so I ran the
> model this way:
> w.family <- lmer(score ~ (trait1 | fam1/id1 ), data=d,control = list
> (maxIter = 500))
If there are 15 levels of trait you are trying to estimate 240
variance-covariance parameters (120 for fam1 and 120 for fam1:id1).
That is a very large optimization problem, I'm not surprised that
there is difficulty in finding the optimum.
> Although it still didn’t work and I am now wondering what is wrong in
> this model. The reason why I have put “trait1” in the random effect
> is because it was the only way for me to obtain a variance-covariance
> matrix on all my traits.
> I am currently trying to put “trait1” also as fixed effect:
> w.family <- lmer(score ~ trait1 + (trait1 | fam1/id1 ), data=d,control
> = list (maxIter = 500))
> I would be curious to know what you think about such a model and why
> it actually doesn’t work.
> Moreover, I am trying to write done the equation for the model:
> w.family <- lmer(score ~ (trait1 | fam1/id1 ), data=d)
> but can’t figure it out. I know I should get something as:
> Scoreij = µ + fam(i) + Ij(i) + ε
> But I am not sure if that’s right.
> What do you think? Thanks a lot for your help,
> Best,
> Antoine Paccard
> -----------
> Antoine Paccard,
> Laboratory of Evolutionary Botany,
> Institut of biology, Faculté des Sciences,
> University of Neuchâtel, Unimail,
> Rue Émile-Argand 11,
> 2000, Neuchâtel Switzerland
> Office: (0041) (0)32 718 23 49
> Fax: (0041) (0)32 718 30 01
> www.unine.ch/members/antoine.paccard/
> http://www2.unine.ch/evobot
>
>
> [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
More information about the R-sig-mixed-models
mailing list