[R-sig-ME] confidence intervals for random slopes

Lionel hughes.dupond at gmx.de
Mon Aug 11 18:13:45 CEST 2014


Dear Veronika,

The sim function from the arm package might be what you are looking for, 
there are some nice example at the end of the help page (?sim). It is 
then easy to extract from the simulation the credible intervals for the 
coefficient that do not vary per group (like fixfactor in your example), 
something like 
quantile(fixef(model.sim)[,"fixfactor.level2"],probs=c(0.025,0.5,0.975)) 
will do the job. For coefficient varying per group (like the slope of X) 
I am less sure but something like: 
quantile(ranef(model.sim)$randomfactor[,1,"X"],probs=c(0.025,0.5,0.975) 
would give you a credible interval for the random effect on the slope of 
X for group 1 (ie the interaction between the slope of X and the group 
1). I am not sure about how to combine this with the credible intervals 
from the slope in itself: 
quantile(fixef(model.sim)[,"X"],probs=c(0.025,0.5,0.975)).

I am very interested to see if other people on the list have other 
suggestion since I have been thinking about this for some time ...

Yours,
Lionel


On 10/08/2014 16:14, Bokony Veronika wrote:
> Dear all,
>
> let me ask your advice about calculating confidence intervals for random slopes. I have a random intercept & random slope model like this:
>
> lme(Y ~ X * fixfactor, random=~X|randomfactor)
>
> where randomfactor has 9 levels. For each of these 9 levels, I can calculate the slope of X from the fixed and random effect estimates. I would like to add some measure of uncertainty to each of these 9 estimates, i.e. an SE or CI for each random slope. The random effects SD which is given by the lme summary output is not what I'm interested in. I got a very general tip that I could calculate credible intervals from posterior distributions using a bayesian approach, but I found no evident way of extracting these from MCMCglmm either.
>
> I would be very grateful for any working example that can achieve this.
>
> Best regards,
>
> Veronika
>
>
> Veronika Bókony PhD
> "Lendület" Evolutionary Ecology Research Group
> Plant Protection Institute, Centre for Agricultural Research
> Hungarian Academy of Sciences
> Herman Ottó út 15.
> H-1022 Budapest, Hungary
> +36 1 3918609
> http://www.nki.hu/lendulet-evolucios-okologiai-kutatocsoport
> http://ornithology.limnologia.hu/people/veronika-bokony/
>
> _______________________________________________
> 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