[R-sig-ME] Extract a variance estimate per level of random effect

Luca Borger lborger at cebc.cnrs.fr
Mon Jun 18 12:43:12 CEST 2012


 >Perhaps theres a way to get at the estimates it produces...

summary(myModel)$modelStruc$varStruc



Le 18/06/2012 11:39, Alan Haynes a écrit :
> Hi there,
>
> If youre not fixed on either lmer or mcmcglmm particularly, ot might be
> possible using lme...
> Using the weights argument you can allow an individuals variance (in your
> case) to vary. Perhaps theres a way to get at the estimates it produces...
>
>
> HTH
>
> Alan
>
> --------------------------------------------------
> Email: aghaynes at gmail.com
> Mobile: +41794385586
> Skype: aghaynes
>
>
> On 18 June 2012 11:06, Luca Borger <lborger at cebc.cnrs.fr> wrote:
>
>> Hello,
>>
>> I think there have been some recent papers on estimating individual
>> variability in behaviour, but in any case is this useful?:
>>
>> library(lme4)
>> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
>> str(ranef(fm1, postVar = TRUE))
>> attr((ranef(fm1, postVar = TRUE))[[1]],"postVar")
>>
>>
>> HTH
>> Luca
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> # Forthcoming book chapter
>> # Dispersal Ecology and Evolution (ch. 17)
>> # http://ukcatalogue.oup.com/**product/9780199608904.do<http://ukcatalogue.oup.com/product/9780199608904.do>
>> ------------------------------**------------------------------**---------
>> Luca Borger
>> Postdoctoral Research Fellow
>>
>> Centre d'Etudes Biologiques de Chizé
>> CNRS (UPR1934); INRA (USC1339)
>> 79360 Villiers-en-Bois, France
>>
>> Tel: +33 (0)549 09 96 13
>> Fax: +33 (0)549 09 65 26
>> email: lborger at cebc.cnrs.fr
>> Web: http://cnrs.academia.edu/**LucaBorger<http://cnrs.academia.edu/LucaBorger>
>> Researcher ID: http://www.researcherid.com/**rid/C-6003-2008<http://www.researcherid.com/rid/C-6003-2008>
>> Google Scholar: http://scholar.google.com/**citations?user=D5CTvNUAAAAJ<http://scholar.google.com/citations?user=D5CTvNUAAAAJ>
>> ------------------------------**------------------------------**---------
>> # Newly published! Animal Migration: A synthesis (ch. 8):
>> # http://ukcatalogue.oup.com/**product/9780199568994.do<http://ukcatalogue.oup.com/product/9780199568994.do>
>>
>> Le 18/06/2012 10:29, Samantha Patrick a écrit :
>>
>>   Hi
>>>
>>> I am currently trying to estimate how consistent individuals are in a
>>> trait.  I want to produce an estimate of the variability for each level of
>>> a random effect (ID).  I can do this simply by calculation the variance for
>>> each ID separately but I am trying to extract this information from a mixed
>>> model (either in lmer or mcmcglmm).  I have trawled the mailing list but
>>> can not find any answers.
>>>
>>> As an simplified dummy example I have 2 individuals, each with 5
>>> observations of a trait.  I can calculate 2 variances, using the 5
>>> observations for each individual.
>>>
>>> head(Data)
>>> ID    trait1
>>> 1        10
>>> 1        15
>>> 1        12
>>> 1        19
>>> 1        11
>>> 2        9
>>> 2        10
>>> 2        9
>>> 2        10
>>> 2        10
>>>
>>> Variance for 1 = 4.67
>>> Variance for 2 = 0.3
>>>
>>> Alternatively I can fit a model of:
>>>
>>> model1<-lmer(trait1 ~(1|ID))
>>>
>>>  From the variance covariance matrix I can easily extract the between and
>>> within group variances, but is there a way to extract individual variance
>>> estimates?
>>>
>>> Many Thanks
>>>
>>> Sam
>>>
>>>
>> ______________________________**_________________
>> R-sig-mixed-models at r-project.**org <R-sig-mixed-models at r-project.org>mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-mixed-models<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
>>
>



More information about the R-sig-mixed-models mailing list