[R] augPred plot in nlme library
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Fri Sep 8 23:46:00 CEST 2006
Hi David,
this is the sort of thing that Deepayan meant. Make a dataset
available to us, or use one that will be installed by default on R.
eg
require(nlme)
fm1 <- lme(distance ~ age, data = Orthodont)
plot(augPred(fm1))
# All linear
fm2a <- lme(distance ~ age + age.2, data = Orthodont)
plot(augPred(fm2a))
# Still linear
fm2b <- lme(distance ~ age + I(age^2), data = Orthodont)
plot(augPred(fm2b))
# Quadratic!
I hope that this helps you resolve the problem.
Andrew
On Fri, Sep 08, 2006 at 05:18:13PM -0400, Afshartous, David wrote:
>
> Deepayan,
>
> Thanks for your suggestion. Here are more details:
>
> I have a grouped data object for repeated measures data just like the
> Pixel grouped data object on p.42 of Pinheiro and Bates (2000).
>
> comp.adj.UKV.3 <- groupedData(adj.UKV ~ Time | Patient_no/Lisinopril,
> data = comp.adj.UKV.frm, order.groups = F
> #labels = list(x = "Hour", y = "adj.UKV")
> )
>
> i.e., the response is continuous, Time is not treated as a factor, and
> there exists two factors, one nested within the other (Lisinopril nested
>
> witin patient, similar to Side within Dog on p.42).
>
> I also fit a model very similar to their model:
>
> fm1comp = lme(adj.UKV ~ Time + Time.sq, data = comp.adj.UKV.3, random =
> list(Patient_no = ~ 1 , Lisinopril = ~ 1) )
>
>
> However, the command below does not produce the fitted curves from this
> model,
> but rather it seems to be the fitted curves from a linear model.
>
> plot(augPred(fm3comp))
>
> Possibly augPred behaves differently in R than in S, but reading the R
> help and
> trying various other approaches has not solved this.
>
> Thanks!
> Dave
>
>
>
>
> -----Original Message-----
> From: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com]
> Sent: Friday, September 08, 2006 4:37 PM
> To: Afshartous, David
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] augPred plot in nlme library
>
> On 9/8/06, Afshartous, David <afshart at exchange.sba.miami.edu> wrote:
> > All,
> >
> > I've solved part of the problem below by making sure that the formula
> > in the grouped data object is the same as the formula specified within
>
> > lme (this isn't the case in the cited example from Pinheiro & Bates).
> >
> > However, augPred seems to plot only a linear model instead of the
> > polynomial model. Does anyone know how to make sure that augPred
> > plots the same model as that specified in the model (as below)?
>
> You are unlikely to get any helpful answers unless you give us more
> information, as every r-help message asks you to do:
>
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> -Deepayan
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: a.robinson at ms.unimelb.edu.au http://www.ms.unimelb.edu.au
More information about the R-help
mailing list