survprep: Prepare data for regsurv()

View source: R/survprep.R

survprepR Documentation

Prepare data for regsurv()

Description

Prepare data for regsurv()

Usage

survprep(
  tte,
  delta,
  X,
  model.scale = c("loghazard", "logHazard"),
  time.scale = c("logtime", "time"),
  spline.type = c("rcs", "ns"),
  ntimebasis,
  time.knots = NULL,
  tv = NULL,
  nitimebasis = NULL,
  itime.knots = NULL,
  qpoints = 9,
  scales = NULL,
  shifts = NULL
)

Arguments

tte

numeric vector containing time-to-event data

delta

numeric vector containing event indicator data (1=event, 0=censored)

X

design matrix containing all necessary covariate data

model.scale

choose between log hazard and log cumulative hazard

time.scale

choose between log time and linear time for the time scale of the model

spline.type

type of spline used to model time dependencies (rcs=restricted cubic splines, ns=natural splines (as implemented in the splines2 package))

ntimebasis

integer number of basis columns for the spline representation of the log baseline hazard or log cumulative baseline hazard.

time.knots

numeric vector containing baseline spline knot locations. Defaults to equally spaced knots (if NULL).

tv

numeric vector of column indices for the columns in X with time-varying (i.e. non-proportional) effects.

nitimebasis

number of basis columns for the spline representation of non-proportional covariate effects.

itime.knots

numeric vector containing spline knot locations for time-varying covariate effects. Defaults to equally spaced knots (if NULL).

qpoints

number of quadrature points for numerical integration over time (only applicable for models on the log hazard scale)

scales

only used for internal functions

shifts

only used for internal functions

Value

an object of class survprep

Examples

prep <- survprep(tte=simdata$eventtime,
                 delta=simdata$status,
                 X=as.matrix(simdata[ ,grep("x", names(simdata))]),
                 model.scale="loghazard",
                 time.scale="time",
                 spline.type="rcs",
                 ntimebasis=4,
                 qpoints=9)

jeroenhoogland/regsurv documentation built on March 20, 2023, 3:37 a.m.