coxph: Adjust for cause-specific analysis

Since the data specifies death as a competing risk, the cox analysis
must be adjusted. Death will now, as it was before, treated as a censor.
This commit is contained in:
Jens Sauer 2021-01-18 01:46:49 +01:00
parent ac822f48fa
commit 63c2883c7e

View File

@ -44,7 +44,7 @@ sma_cox_res <- function(m) {
# #
sma_coxph_univ <- function() { sma_coxph_univ <- function() {
univ_formulas <- sapply(covariates, function(x) as.formula( univ_formulas <- sapply(covariates, function(x) as.formula(
paste('Surv(time_at_risk, time_at_risk_status) ~ ', paste('Surv(time_at_risk, ifelse(time_at_risk_status == 1, 1, 0)) ~ ',
x))) x)))
univ_models <- lapply(univ_formulas, univ_models <- lapply(univ_formulas,
function(x) {coxph(x, data = secmal)}) function(x) {coxph(x, data = secmal)})