aft_pec_wrapper: Wrapper functions that calculates CV prediction error

Description Usage Arguments Examples

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

Description

Wrapper functions that calculates CV prediction error

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
aft_pec_wrapper(
  data,
  num_vars,
  cat_vars,
  ipcw.form,
  times,
  lhs = "Surv(time = start, time2 = end, event = event)~",
  seed = NULL,
  k = 10,
  fname = NULL,
  reference = TRUE,
  ...
)

Arguments

data

The data set used for cross-validated brier-score calculation.

num_vars

A character vector of covariates on numeric scale.

cat_vars

A character vector of categorical covariates

ipcw.form

The specification of the model that calculates the inverse probability censoring weights (ipcw). Will be passed to ipcw.

times

For what="IPCW.times" a vector of times at which to compute the probabilities of not being censored.

lhs

The left-hand side of the formula to be produced.

seed

If specified this seed will be used (to replicate CV folds for example).

k

Number of folds (an integer).

fname

A string of the special function in which x will be wrapped in. Defaults to "rcs"

reference

Logical. If TRUE (default) a baseline model ( ~ 1) is added for comparison.

...

Further arguments passed to aft_pec.

Examples

1
2
3
4
5
6
7
8
9
library(eha)
pec <- aft_pec_wrapper(
 data = mort,
 num_vars = "ses",
 ipcw.form = "Surv(time = enter, time2 = exit, event = event)~ses",
 times = seq(0, 17, by = 1),
 k = 5,
 lhs = "Surv(time = enter, time2 = exit, event = event)~",
 fname = "")

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