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

Beatriz De Francisco Beatriz.DeFrancisco at sams.ac.uk
Tue Jun 19 13:01:49 CEST 2012


Hi

If you are using lme() you can use the VarCorr() function to get the between and with-in variance for the random part of the model.
For a good explanation you can try http://plantecology.syr.edu/fridley/bio793/mixed1.html

Beatriz de Francisco Mora
PhD Student
The Scottish Association for Marine Science
Scottish Marine Institute
Oban
PA37 1QA
Tel: 06131 559000 (switchboard)
Fax: 01631559001
E. beatriz.defrancisco at sams.ac.uk
http://www.smi.ac.uk/beatriz-de-francisco


Message: 1
Date: Mon, 18 Jun 2012 12:43:12 +0200
From: Luca Borger <lborger at cebc.cnrs.fr>
To: Alan Haynes <aghaynes at gmail.com>
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Extract a variance estimate per level of
        random  effect
Message-ID: <4FDF0640.7010908 at cebc.cnrs.fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 >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>
>>
>
The Scottish Association for Marine Science (SAMS) is registered in Scotland as a Company Limited by Guarantee (SC009292) and is a registered charity (9206). SAMS has an actively trading wholly owned subsidiary company: SAMS Research Services Ltd a Limited Company (SC224404). All Companies in the group are registered in Scotland and share a registered office at Scottish Marine Institute, Oban Argyll PA37 1QA. The content of this message may contain personal views which are not the views of SAMS unless specifically stated. Please note that all email traffic is monitored for purposes of security and spam filtering. As such individual emails may be examined in more detail.



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