Learn R Programming

riskRegression (version 1.3.7)

print.predictCox: Print predictions from a Cox model

Description

Print predictions from a Cox model

Usage

# S3 method for predictCox
print(x, digits = 3, ...)

Arguments

x

object obtained with the function predictCox.

digits

integer indicating the number of decimal places.

...

Passed to print.

Examples

Run this code
library(survival)
library(rms)

set.seed(10)
d <- sampleData(1e2, outcome = "survival")
m.cox <- coxph(Surv(time,event)~ X1 + X2 + X3,
               data = d, x = TRUE, y = TRUE)
predictCox(m.cox)

pred <- predictCox(m.cox, newdata = d[1:5,],
                   times = 1:5, type = "survival")
pred

pred.data <- predictCox(m.cox, newdata = d[1:4,],se=1L,
             times = 1:5, type = "survival", keep.newdata = TRUE)
pred.data

m.cox <- coxph(Surv(time,event)~ strata(X1) + strata(X2) + X3 + X6,
               data = d, x = TRUE, y = TRUE)
pred.cox <- predictCox(m.cox, newdata = d[c(1:5,10,50),],
                       time = 1:5)
pred.cox

m.cox <- cph(Surv(time,event)~ strat(X1) + strat(X2) + X3 + X6,
             data = d, x = TRUE, y = TRUE)
pred.cox <- predictCox(m.cox, newdata = d[c(1:5,10,50),],
                       time = 1:5)
pred.cox

pred.dataci <- predictCox(m.cox, newdata = d[1:5,],
                       times = 1:5, keep.newdata = TRUE, se = TRUE)
pred.dataci

Run the code above in your browser using DataLab