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

Description Usage Arguments Value Note Examples

Description

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

Usage

1
2
## S3 method for class 'PC_GLM'
predict(object, newdata, ...)

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 consisting of one row for each individual (grouped by id), with predicted risk estimates at the final observed measurement time for each individuals' marker trajectory. Risks are estimated for each 'prediction.time' from the last measurement time observed for each individual. Marker measurements, BLUP point estimates and spline bases for measurement times (if applicable) are provided on each observation as well.

Note

Marker measurements repeated over time are only needed, otherwise, just providing the most recent marker measurements is adquate.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
data(pc_data)

pc.model.1 <-  PC.Cox(
 id = "sub.id",
 stime = "time",
 status = "status",
 measurement.time = "log.meas.time",
 markers = c("marker", "marker_2"),
 data = pc_data,
 use.BLUP = c(FALSE, FALSE),
 knots.measurement.time = NA)

pc.model.1

newdata.subj.6 <- pc_data[pc_data$sub.id ==6,]
#last marker measured at time '54', so predictions
#will be conditional on surviving to time '54'
newdata.subj.6

#estimate 12 and 24 month risk from month 54
#this pc model doesn't include BLUPs, so only the final marker
#measurements are considered.
predict(pc.model.1, newdata = newdata.subj.6, prediction.time = c(12, 24))


#fit a model using natural cubic splines to model measurement time
# and BLUPs to smooth marker measurements.
pc.model.2 <-  PC.Cox(
 id = "sub.id",
 stime = "time",
 status = "status",
 measurement.time = "meas.time",
 markers = c("marker", "marker_2"),
 data = pc_data,
 use.BLUP = c(TRUE, TRUE),
 knots.measurement.time = 3)

#BLUPs are used in this pc model so marker trajectory is needed for
#BLUP estimation and risk prediction calculation
predict(pc.model.2, newdata = newdata.subj.6, prediction.time = c(12, 24))

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