aft_pec: Calculate prediction error curve

Description Usage Arguments Examples

View source: R/pec-eha-aftreg.R

Description

Calculate prediction error curve

Usage

1
2
3
4
5
6
7
aft_pec(
  object,
  ipcw.form = Surv(time = start, time2 = end, event = event) ~ 1,
  newdata,
  times,
  ...
)

Arguments

object

A fitted model from which to extract predicted survival probabilities

ipcw.form

The formula used to calculate inverse probability censoring weights.

newdata

A data frame containing predictor variable combinations for which to compute predicted survival probabilities.

times

A vector of times in the range of the response variable, e.g. times when the response is a survival object, at which to return the survival probabilities.

...

Further arguments passed to predictSurvProb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(eha)
data(mort)
mort_train <- mort[1:1000,]
mort_test <- mort[-1:-1000,]
mod <- aftreg(Surv(enter, exit, event) ~ ses, param = "lifeExp",
 data = mort_train)
pec <- aft_pec(
 mod,
 ipcw.form = Surv(time = enter, time2=exit, event = event) ~ ses,
 times = seq(0, max(mort_test$exit) - 1, by = 1),
 newdata = mort_test)
plot(seq(0, max(mort_test$exit)-1, by = 1), pec, type = "l")

adibender/ldatools documentation built on March 7, 2020, 5:30 a.m.