[R] Plotting confidence intervals for lme
Spencer Graves
spencer.graves at pdf.com
Wed Jul 6 18:44:29 CEST 2005
Consider the following extension of an example in "?lme":
fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
int <- intervals(fm2)
class(int$fixed)
kf <- dim(int$fixed)[1]
plot(int$fixed[,2], kf:1,
xlab="x", ylab="", xlim=range(int$fixed),
axes=FALSE)
axis(1)
axis(2, kf:1, dimnames(int$fixed)[[1]])
segments(int$fixed[,1], kf:1,
int$fixed[,3], kf:1)
abline(v=0)
However, we are mixing units, i.e., the units for the intercept are
"distance", while for "age" are "distance/time", and the interpretation
of the coefficient of a factor like Sex depends on contrasts used.
Thus, I don't know how much sense it makes to prepare plots like this.
For similar plots that make more sense, see Pinheiro and Bates (2000
Mixed-Effects Models in S and S-PLUS (Springer).
spencer graves
Ghislain Vieilledent wrote:
> Hello and sorry to disturb.
>
> I'm trying to plot the confidence intervals for the fixed effects of a lme.
> I want to obtain graphically, if it is possible, a bar with Estimate, upper
> and lower CI for each level of the factors.
>
> I know how to do for a lm model but for a lme one, I tried with
> plot(intervals(...)) and plot(ci(...)) from the gmodels package but it
> doesn't work well.
>
> Thanks for you help and have a good day.
>
--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA
spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel: 408-938-4420
Fax: 408-280-7915
More information about the R-help
mailing list