
Last chance! 50% off unlimited learning
Sale ends in
Predict risk/hazard function for cox ph regression
predict_coxph(
coxfit,
dataset,
param_to_be_estimated,
covariates,
indep_var,
timevar_survival
)
plot and the survival function values
cox regression fit result
param describing the methods
parameter to be estimated
covariates
independent variable
time variable
"risk" option for "type" returns the hazard ratio relative to mean e.g given below For lung data with data_for_survival <- survival::lung fit <- use_coxph_survival("status", data_for_survival, "sex", covariates = c("ph.ecog"), "time") coeffit = fit$coefficients r1234 <- exp(coeffit("sex")lung$sex+ coeffit("ph.ecog")lung$ph.ecog) rMean <- exp(sum(coef(fit) * fit$means, na.rm=TRUE)) rr <- r1234/rMean
# \donttest{
data_for_survival <- survival::lung
surv_estimated <- use_coxph_survival("status", data_for_survival,
"sex",covariates = c("ph.ecog"), "time")
predict_coxph(surv_estimated$fit,data_for_survival, "status","sex",
covariates = c("ph.ecog"), "time")
# }
Run the code above in your browser using DataLab