predict.PC_cox: Predict method for partly conditional cox models.

Description Usage Arguments Value Examples

Description

Estimate predicted absolute n-year risk from a PC.Cox model object.

Usage

1
2
## S3 method for class 'PC_cox'
predict(object, newdata, prediction.time, ...)

Arguments

object

object of class 'PC_cox' fit using the 'PC.Cox' function

newdata

data.frame with new data for which to calculate predictions. All variables used to fit the PC.Cox model must be present. Observations with missing data will be removed.

prediction.time

vector of prediction times (from marker measurement time) to estimate future risk. Prediction time is defined from time of measurement for each individual trajectory.

Value

A data.frame matching that of newdata but with extra columns containing predicted risk estimates (one for each prediction.time). Risks are estimated for each 'prediction.time' from the measurement time observed on each row.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(pc_data)

pc_data$log.meas.time <- log10(pc_data$meas.time + 1)

pc.model.1 <-  PC.Cox(
 id = "sub.id",
 stime = "time",
 status = "status",
 measurement.time = "meas.time",
 predictors = c("log.meas.time", "marker_1", "marker_2"),
 data = pc_data)

pc.model.1

newdata.subj.6 <- pc_data[pc_data$sub.id ==6,]

#estimate 12 and 24 month risk for each measurement time
predict(pc.model.1,
       newdata = newdata.subj.6,
       prediction.time = c(12, 24))

mdbrown/partlyconditional documentation built on May 22, 2019, 12:38 p.m.