[R-sig-ME] Confidence Interval of random effect variances in lmer
Ben Bolker
bbolker at gmail.com
Mon Jul 8 13:45:24 CEST 2013
tommy gaillard <tommy.gaillard40 at ...> writes:
>
> Hi all,
>
> I have sent a similar post lately but this one is updated.
> I would like to obtain the Confidence Interval of random effect * variances*
> (intercept and slope) in a lmer model . Here is the model to make this
> clear:
> fit<-lmer(logitprop_vig~logdensity+logbiomasstrue+
> loggpsize+position+(1+logdensity|Idtag),na.action=na.omit,
> data=tabimpala)
> I am interested in the following output
> Random effects:
> Groups Name Variance Std.Dev. Corr
> Idtag (Intercept) 0.000000 0.00000
> logdensity 0.050391 0.22448 NaN
> Residual 1.552516 1.24600
> Number of obs: 283, groups: Idtag, 15
>
> I need to obtain the CI of the variance of the intercept and slope of the
> variable "logdensity".
In principle you should be able to get confidence intervals
with the development version of lme4: see the installation
notes at the *bottom* of https://github.com/lme4/lme4/ ,
e.g.
library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
pp <- profile(fm1)
confint(pp)
However, you are quite likely to have difficulty
with this because one of your random effects is estimated as
zero.
You might try MCMCglmm:
library(MCMCglmm)
mm <- MCMCglmm(Reaction ~ Days,
random = ~us(Days):Subject, data=sleepstudy)
summary(mm)
the 'G-structure' part of the output gives you lower and upper
bounds on the 95% credible interval.
>
> I have tried different packages and functions but it is failing to work.
> The one I believe that could work is the profile () function from the lm4a
> package but I did not manage to get this latter in R. If someone knows how
> to make this work , I would be glad to hear it!
>
> I believe this is very important in different field to obtain those values
> as it would allow to knwo the magnitude of the variabilty estimates and
> their uncertainty.
>
> Any help would be very appreciated.
>
> Thank you
>
More information about the R-sig-mixed-models
mailing list