| cox | R Documentation |
A compact R4VN wrapper around tabsurv() for a final multivariable Cox model.
cox(
time,
event,
vars,
data = NULL,
failure = NULL,
id = NULL,
start = NULL,
strata = NULL,
cluster = NULL,
frailty = NULL,
ph = FALSE,
ci = 0.95,
ties = c("efron", "breslow", "exact"),
diagnosis = FALSE,
show = TRUE,
console = FALSE
)
time |
Follow-up or stop-time variable, supplied without quotes. |
event |
Event/status variable, supplied without quotes. |
vars |
Optional predictor specification created by |
data |
Optional data frame. When omitted, active R4VN data are used. |
failure |
Value of |
id |
Optional subject identifier for counting-process/recurrent data. |
start |
Optional start/entry time. When supplied, |
strata |
Optional stratification variable for Cox regression. |
cluster |
Optional clustering variable for robust Cox variance. |
frailty |
Optional shared-frailty variable. Do not combine with |
ph |
Logical; test the proportional-hazards assumption. Default |
ci |
Confidence level, default 0.95. |
ties |
Cox tie method: "efron", "breslow", or "exact". |
diagnosis |
Logical; if |
show |
Logical; open the formatted result in the Viewer. Default |
console |
Logical; also print the traditional result in the Console. Default |
An object of class r4vn_surv.
if (requireNamespace("survival", quietly = TRUE)) {
d <- data.frame(
time = c(5, 8, 10, 12, 15, 18, 20, 22, 25, 30),
event = c(1, 0, 1, 1, 0, 1, 0, 1, 1, 0),
age = c(40, 45, 50, 55, 60, 48, 52, 63, 58, 67),
sex = factor(rep(c("Female", "Male"), 5))
)
cox(time, event, vars = vars(c.age, i.sex), data = d, show = FALSE)
cox(time, event, vars = vars(c.age, i.sex), data = d,
diagnosis = TRUE, show = FALSE)
cox(time, event, vars = vars(c.age), data = d, ph = TRUE, show = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.