finalfit
model wrapperR/coxphmulti.R
coxphmulti.Rd
Using finalfit
conventions, produces multivariable Cox
Proportional Hazard regression models for a set of explanatory variables
against a survival object.
coxphmulti(.data, dependent, explanatory, ...)
Data frame.
Character vector of length 1: name of survival object in
form Surv(time, status)
.
Character vector of any length: name(s) of explanatory variables.
Other arguments to pass to coxph
.
A multivariable coxph
fitted model
output. Output is of class coxph
.
# Cox Proportional Hazards multivariable analysis.
library(finalfit)
library(dplyr)
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "Surv(time, status)"
colon_s %>%
coxphmulti(dependent, explanatory) %>%
fit2df()
#> explanatory HR
#> 1 age.factor40-59 years 0.79 (0.55-1.13, p=0.196)
#> 2 age.factor60+ years 0.98 (0.69-1.40, p=0.926)
#> 3 sex.factorMale 1.02 (0.85-1.23, p=0.812)
#> 4 obstruct.factorYes 1.30 (1.03-1.64, p=0.026)
#> 5 perfor.factorYes 1.08 (0.64-1.81, p=0.785)