[R] cubic spline/smoother with nlme
v_bill_pikounis at merck.com
Wed Nov 10 23:29:28 CET 2004
In addition to Professor Daalgard's suggestions of ns() and bs(), you could
also try out rcs() from Frank Harrell Design package (you may need his Hmisc
package as well). This function helps to fit natural (restricted cubic
splines), and have been very useful for me in practice to use in tandem with
lme() in modeling longitudinal data.
Hope that helps,
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Dalgaard
> Sent: Wednesday, November 10, 2004 4:54 PM
> To: Suzette Blanchard
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] cubic spline/smoother with nlme
> Suzette Blanchard <suzette at sdac.harvard.edu> writes:
> > Greetings, I would like to use a cubic spline
> > or smoother to model the fixed effects within
> > nlme. So far the only smoother I have been able
> > to get to run successfully in nlme is smooth().
> > I tried smooth.spline:
> > fixed=list(lKa~1,lCL~smooth.spline(BSA, df=3))
> > the error I got was the following.
> > Error in model.frame(formula, rownames, variables,
> varnames, extras,
> > extranames, : invalid variable type
> > Can anyone suggest a cubic spline that would work within
> > this context?
> The fixed-knots ones (ns(), bs()) should work (and did so in at least
> one case a couple of years ago...). These are linear, so lme() is used
> rather than nlme(), unless of course you have other parts that need to
> be modeled nonlinearly.
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph:
> (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX:
> (+45) 35327907
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help