Dear all,
I would like to obtain the Brier score prediction error at different times t
for an extended Cox model. Previously I have used the 'pec' function
(pec{pec}) to obtain prediction error curves for standard Cox PH models but
now I have data in the counting process format (I have a covariate with a
time-varying effect) and it seems that the pec function does not support the
counting process format, or am I doing something wrong?
Here's a (tiny) example of what I'm trying to do:
# Original survival data set:> dat
time status x1
1 169 1 2
2 149 1 11
3 207 1 22
4 192 1 27
5 200 1 10
# Split original data at cutpoint 190. New data will be in "counting
process" format:> dat.x = survSplit(dat, cut=190, end="time",
event="status", start="start")
# New data set:> dat.x
time status x1 start
1 169 1 2 0
2 149 1 11 0
3 190 0 22 0
4 190 0 27 0
5 190 0 10 0
8 207 1 22 190
9 192 1 27 190
10 200 1 10 190
# Load pec and fit Cox model:> library(pec)
> models = list("Cox"= coxph(Surv(start,time,status) ~ x1,
data=dat.x))
# Compute the apparent prediction error:
predError = pec(object = models, formula=Surv(start,time,status) ~ x1,
data=dat.x, exact=TRUE, cens.model="marginal",
replan="none", B=0,
verbose=TRUE)
Error in pec.list(object = models, formula = Surv(start, time, status) ~ :
Survival response must at least consist of two columns: time and
status.>
Am I doing something wrong here or is it not possible to apply the pec
function on counting process data? If I can't use pec, perhaps someone knows
of some other function I could use instead to get the Brier score at
different times t when using the counting process approach. Any guidance on
these questions is much appreciated.
Thanks,
Ulf
[[alternative HTML version deleted]]