Learn R Programming

riskRegression (version 1.4.3)

autoplot.predictCSC: Plot predictions from a Cause-specific Cox proportional hazard regression

Description

Plot predictions from a Cause-specific Cox proportional hazard regression

Usage

# S3 method for predictCSC
autoplot(object, ci = FALSE, band = FALSE,
  groupBy = "row", reduce.data = FALSE, plot = TRUE, digits = 2,
  alpha = NA, ...)

Arguments

object

object obtained with the function predictCox.

ci

Logical. If TRUE display the confidence intervals for the predictions.

band

Logical. If TRUE display the confidence bands for the predictions.

groupBy

The grouping factor used to color the prediction curves. Can be "row", "strata", or "covariates".

reduce.data

Logical. If TRUE only the covariates that does take indentical values for all observations are displayed.

plot

Logical. Should the graphic be plotted.

digits

integer indicating the number of decimal places

alpha

transparency of the confidence bands. Argument passed to ggplot2::geom_ribbon.

...

not used. Only for compatibility with the plot method.

Examples

Run this code
# NOT RUN {
## no strata
d <- sampleData(1e2, outcome = "competing.risks")
m.CSC <- CSC(Hist(time,event)~ X1 + X2 + X6, data = d)

pred.CSC <- predict(m.CSC, newdata = d[1:2,], time = 1:5, cause = 1)
autoplot(pred.CSC)

pred.CSC <- predict(m.CSC, newdata = d[1:3,],
                    time = 1:5, cause = 1, se = TRUE, keep.newdata = TRUE)


## strata
m.SCSC <- CSC(Hist(time,event)~ strata(X1) + strata(X2) + X6,
data = d)
pred.SCSC <- predict(m.SCSC, time = 1:3, newdata = d[1:4,],
cause = 1, se = TRUE, keep.newdata = TRUE, keep.strata = TRUE)
autoplot(pred.SCSC, groupBy = "strata")

# }

Run the code above in your browser using DataLab