[R] Regression models w/ splines

Frank E Harrell Jr feh3k at spamcop.net
Sat Apr 10 00:05:49 CEST 2004


On Fri, 09 Apr 2004 15:16:34 -0500
"John Fieberg" <John.Fieberg at dnr.state.mn.us> wrote:

> Hi - I am fitting various Cox PH models with spline predictors.  After
> fitting the model, I would like to use termplot() to examine the
> functional form of the fitted model (e.g., to obtain a plot of the
> relative risk (or log r.r.) versus the predictors). 

This kind of application is why the Design package was created.  It is
very easy to obtain such plots:

library(Design)
dd <- datadist(mydata); options(datadist='dd')
f <- cph(Surv(y,d) ~ sex*rcs(age,4)+rcs(bp,5))
plot(f, age=NA, sex='female')

---
Frank E Harrell Jr   Professor and Chair           School of Medicine
                     Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list