Learn R Programming

survcomp (version 1.22.0)

score2proba: Function to compute the survival probabilities from a risk score

Description

the function uses either a Cox model or the product-limit estimator to compute the survival probabilities from a risk score for a specific point in time.

Usage

score2proba(data.tr, score, yr, method = c("cox", "prodlim"), conf.int = 0.95, which.est= c ("point", "lower", "upper"))

Arguments

data.tr
the data frame for the training set. This data frame must contain three columns for the times, the event occurrence and the risk score. These columns are called "time", "event" and "score" respectively
score
risk score for the test set
yr
a point in time for which the survival probabilities must be computed
method
method for survival probabilities estimation, either cox or prodlim for the Cox model or the product-limit estimator, respectively
conf.int
value in [0,1]. Default at 0.95
which.est
which estimation to be returned? point for the point estimate, lower for the lower bound and upper for the upper bound

Value

vector of predicted survival probabilities

References

Cox, D. R. (1972) "Regression Models and Life Tables", Journal of the Royal Statistical Society Series B, 34, pages 187--220.

Andersen, P. K. and Borgan, O. and Gill, R. D. and Keiding, N. (1993) "Statistical Models Based on Counting Processes", Springer.

See Also

coxph, prodlim

Examples

Run this code
set.seed(12345)
age <- rnorm(30, 50, 10)
stime <- rexp(30)
cens <- runif(30,.5,2)
sevent <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
dd <- data.frame("time"=stime, "event"=sevent, "score"=age)

#Cox's model
score2proba(data.tr=dd, score=dd$score, yr=1, method="cox")
#product-limit estimator
score2proba(data.tr=dd, score=dd$score, yr=1, method="prodlim")

Run the code above in your browser using DataLab