[R-sig-eco] plot confidence intervals of a line from a mixed model

Dunbar, Michael J. mdu at ceh.ac.uk
Wed Sep 7 17:28:10 CEST 2011


Hi Rob

A couple of suggestions

1. You can use the glht command in the multcomp to get predictions for different factor levels with simultaneous se's / ci's, you just need to formulate the correct contrast(s)
2. You can make ad-hoc predictions by matrix-multiplying the parameter estimates (from fixef()) from the model with the model.matrix() of explanatory variables, and get the se's by additionally including the variance-covariance matrix of the fixed effects. Please contact me off-list if you'd like some example code - I have some but it was provided to me by a colleague and I'd prefer not to broadcast it indiscriminately as it isn't my invention
3. I haven't looked at them, but the packages zelig and ez may also help
4. It isn't a dumb question, it's taken me ages to get even this far (not very far)!

Cheers
Mike


-----Original Message-----
From: r-sig-ecology-bounces at r-project.org [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of Rob Knell
Sent: 06 September 2011 14:22
To: r-sig-ecology at r-project.org
Subject: [R-sig-eco] plot confidence intervals of a line from a mixed model

Hello everyone

I'm afraid this is probably a very dumb question, but I have ended up totally stumped in trying to do this. I have a mixed model fitted to some data using lme, including a fixed effect that is an interaction term between a factor (maternal treatment) with two levels and a continuous variable (weight). I'd like to plot a graph showing the two fitted lines plus their confidence intervals. How do I get the confidence intervals? I can get the standard error of the difference between the two slopes from summary(model), but that's not what I want. I can get the confidence intervals for the difference between the slopes with intervals(model) but again that is for the difference between the slopes. I tried using predict(model,...,int="c") but the int="c" call doesn't seem to work with an lme object. Any suggestions gratefully received.

Rob K
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.


More information about the R-sig-ecology mailing list