# NOT RUN {
d <- sampleData(1e2, outcome = "survival")
d$entry <- 0
d$id <- 1:NROW(d)
##
library(survival)
d$X1=factor(d$X1)
mCox <- coxph(Surv(time, event) ~ X1+X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCox)
mCoxS <- coxph(Surv(time, event) ~ strata(X1)+X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxS)
mCoxS2 <- coxph(Surv(time, event) ~ strata(X1)+strata(X2), data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxS2)
mCoxI <- coxph(Surv(time, event) ~ X1*X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxI)
##
library(rms)
mCox <- cph(Surv(time, event) ~ X1+X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCox)
mCoxS <- cph(Surv(time, event) ~ strat(X1)+X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxS)
mCoxS2 <- cph(Surv(time, event) ~ strat(X1)+strat(X2), data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxS2)
mCoxI <- cph(Surv(time, event) ~ X1*X2, data = d, x = TRUE, y = TRUE)
CoxVariableName(mCoxI)
##
library(mets)
mCox <- phreg(Surv(entry, time, event) ~ X1+X2, data = d)
CoxVariableName(mCox)
mCoxS <- phreg(Surv(entry, time, event) ~ strata(X1)+cluster(id)+X2, data = d)
CoxVariableName(mCoxS)
mCoxI <- phreg(Surv(entry, time, event) ~ X1*X2, data = d)
CoxVariableName(mCoxI)
# }
Run the code above in your browser using DataLab