| predict.CoxBoost | R Documentation |
Obtains predictions at specified boosting steps from a CoxBoost object
fitted by CoxBoost.
## S3 method for class 'CoxBoost'
predict(
object,
newdata = NULL,
newtime = NULL,
newstatus = NULL,
subset = NULL,
weights = NULL,
stratum = NULL,
at.step = NULL,
times = NULL,
type = c("lp", "logplik", "risk", "CIF"),
...
)
object |
fitted CoxBoost object from a |
newdata |
|
newtime, newstatus |
vectors with observed time and censoring indicator
(0 for censoring, 1 for no censoring, and any other values for competing
events in a competing risks setting) for new observations, where prediction
is wanted. Only required if predicted partial log-likelihood is wanted,
i.e., if |
subset |
an optional vector specifying a subset of observations to be used for evaluation. |
weights |
weights for each time. |
stratum |
vector specifying different groups of individuals for a
stratified Cox regression. In |
at.step |
scalar or vector of boosting step(s) at which prediction is
wanted. If |
times |
vector with |
type |
type of prediction to be returned: |
... |
miscellaneous arguments, none of which is used at the moment. |
For cause-specific hazard models (cmprsk = "csh" or cmprsk = "ccsh"),
cumulative incidence is computed at the observed event times using a matrix-exponential update scheme.
If dH_k is the cumulative-hazard increment for cause k and dH = \sum_k dH_k,
the CIF increment is S(t-) (1 - \exp(-dH)) dH_k / dH, with zero
increment when dH = 0. This corresponds to a piecewise-constant
cause-specific hazard within each interval. Consequently, each CIF is
non-decreasing and the CIFs satisfy 1 - \exp(-\sum_k H_k(t)).
Predictions are constant between event times.
For these models, type="risk" returns one minus the CIF for each cause.
For type="lp" and type="logplik" a vector of length
n.new (at.step being a scalar) or a n.new *
length(at.step) matrix (at.step being a vector) with predictions is
returned. For type="risk" or type="CIF" a n.new * T
matrix with predicted probabilities at the specific time points is returned.
For models with multiple causes, a named list with one result per cause is
returned.
Harald Binder binderh@uni-mainz.de
# Generate some survival data with 10 informative covariates
n <- 200; p <- 100
beta <- c(rep(1,10),rep(0,p-10))
x <- matrix(rnorm(n*p),n,p)
real.time <- -(log(runif(n)))/(10*exp(drop(x %*% beta)))
cens.time <- rexp(n,rate=1/10)
status <- ifelse(real.time <= cens.time,1,0)
obs.time <- ifelse(real.time <= cens.time,real.time,cens.time)
# define training and test set
train.index <- 1:100
test.index <- 101:200
# Fit CoxBoost to the training data
cbfit <- CoxBoost(time=obs.time[train.index],status=status[train.index],
x=x[train.index,],stepno=300,penalty=100)
# mean partial log-likelihood for test set in every boosting step
step.logplik <- predict(cbfit,newdata=x[test.index,],
newtime=obs.time[test.index],
newstatus=status[test.index],
at.step=0:300,type="logplik")
plot(step.logplik)
# names of covariates with non-zero coefficients at boosting step
# with maximal test set partial log-likelihood
print(cbfit$xnames[cbfit$coefficients[which.max(step.logplik),] != 0])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.