Learn R Programming

riskRegression (version 1.4.3)

plotCalibration: Plot Calibration curve

Description

Plot Calibration curve

Usage

plotCalibration(x, models, times, showPseudo, pseudo.col = NULL,
  pseudo.pch = NULL, method = "nne", round = TRUE, bandwidth = NULL,
  q = 10, bars = FALSE, hanging = FALSE, names = "quantiles",
  showFrequencies = FALSE, jack.density = 55, plot = TRUE, add = FALSE,
  diag = !add, legend = !add, axes = !add, xlim = c(0, 1), ylim = c(0,
  1), xlab = ifelse(bars, "Risk groups", "Predicted risk"),
  ylab = "Observed frequency", col, lwd, lty, pch, type, cause = 1,
  percent = TRUE, na.action = na.fail, cex = 1, ...)

Arguments

x

Object obtained with function Score

models

Choice of models to plot

times

Time point specifying the prediction horizon.

showPseudo

If TRUE the pseudo-values are shown as dots on the plot (only when pseudo=TRUE).

pseudo.col

Colour for pseudo-values.

pseudo.pch

Dot type (see par) for pseudo-values.

method

The method for estimating the calibration curve(s):

"nne": The expected event status is obtained in the nearest neighborhood around the predicted event probabilities.

"quantile": The expected event status is obtained in groups defined by quantiles of the predicted event probabilities.

round

If TRUE predicted probabilities are rounded to two digits before smoothing. This may have a considerable effect on computing efficiency in large data sets.

bandwidth

The bandwidth for method="nne"

q

The number of quantiles for method="quantile" and bars=TRUE.

bars

If TRUE, use barplots to show calibration.

hanging

Barplots only. If TRUE, hang bars corresponding to observed frequencies at the value of the corresponding prediction.

names

Barplots only. Names argument passed to names.arg of barplot.

showFrequencies

Barplots only. If TRUE, show frequencies above the bars.

jack.density

Gray scale for pseudo-observations.

plot

If FALSE, do not plot the results, just return a plottable object.

add

If TRUE the line(s) are added to an existing plot.

diag

If FALSE no diagonal line is drawn.

legend

Logical. If TRUE draw legend.

axes

If FALSE no axes are drawn.

xlim

Limits of x-axis.

ylim

Limits of y-axis.

xlab

Label for y-axis.

ylab

Label for x-axis.

col

Vector with colors, one for each element of object. Passed to lines.

lwd

Vector with line widths, one for each element of object. Passed to lines.

lty

lwd Vector with line style, one for each element of object. Passed to lines.

pch

Passed to lines.

type

Passed to lines.

cause

For competing risks models, the cause of failure or event of interest

percent

If TRUE axes labels are multiplied by 100 and thus interpretable on a percent scale.

na.action

what to do with NA values. Passed to model.frame

cex

Default cex used for legend and labels.

...

Used to control the subroutines: plot, axis, lines, barplot, legend. See SmartControl.

Examples

Run this code
# NOT RUN {
db=sampleData(100,outcome="binary")
fb1=glm(Y~X1+X5+X7,data=db,family="binomial")
fb2=glm(Y~X1+X3+X6+X7,data=db,family="binomial")
xb=Score(list(model1=fb1,model2=fb2),Y~1,data=db,
          plots="cal",metrics=NULL)
plotCalibration(xb)

data(Melanoma)
f1 <- CSC(Hist(time,status)~age+sex+epicel+ulcer,data=Melanoma)
f2 <- CSC(Hist(time,status)~age+sex+logthick+epicel+ulcer,data=Melanoma)
x <- Score(list(model1=f1,model2=f2),Hist(time,status)~1,data=Melanoma,
           cause= 2,times=5*365.25,plots="cal")
plotCalibration(x)
# }

Run the code above in your browser using DataLab