predict_se {shinyCox} | R Documentation |
Adapted from parts of survival::survfit.coxph()
, computes predictions for
standard errors based on surv_pred_info()
output and newdata
from the
shiny app.
predict_se(listsurv, coxfit, newdata)
listsurv |
Output from |
coxfit |
|
newdata |
Data used to make predicted standard errors |
a list of number of subjects for each curve, times at which the curve has a step, number at risk for each time, number of events at each time, number censored at each time (no event but exit risk set), estimated survival, cumulative hazard at each transition, and standard error of the cumulative hazard.
library(survival)
library(shinyCox)
colondeaths <- colon[colon$etype == 2, ]
split_colon <- split(colondeaths, colondeaths$rx)
colon_arm1 <- split_colon$Obs
colon1ph <- coxph(Surv(time, status) ~
factor(extent) + nodes + strata(surg) + factor(differ), colon_arm1, x =
TRUE, model = TRUE)
new.data = cbind.data.frame(`factor(extent)` = 3, `surg` =
"surg=0",`factor(differ)` = 2,`nodes` = 5)
coxfit = prep_coxfit(colon1ph)
coxlist = surv_pred_info(colon1ph)
predict_se(coxlist, coxfit, new.data)