perform automatic regression for a class of coxph
Usage
autoRegCox(
x,
threshold = 0.2,
uni = FALSE,
multi = TRUE,
final = FALSE,
imputed = FALSE,
keepstats = FALSE,
...
)
Arguments
- x
An object of class coxph
- threshold
numeric
- uni
logical whether or not perform univariable regression
- multi
logical whether or not perform multivariable regression
- final
logical whether or not perform stepwise backward elimination
- imputed
logical whether or not perform multiple imputation
- keepstats
logical whether or not keep statistic
- ...
Further arguments to be passed to gaze()
Value
autoRegCox returns an object of class "autoReg" which inherits from the class "data.frame" with at least the following attributes:
- attr(*,"yvars)
character. name of dependent variable
- attr(*,"model")
name of model. One of "lm","glm" or "coxph"
Examples
require(survival)
require(dplyr)
data(cancer)
fit=coxph(Surv(time,status==2)~log(bili)+age+cluster(edema),data=pbc)
autoReg(fit)
#> ——————————————————————————————————————————————————————————————————————————————————————
#> Dependent: Surv(time, status == 2) all HR (multivariable)
#> ——————————————————————————————————————————————————————————————————————————————————————
#> log(bili) Mean ± SD 0.6 ± 1.0 2.76 (2.59-2.94, p<.001)
#> age Mean ± SD 50.7 ± 10.4 1.04 (1.03-1.06, p<.001)
#> ——————————————————————————————————————————————————————————————————————————————————————
#> n=418, events=161, Likelihood ratio test=186.62 on 2 df(p<.001) cluster=edema
fit=coxph(Surv(time,status)~rx+age+sex+nodes+obstruct+perfor,data=colon)
autoReg(fit)
#> —————————————————————————————————————————————————————————————————————————————————
#> Dependent: Surv(time, status) all HR (multivariable)
#> —————————————————————————————————————————————————————————————————————————————————
#> rx Obs 624 (34.2%)
#> Lev 608 (33.4%) 0.94 (0.81-1.09, p=.409)
#> Lev+5FU 590 (32.4%) 0.63 (0.54-0.75, p<.001)
#> age Mean ± SD 59.8 ± 11.9 1.00 (1.00-1.01, p=.571)
#> sex Mean ± SD 0.5 ± 0.5 0.92 (0.81-1.05, p=.242)
#> nodes Mean ± SD 3.7 ± 3.6 1.09 (1.08-1.10, p<.001)
#> obstruct Mean ± SD 0.2 ± 0.4 1.26 (1.07-1.48, p=.006)
#> perfor Mean ± SD 0.0 ± 0.2 1.26 (0.88-1.79, p=.210)
#> —————————————————————————————————————————————————————————————————————————————————
#> n=1822, events=897, Likelihood ratio test=178.71 on 7 df(p<.001)
autoReg(fit,uni=TRUE,threshold=1)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Dependent: Surv(time, status) all HR (univariable) HR (multivariable)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————
#> rx Obs 624 (34.2%)
#> Lev 608 (33.4%) 0.98 (0.84-1.14, p=.786) 0.94 (0.81-1.09, p=.409)
#> Lev+5FU 590 (32.4%) 0.64 (0.55-0.76, p<.001) 0.63 (0.54-0.75, p<.001)
#> age Mean ± SD 59.8 ± 11.9 1.00 (0.99-1.00, p=.382) 1.00 (1.00-1.01, p=.571)
#> sex Mean ± SD 0.5 ± 0.5 0.97 (0.85-1.10, p=.610) 0.92 (0.81-1.05, p=.242)
#> nodes Mean ± SD 3.7 ± 3.6 1.09 (1.08-1.10, p<.001) 1.09 (1.08-1.10, p<.001)
#> obstruct Mean ± SD 0.2 ± 0.4 1.27 (1.09-1.49, p=.003) 1.26 (1.07-1.48, p=.006)
#> perfor Mean ± SD 0.0 ± 0.2 1.30 (0.92-1.85, p=.142) 1.26 (0.88-1.79, p=.210)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————
#> n=1822, events=897, Likelihood ratio test=178.71 on 7 df(p<.001)
autoReg(fit,uni=TRUE,final=TRUE) %>% myft()
Dependent: Surv(time, status)
all
HR (univariable)
HR (multivariable)
HR (final)
rx
Obs
624 (34.2%)
Lev
608 (33.4%)
0.98 (0.84-1.14, p=.786)
0.94 (0.80-1.09, p=.388)
0.94 (0.80-1.09, p=.408)
Lev+5FU
590 (32.4%)
0.64 (0.55-0.76, p<.001)
0.64 (0.54-0.75, p<.001)
0.64 (0.54-0.75, p<.001)
age
Mean ± SD
59.8 ± 11.9
1.00 (0.99-1.00, p=.382)
sex
Mean ± SD
0.5 ± 0.5
0.97 (0.85-1.10, p=.610)
nodes
Mean ± SD
3.7 ± 3.6
1.09 (1.08-1.10, p<.001)
1.09 (1.08-1.10, p<.001)
1.09 (1.08-1.10, p<.001)
obstruct
Mean ± SD
0.2 ± 0.4
1.27 (1.09-1.49, p=.003)
1.26 (1.07-1.48, p=.005)
1.27 (1.08-1.49, p=.003)
perfor
Mean ± SD
0.0 ± 0.2
1.30 (0.92-1.85, p=.142)
1.24 (0.87-1.77, p=.237)
n=1822, events=897, Likelihood ratio test=177 on 5 df(p<.001)
data(colon_s,package="finalfit")
fit=coxph(Surv(time,status)~age.factor+sex.factor+obstruct.factor+perfor.factor,data=colon_s)
autoReg(fit,uni=TRUE,threshold=1)
#> —————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Dependent: Surv(time, status) all HR (univariable) HR (multivariable)
#> —————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Age <40 years 69 (7.6%)
#> 40-59 years 337 (37.1%) 0.76 (0.53-1.09, p=.132) 0.79 (0.55-1.13, p=.196)
#> 60+ years 502 (55.3%) 0.93 (0.66-1.31, p=.668) 0.98 (0.69-1.40, p=.926)
#> Sex Female 437 (48.1%)
#> Male 471 (51.9%) 1.01 (0.84-1.22, p=.888) 1.02 (0.85-1.23, p=.812)
#> Obstruction No 732 (80.6%)
#> Yes 176 (19.4%) 1.29 (1.03-1.62, p=.028) 1.30 (1.03-1.64, p=.026)
#> Perforation No 881 (97.0%)
#> Yes 27 (3.0%) 1.17 (0.70-1.95, p=.556) 1.08 (0.64-1.81, p=.785)
#> —————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> n=908, events=441, Likelihood ratio test=9.86 on 5 df(p=.079)
autoReg(fit,uni=TRUE,imputed=TRUE)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Dependent: Surv(time, status) all HR (univariable) HR (multivariable) HR (imputed)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Age <40 years 69 (7.6%)
#> 40-59 years 337 (37.1%) 0.76 (0.53-1.09, p=.132) 0.79 (0.55-1.14, p=.203) 0.77 (0.54-1.11, p=.163)
#> 60+ years 502 (55.3%) 0.93 (0.66-1.31, p=.668) 0.99 (0.70-1.40, p=.943) 0.96 (0.68-1.36, p=.818)
#> Sex Female 437 (48.1%)
#> Male 471 (51.9%) 1.01 (0.84-1.22, p=.888)
#> Obstruction No 732 (80.6%)
#> Yes 176 (19.4%) 1.29 (1.03-1.62, p=.028) 1.31 (1.04-1.64, p=.022) 1.31 (1.04-1.64, p=.021)
#> Perforation No 881 (97.0%)
#> Yes 27 (3.0%) 1.17 (0.70-1.95, p=.556)
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> n=908, events=441, Likelihood ratio test=9.73 on 3 df(p=.021)