An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20101001/b24b20fa/attachment.pl>
Confidence Intervals on Fitted Values from lmer
4 messages · Corey Godfrey, Douglas Bates, Michael Lawrence
On Fri, Oct 1, 2010 at 2:33 PM, Corey Godfrey
<Corey.Godfrey at cadmusgroup.com> wrote:
Hello,
I would like to plot confidence intervals around the fitted values of a mixed effects model. Is this advisable? If so, is there a method for doing so?
First you need to decide what kind of confidence interval you have in mind, involving the fixed-effects parameters only or both the fixed- and random-effects. You may be able to get what you want from the variance-covariance matrix for the estimates of the fixed-effects parameters, available as vcov(fittedModel), but I can't guarantee it. I would need to think more carefully about the interpretation of the various types of variability.
Yes, that seems to be the tricky part. I am able to extract what I need for the fixed effects from the variance-covariance matrix. However, the resulting confidence intervals are much wider than I believe they should be. I think this might be because the random effects are helping to explain some of the variance in the data, resulting in "significant" t-values on my fixed effects of interest, but they (the random effects) are not included in the calculation of the confidence intervals. Therefore, a plot of the fitted values and confidence intervals appears to show a non-significant association between fitted values and my fixed effect of interest (i.e., you could draw a straight line between the CIs). I apologize for not including the code in my post, but it is quite lengthy. I am also not a statistician or an expert in R, so am doing my best to explain this problem without getting in too far over my head. -----Original Message----- From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas Bates Sent: Friday, October 01, 2010 3:55 PM To: Corey Godfrey Cc: r-sig-mixed-models at r-project.org Subject: Re: [R-sig-ME] Confidence Intervals on Fitted Values from lmer On Fri, Oct 1, 2010 at 2:33 PM, Corey Godfrey
<Corey.Godfrey at cadmusgroup.com> wrote:
Hello,
I would like to plot confidence intervals around the fitted values of a mixed effects model. Is this advisable? If so, is there a method for doing so?
First you need to decide what kind of confidence interval you have in mind, involving the fixed-effects parameters only or both the fixed- and random-effects. You may be able to get what you want from the variance-covariance matrix for the estimates of the fixed-effects parameters, available as vcov(fittedModel), but I can't guarantee it. I would need to think more carefully about the interpretation of the various types of variability.
I thought I'd try to contribute a couple points: 1) Overlap of 95% CIs doesn't necessarily mean that two points can't be considered as draw from populations of different means. On the other hand, examining overlap of 84% CIs may let you make this inference. Ref: http://stats.stackexchange.com/questions/1169/ci-for-a-difference-based-on-independent-cis 2) The latest version (2.1) of the ez package, released earlier this week, has an ezPredict() function that obtains lmer model predictions for fixed effects plus expected variance (n.b. the variance considers fixed effects only). Mostly a wrapper around code found at the glmm wiki (glmm.wikidot.com/faq), but possibly convenient. 3) When in doubt, bootstrap! :Op Depending on the complexity of your design, you may find the ezBoot() function from the ez package interesting. By default it can only accept 1 random effect, and fixed effects aren't allowed to affect the intercept, but you could take a look at its source and easily adapt it to a more complex situation (though you'll need to give careful consideration to formulating a proper sampling procedure in the context of those complications). Then look to ezBootPlot() for visualization inspiration. Cheers, Mike -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University Looking to arrange a meeting? Check my public calendar: http://tr.im/mikes_public_calendar ~ Certainty is folly... I think. ~ On Fri, Oct 1, 2010 at 5:17 PM, Corey Godfrey
<Corey.Godfrey at cadmusgroup.com> wrote:
Yes, that seems to be the tricky part. I am able to extract what I need for the fixed effects from the variance-covariance matrix. However, the resulting confidence intervals are much wider than I believe they should be. I think this might be because the random effects are helping to explain some of the variance in the data, resulting in "significant" t-values on my fixed effects of interest, but they (the random effects) are not included in the calculation of the confidence intervals. Therefore, a plot of the fitted values and ?confidence intervals appears to show a non-significant association between fitted values and my fixed effect of interest (i.e., you could draw a straight line between the CIs). I apologize for not including the code in my post, but it is quite lengthy. I am also not a statistician or an expert in R, so am doing my best to explain this problem without getting in too far over my head. -----Original Message----- From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas Bates Sent: Friday, October 01, 2010 3:55 PM To: Corey Godfrey Cc: r-sig-mixed-models at r-project.org Subject: Re: [R-sig-ME] Confidence Intervals on Fitted Values from lmer On Fri, Oct 1, 2010 at 2:33 PM, Corey Godfrey <Corey.Godfrey at cadmusgroup.com> wrote:
Hello,
I would like to plot confidence intervals around the fitted values of a mixed effects model. Is this advisable? If so, is there a method for doing so?
First you need to decide what kind of confidence interval you have in mind, involving the fixed-effects parameters only or both the fixed- and random-effects. ?You may be able to get what you want from the variance-covariance matrix for the estimates of the fixed-effects parameters, available as vcov(fittedModel), but I can't guarantee it. I would need to think more carefully about the interpretation of the various types of variability.
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models