splinePlot.lrm: Plot predictions of logistic regression

View source: R/splinePlot.lrm.R

splinePlot.lrmR Documentation

Plot predictions of logistic regression

Description

Plotting the prediction of a logistic regression model with confidence bands against one continuous variable.

Usage

splinePlot.lrm(
  object,
  xvar,
  xvalues,
  xlim = range(xvalues),
  ylim,
  xlab = xvar,
  ylab = scale[[1]],
  col = 1,
  lty = 1,
  lwd = 3,
  confint = TRUE,
  newdata = NULL,
  scale = c("risk", "odds"),
  add = FALSE,
  ...
)

Arguments

object

Logistic regression model fitted with rms::lrm

xvar

Name of the variable to show on x-axis

xvalues

Sequence of xvar values

xlim

x-axis limits

ylim

y-axis limits

xlab

x-axis labels

ylab

y-axis labels

col

color of the line

lty

line style

lwd

line width

confint

Logical. If TRUE show confidence shadows

newdata

How to adjust

scale

Character string that determines the outcome scale (y-axis). Choose between "risk" and "odds".

add

Logical. If TRUE add lines to an existing graph

...

Further arguments passed to plot. Only if add is FALSE.

Details

Function which extracts from a logistic regression model fitted with rms::lrm the predicted risks or odds.

Author(s)

Thomas A. Gerds <tag@biostat.ku.dk>

Examples

data(Diabetes)
Diabetes$hypertension=  1*(Diabetes$bp.1s>140)
library(rms)
uu <- datadist(Diabetes)
options(datadist="uu")
fit=lrm(hypertension~rcs(age)+gender+hdl,data=Diabetes)
splinePlot.lrm(fit,xvar="age",xvalues=seq(30,50,1))

Publish documentation built on Jan. 18, 2023, 1:08 a.m.