predictSurvProb.pcoxtime | R Documentation |
The function extracts the survival probability predictions from a pcoxtime
model.
## S3 method for class 'pcoxtime'
predictSurvProb(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. |
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
)
p1 <- predictSurvProb(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
)
p2 <- predictSurvProb(pfit2, newdata = veteran[1:80,], times = 10)
plot(p1, p2, 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.