predictRisk.pcoxtime | R Documentation |
Extract event probabilities from the fitted model.
## S3 method for class 'pcoxtime' predictRisk(object, newdata, times, ...)
object |
fitted |
newdata |
a data frame containing the variables appearing on the right hand side of |
times |
a vector of times in the range of the response, at which to return the survival probabilities. |
... |
for future implementations. |
For survival outcome, the function predicts the risk, 1 - S(t|x), where S(t|x) is the survival chance of an individual characterized by x.
a matrix of probabilities with as many rows as the rows of the newdata
and as many columns as number of time points (times
).
if (packageVersion("survival")>="3.2.9") { data(cancer, package="survival") } else { data(veteran, package="survival") } # Penalized lam <- 0.1 alp <- 0.5 pfit1 <- pcoxtime(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior , data = veteran , lambda = lam , alpha = alp ) r1 <- predictRisk(pfit1, newdata = veteran[1:80,], times = 10) # Unpenalized lam <- 0 alp <- 1 pfit2 <- pcoxtime(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior , data = veteran , lambda = lam , alpha = alp ) r2 <- predictRisk(pfit2, newdata = veteran[1:80,], times = 10) plot(r1, r2, xlim=c(0,1), ylim=c(0,1) , xlab = "Penalized predicted survival chance at 10" , ylab="Unpenalized predicted survival chance at 10" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.