predictSurvProb {pec} | R Documentation |
Function to extract survival probability predictions from various modeling approaches. The most prominent one is the Cox regression model which can be fitted for example with `coxph' and with `cph'.
The function predictSurvProb is a generic function that means it invokes specifically designed functions depending on the 'class' of the first argument.
predictSurvProb(object, newdata, times, ...) ## S3 method for class 'aalen': predictSurvProb(object, newdata, times,...) ## S3 method for class 'cox.aalen': predictSurvProb(object, newdata, times,...) ## S3 method for class 'coxph': predictSurvProb(object, newdata, times,...) ## S3 method for class 'cph': predictSurvProb(object, newdata, times,...) ## Default S3 method: predictSurvProb(object, newdata, times,...) ## S3 method for class 'glm': predictSurvProb(object, newdata, times,...) ## S3 method for class 'matrix': predictSurvProb(object, newdata, times,...) ## S3 method for class 'mfp': predictSurvProb(object, newdata, times,...) ## S3 method for class 'prodlim': predictSurvProb(object, newdata, times,...) ## S3 method for class 'psm': predictSurvProb(object, newdata, times,...) ## S3 method for class 'survfit': predictSurvProb(object, newdata, times,...) ## S3 method for class 'phnnet': predictSurvProb(object, newdata, times,train.data,...) ## S3 method for class 'survnnet': predictSurvProb(object, newdata, times,train.data,...) ## S3 method for class 'rpart': predictSurvProb(object, newdata, times,train.data,...)
object |
A model for which predicted probabilities are desired. |
newdata |
A data frame containing predictor variable combinations for which predictions are desired |
times |
A vector of times in the range of the response variable, e.g. times when the response is a survival object, at which the exceedance probabilities (i.e. the survival probabilities) are returned. |
train.data |
An optional data frame which contains the response and predictor variable combinations in which the prediction model was trained |
... |
Additional arguments that are passed on to the current method. |
The function pec
requires survival probabilities for each row in newdata
at requested times. These probabilities are extracted from
a fitted model of class CLASS
with the function
predictSurvProb.CLASS
.
Currently there are predictSurvProb
methods for objects of class cph (library
Design), coxph (library survival), aalen (library timereg),
cox.aalen (library timereg), mfp (library mfp), phnnet (library
survnnet), survnnet (library survnnet), rpart (library rpart),
product.limit (library prodlim), survfit (library survival), psm
(library Design), glm (library stats).
A matrix with as many rows as NROW(newdata)
and as many columns
as length(times)
. Each entry should be a probability and in
rows the values should be decreasing.
In order to assess the predictive performance of a new survival model a
specific predictSurvProb
S3 method has to be written. For
examples, see the bodies of the
existing methods.
The performance of the assessment procedure,
in particular for resampling
where the model is repeatedly evaluated, will be improved by
supressing in the call to the model all the computations that are not
needed for probability prediction. For example, se.fit=FALSE
can be set in the call to cph
.
Thomas A. Gerds tag@biostat.ku.dk