predictCoxPL: Computation of survival probabilities from Cox regression...

Description Usage Arguments Examples

View source: R/predictCoxPL.R

Description

Same as predictCox except that the survival is estimated using the product limit estimator.

Usage

1
2
predictCoxPL(object, newdata, times, type = c("cumhazard", "survival"),
  se = FALSE, band = FALSE, ...)

Arguments

object

The fitted Cox regression model object either obtained with coxph (survival package) or cph (rms package).

newdata

A data.frame or data.table containing the values of the predictor variables defining subject specific predictions. Should have the same structure as the data set used to fit the object.

times

Time points at which to evaluate the predictions.

type

the type of predicted value. Choices are "hazard", "cumhazard", and "survival". See predictCox for more details.

se

Logical. If TRUE add the standard error to the output.

band

Logical. If TRUE add the confidence band to the output.

...

additional arguments to be passed to predictCox.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(survival)

set.seed(10)
d <- sampleData(40,outcome="survival")
nd <- sampleData(4,outcome="survival")
d$time <- round(d$time,1)
fit <- coxph(Surv(time,event)~X1 + strata(X2) + X6,
             data=d, ties="breslow", x = TRUE, y = TRUE)
predictCoxPL(fit, newdata = d, times = 1:5)
fit <- coxph(Surv(time,event)~X1 + X2 + X6,
             data=d, ties="breslow", x = TRUE, y = TRUE)
predictCoxPL(fit, newdata = d, times = 1:5)


#### Compare exp to product limit
set.seed(10)
A <- predictCoxPL(fit, newdata = d[1:5], times = 1:5, se = TRUE, band = TRUE, log.transform = FALSE)
set.seed(10)
B <- predictCox(fit, newdata = d[1:5], times = 1:5, se = TRUE, band = TRUE, log.transform = FALSE)

A$survival - B$survival
A$survival.lower - B$survival.lower
A$survival.upper - B$survival.upper
A$survival.lowerBand - B$survival.lowerBand
A$survival.upperBand - B$survival.upperBand

riskRegression documentation built on April 19, 2018, 5:04 p.m.