View source: R/rcspline.plot.s
rcspline.plot  R Documentation 
Provides plots of the estimated restricted cubic spline function
relating a single predictor to the response for a logistic or Cox
model. The rcspline.plot
function does not allow for
interactions as do lrm
and cph
, but it can
provide detailed output for checking spline fits. This function uses
the rcspline.eval
, lrm.fit
, and Therneau's
coxph.fit
functions and plots the estimated spline
regression and confidence limits, placing summary statistics on the
graph. If there are no adjustment variables, rcspline.plot
can
also plot two alternative estimates of the regression function when
model="logistic"
: proportions or logit proportions on grouped
data, and a nonparametric estimate. The nonparametric regression
estimate is based on smoothing the binary responses and taking the
logit transformation of the smoothed estimates, if desired. The
smoothing uses supsmu
.
rcspline.plot(x,y,model=c("logistic", "cox", "ols"), xrange, event, nk=5,
knots=NULL, show=c("xbeta","prob"), adj=NULL, xlab, ylab,
ylim, plim=c(0,1), plotcl=TRUE, showknots=TRUE, add=FALSE,
subset, lty=1, noprint=FALSE, m, smooth=FALSE, bass=1,
main="auto", statloc)
x 
a numeric predictor 
y 
a numeric response. For binary logistic regression, 
model 

xrange 
range for evaluating 
event 
event/censoring indicator if 
nk 
number of knots 
knots 
knot locations, default based on quantiles of 
show 

adj 
optional matrix of adjustment variables 
xlab 

ylab 

ylim 

plim 

plotcl 
plot confidence limits 
showknots 
show knot locations with arrows 
add 
add this plot to an already existing plot 
subset 
subset of observations to process, e.g. 
lty 
line type for plotting estimated spline function 
noprint 
suppress printing regression coefficients and standard errors 
m 
for 
smooth 
plot nonparametric estimate if 
bass 
smoothing parameter (see 
main 
main title, default is 
statloc 
location of summary statistics. Default positioning by clicking left
mouse button where upper left corner of statistics should
appear. Alternative is 
list with components (‘knots’, ‘x’, ‘xbeta’, ‘lower’, ‘upper’) which are respectively the knot locations, design matrix, linear predictor, and lower and upper confidence limits
Frank Harrell
Department of Biostatistics, Vanderbilt University
fh@fharrell.com
lrm
, cph
, rcspline.eval
,
plot
, supsmu
,
coxph.fit
,
lrm.fit
#rcspline.plot(cad.dur, tvdlm, m=150)
#rcspline.plot(log10(cad.dur+1), tvdlm, m=150)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.