[R] plotting output from LME with natural cubic spline
Rodday, Angie Mae
arodday at tuftsmedicalcenter.org
Tue Nov 22 19:42:59 CET 2011
I have used LME to fit a mixed effects model on my data. The data has
274 subjects with 1 to 6 observations per subject. Time is not linearly
associated with the outcome, so I used ns to fit a natural cubic spline
with 3 auto knots. Subject and the natural cubic time of spline are both
treated as random effects. This model has run without any problem, but
now I would like to plot trajectories for subjects using their fitted
random effects and incorporating the shape of the natural cubic spline.
I am able to plot a point for each subject's fitted random effect score
at the time the outcome was measured (fitLME$fitted[,2]). However, I
cannot figure out how to connect the points to reflect the natural cubic
spline.
Does anyone know how to do this using output produced in the LME model
object (e.g., fixed or random model coefficients) ?
Code:
fitLME<-lme(Y~ns(time, df=4), random=list(id = pdDiag(form = ~ ns(time,
df=4, data=data)
Angie Mae Rodday, MS
The Health Institute
Tufts Medical Center
800 Washington St, #345
Boston, MA 02111
phone: 617-636-7193
fax: 617-636-8351
email: arodday at tuftsmedicalcenter.org
The information in this e-mail is intended only for the ...{{dropped:7}}
More information about the R-help
mailing list