Sie sind hier: Startseite Competing Risks and … R Code Appendix

Appendix

## number of boostrap replications
nboot <- 10000

res <- lapply(seq_len(nboot), function(i) {
    index <- sample(unique(sir.cont$id), replace=TRUE)
    dboot <- sir.cont[unlist(sapply(index, function(x) 
                                    which(x==sir.cont[["id"]]
                                          ))), ]
    coef01 <- coef(coxph(Surv(time, to == 1) ~ age + sex,
                      dboot, subset = from == 0))
    coef10 <- coef(coxph(Surv(time, to == 0) ~ age + sex,
                       dboot, subset = from == 1))
    matrix(c(coef01, coef10), ncol = 4)
})
res <- do.call(rbind, res)
se.boot <- matrix(sqrt(apply(res, 2, var)), ncol = 4,
                  dimnames = list("", c("age01", "sex01", 
                  "age10", "sex10")))