set.seed(10)
d <- sampleData(2e1, outcome = "survival")
d$entry <- 0
##
library(survival)
mCox <- coxph(Surv(entry, time, event) ~ X1+X2, data = d, x = TRUE, y = TRUE)
CoxDesign(mCox)
mCox <- coxph(Surv(time, event) ~ X1*X2+strata(X3), data = d, x = TRUE, y = TRUE)
CoxDesign(mCox)
mCox <- coxph(Surv(time, event) ~ X1+X2+strata(X3)+strata(X4), data = d, x = TRUE, y = TRUE)
CoxDesign(mCox, center = TRUE)
##
library(rms)
mCox <- cph(Surv(time, event) ~ X1+X2, data = d, x = TRUE, y = TRUE)
CoxDesign(mCox)
mCox <- cph(Surv(time, event) ~ X1*X2+strat(X3), data = d, x = TRUE, y = TRUE)
CoxDesign(mCox, center = TRUE)
mCox <- cph(Surv(time, event) ~ X1*X2+strat(X3)+strat(X4), data = d, x = TRUE, y = TRUE)
CoxDesign(mCox)
##
library(mets)
d$id <- 1:NROW(d)
mCox <- phreg(Surv(entry, time, event) ~ X1*X2, data = d)
CoxDesign(mCox)
mCox <- phreg(Surv(entry, time, event) ~ X1+X2+strata(X3)+cluster(id), data = d)
CoxDesign(mCox)
# mCox <- phreg(Surv(entry, time, event) ~ X1+X2+strata(X3)+strata(X4)+cluster(id), data = d)
Run the code above in your browser using DataLab