#Initial Variable Selection
variables<-c("race_cat_fct","sex_d_fct","drnkhvy_d_fct","bmi_cat_fct","smk_cat_fct","drcost_d_fct","hcplan_cat_fct","chckup_cat_fct","chron_num","chron_d_fct","cvd_d_num","strk_d_num","asth_d_num","arth_d_num","copd_d_num","cncr_d_num","mentqol14_d_fct","physqol14_d_fct","empl_cat_fct","income_4cats_fct","educ_cat_fct")
#Build Dataset
df<-brfssR::brfss_core %>%
filter(year==2019 & state %in% c("NY")) %>%
dplyr::select({{variables}}) %>%
drop_na()
#Backward elimination for primary outcome mentqol14_d_fct with all variables
formula<-as.formula(mentqol14_d_fct~race_cat_fct+sex_d_fct+drnkhvy_d_fct+bmi_cat_fct+smk_cat_fct+drcost_d_fct+hcplan_cat_fct+chckup_cat_fct+chron_num+chron_d_fct+cvd_d_num+strk_d_num+asth_d_num+arth_d_num+copd_d_num+cncr_d_num+physqol14_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct )
scope<-list(upper=~race_cat_fct+sex_d_fct+drnkhvy_d_fct+bmi_cat_fct+smk_cat_fct+
drcost_d_fct+hcplan_cat_fct+chckup_cat_fct+chron_num+chron_d_fct+
cvd_d_num+strk_d_num+asth_d_num+arth_d_num+copd_d_num+
cncr_d_num+physqol14_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
#Initial Model
fit<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
#Stepwise Model
fitstep<-stats::step(fit,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep)
## Variable Units OddsRatio CI.95 p-value
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.42 [0.27;0.65] 0.0001113
## Black or African American only 0.66 [0.48;0.92] 0.0135966
## Multiracial 0.97 [0.66;1.42] 0.8872269
## Native Hawaiian or other Pacific Islander only 0.53 [0.27;1.03] 0.0625219
## Other race only 0.67 [0.47;0.96] 0.0295597
## White only 0.67 [0.50;0.90] 0.0081911
## sex_d_fct Female Ref
## Male 0.78 [0.71;0.85] < 1e-04
## drnkhvy_d_fct No Ref
## Yes 1.59 [1.38;1.84] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 1.23 [1.11;1.37] 0.0001302
## Overweight 0.89 [0.80;0.99] 0.0386197
## Underweight 1.28 [0.97;1.70] 0.0852768
## smk_cat_fct Current smoker Ref
## DK/Refused 1.01 [0.65;1.58] 0.9632614
## Former smoker 0.60 [0.53;0.68] < 1e-04
## Never smoker 0.54 [0.48;0.60] < 1e-04
## drcost_d_fct No Ref
## Yes 2.44 [2.17;2.74] < 1e-04
## chron_num 1.13 [1.06;1.19] < 1e-04
## cvd_d_num 0.82 [0.68;1.00] 0.0464078
## asth_d_num 1.28 [1.13;1.45] 0.0001002
## cncr_d_num 0.83 [0.71;0.97] 0.0168782
## physqol14_d_fct No Ref
## Yes 3.84 [3.45;4.27] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.95 [0.76;1.19] 0.6544956
## Out of work 1.58 [1.34;1.87] < 1e-04
## Retired 0.58 [0.51;0.66] < 1e-04
## Self-Employed 0.78 [0.66;0.93] 0.0052300
## Student 1.91 [1.53;2.39] < 1e-04
## Unable 1.66 [1.43;1.92] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.91 [0.79;1.04] 0.1569092
## $35,000-74,999 0.80 [0.70;0.92] 0.0012902
## $75,000+ 0.60 [0.51;0.69] < 1e-04
## Missing 0.81 [0.70;0.94] 0.0049969
## educ_cat_fct <High School Ref
## College or More 1.08 [0.91;1.29] 0.3642162
## High School 1.02 [0.87;1.20] 0.7847826
## Some College 1.10 [0.93;1.30] 0.2778309
#Build table for Network
tidy1<-fitstep %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="mentqol14_d_fct")
#Select Variables with significance from initial model
all_vars<-c('race_cat_fct' , 'sex_d_fct' ,
'drnkhvy_d_fct' , 'bmi_cat_fct' , 'smk_cat_fct' , 'drcost_d_fct' ,
'chron_num' , 'cvd_d_num' , 'asth_d_num' , 'cncr_d_num' , 'physqol14_d_fct' ,
'empl_cat_fct' , 'income_4cats_fct' , 'educ_cat_fct')
#Independent models that won't change based on other values conceptually
ind_vars<-c('race_cat_fct' , 'sex_d_fct')
#Dependent variables
dep_vars<-c('drnkhvy_d_fct' , 'bmi_cat_fct' , 'smk_cat_fct' , 'drcost_d_fct' ,
'chron_num' , 'cvd_d_num' , 'asth_d_num' , 'cncr_d_num' , 'physqol14_d_fct' ,
'empl_cat_fct' , 'income_4cats_fct' , 'educ_cat_fct')
#Work through each dependent variable from initial model
formula<-as.formula(drnkhvy_d_fct~mentqol14_d_fct + race_cat_fct + sex_d_fct +
bmi_cat_fct + smk_cat_fct + drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~mentqol14_d_fct + race_cat_fct + sex_d_fct +
bmi_cat_fct + smk_cat_fct + drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit2<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep2<-stats::step(fit2,scope=scope,trace=F,k=2,direction="backward")
#Model Results
publish(fitstep2)
## Variable Units OddsRatio CI.95 p-value
## mentqol14_d_fct No Ref
## Yes 1.55 [1.35;1.79] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.42 [0.24;0.75] 0.0031816
## Black or African American only 0.63 [0.40;0.99] 0.0451775
## Multiracial 0.89 [0.53;1.49] 0.6566315
## Native Hawaiian or other Pacific Islander only 0.98 [0.44;2.18] 0.9626855
## Other race only 0.58 [0.35;0.96] 0.0351554
## White only 0.89 [0.59;1.34] 0.5788827
## sex_d_fct Female Ref
## Male 0.93 [0.85;1.03] 0.1762949
## bmi_cat_fct Normal Weight Ref
## Obese 0.77 [0.68;0.87] < 1e-04
## Overweight 0.89 [0.79;0.99] 0.0377494
## Underweight 1.25 [0.91;1.73] 0.1689959
## smk_cat_fct Current smoker Ref
## DK/Refused 0.42 [0.22;0.77] 0.0055931
## Former smoker 0.59 [0.52;0.67] < 1e-04
## Never smoker 0.29 [0.26;0.33] < 1e-04
## drcost_d_fct No Ref
## Yes 1.20 [1.02;1.41] 0.0312572
## chron_num 0.82 [0.77;0.87] < 1e-04
## asth_d_num 1.26 [1.08;1.47] 0.0039678
## empl_cat_fct Employed for wages Ref
## Homemaker 0.59 [0.43;0.81] 0.0010027
## Out of work 1.04 [0.83;1.29] 0.7392794
## Retired 0.79 [0.69;0.90] 0.0004335
## Self-Employed 1.07 [0.91;1.25] 0.4179801
## Student 0.82 [0.59;1.14] 0.2424993
## Unable 0.50 [0.38;0.64] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 1.05 [0.86;1.27] 0.6484454
## $35,000-74,999 1.27 [1.06;1.53] 0.0103914
## $75,000+ 1.59 [1.32;1.92] < 1e-04
## Missing 0.98 [0.79;1.20] 0.8165572
## educ_cat_fct <High School Ref
## College or More 1.34 [1.04;1.72] 0.0217716
## High School 1.29 [1.01;1.66] 0.0394466
## Some College 1.30 [1.01;1.67] 0.0397450
tidy2<-fitstep2 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="drnkhvy_d_fct")
formula<-as.formula(bmi_cat_fct~drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
smk_cat_fct + drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
smk_cat_fct + drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit3<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep3<-stats::step(fit3,scope=scope,trace=F,k=2,direction="backward")
#Model Results
publish(fitstep3)
## Variable Units OddsRatio CI.95 p-value
## drnkhvy_d_fct No Ref
## Yes 0.85 [0.77;0.94] 0.002219
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.39 [0.29;0.52] < 1e-04
## Black or African American only 0.90 [0.68;1.18] 0.439580
## Multiracial 0.69 [0.50;0.95] 0.024712
## Native Hawaiian or other Pacific Islander only 0.67 [0.42;1.07] 0.094551
## Other race only 0.76 [0.56;1.02] 0.067171
## White only 0.74 [0.57;0.96] 0.021886
## sex_d_fct Female Ref
## Male 1.69 [1.60;1.78] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 1.37 [0.99;1.89] 0.054356
## Former smoker 1.52 [1.40;1.66] < 1e-04
## Never smoker 1.40 [1.29;1.51] < 1e-04
## chron_num 1.60 [1.53;1.67] < 1e-04
## cvd_d_num 0.70 [0.61;0.81] < 1e-04
## asth_d_num 0.75 [0.69;0.83] < 1e-04
## cncr_d_num 0.58 [0.52;0.64] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.79 [0.69;0.91] 0.001168
## Out of work 0.86 [0.76;0.98] 0.026846
## Retired 0.82 [0.76;0.88] < 1e-04
## Self-Employed 0.79 [0.72;0.87] < 1e-04
## Student 0.49 [0.42;0.57] < 1e-04
## Unable 1.02 [0.90;1.16] 0.752644
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.96 [0.86;1.06] 0.397805
## $35,000-74,999 1.16 [1.05;1.28] 0.004586
## $75,000+ 1.03 [0.93;1.14] 0.632190
## Missing 0.80 [0.72;0.89] < 1e-04
## educ_cat_fct <High School Ref
## College or More 0.76 [0.67;0.87] < 1e-04
## High School 1.05 [0.93;1.19] 0.404336
## Some College 0.98 [0.86;1.11] 0.712280
tidy3<-fitstep3 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="bmi_cat_fct")
formula<-as.formula(smk_cat_fct ~bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit4<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep4<-stats::step(fit4,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep4)
## Variable Units OddsRatio CI.95 p-value
## bmi_cat_fct Normal Weight Ref
## Obese 1.63 [1.49;1.79] < 1e-04
## Overweight 1.33 [1.22;1.45] < 1e-04
## Underweight 0.74 [0.59;0.94] 0.0138405
## drnkhvy_d_fct No Ref
## Yes 0.40 [0.35;0.44] < 1e-04
## mentqol14_d_fct No Ref
## Yes 0.57 [0.51;0.63] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 1.95 [1.33;2.87] 0.0006155
## Black or African American only 1.49 [1.11;2.00] 0.0073110
## Multiracial 1.01 [0.71;1.42] 0.9742656
## Native Hawaiian or other Pacific Islander only 1.33 [0.78;2.28] 0.3003858
## Other race only 1.60 [1.16;2.21] 0.0039138
## White only 1.18 [0.91;1.54] 0.2184717
## sex_d_fct Female Ref
## Male 0.84 [0.78;0.90] < 1e-04
## drcost_d_fct No Ref
## Yes 0.78 [0.70;0.87] < 1e-04
## chron_num 0.80 [0.76;0.85] < 1e-04
## cvd_d_num 1.62 [1.36;1.93] < 1e-04
## asth_d_num 1.11 [0.99;1.25] 0.0694389
## cncr_d_num 1.36 [1.18;1.56] < 1e-04
## physqol14_d_fct No Ref
## Yes 0.90 [0.80;1.00] 0.0525901
## empl_cat_fct Employed for wages Ref
## Homemaker 1.58 [1.29;1.93] < 1e-04
## Out of work 0.74 [0.64;0.86] < 1e-04
## Retired 2.38 [2.14;2.65] < 1e-04
## Self-Employed 1.30 [1.14;1.49] < 1e-04
## Student 3.47 [2.58;4.67] < 1e-04
## Unable 0.72 [0.63;0.83] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 1.10 [0.98;1.23] 0.1132488
## $35,000-74,999 1.39 [1.23;1.56] < 1e-04
## $75,000+ 2.42 [2.12;2.76] < 1e-04
## Missing 1.66 [1.46;1.89] < 1e-04
## educ_cat_fct <High School Ref
## College or More 3.06 [2.65;3.54] < 1e-04
## High School 1.15 [1.01;1.31] 0.0336833
## Some College 1.45 [1.27;1.66] < 1e-04
tidy4<-fitstep4 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="smk_cat_fct")
formula<-as.formula(drcost_d_fct ~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct +
sex_d_fct + chron_num + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit5<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep5<-stats::step(fit5,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep5)
## Variable Units OddsRatio CI.95 p-value
## smk_cat_fct Current smoker Ref
## DK/Refused 0.75 [0.43;1.30] 0.306924
## Former smoker 0.81 [0.71;0.93] 0.002076
## Never smoker 0.75 [0.66;0.84] < 1e-04
## drnkhvy_d_fct No Ref
## Yes 1.20 [1.02;1.41] 0.031611
## mentqol14_d_fct No Ref
## Yes 2.42 [2.16;2.72] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 1.23 [0.83;1.82] 0.291927
## Black or African American only 0.85 [0.61;1.20] 0.356654
## Multiracial 1.01 [0.67;1.50] 0.979092
## Native Hawaiian or other Pacific Islander only 1.56 [0.90;2.72] 0.115061
## Other race only 1.45 [1.02;2.07] 0.039413
## White only 0.66 [0.48;0.90] 0.009371
## sex_d_fct Female Ref
## Male 0.96 [0.87;1.05] 0.373262
## chron_num 1.09 [1.03;1.16] 0.002479
## asth_d_num 1.15 [1.01;1.32] 0.037952
## cncr_d_num 0.80 [0.67;0.96] 0.017409
## physqol14_d_fct No Ref
## Yes 1.55 [1.35;1.77] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.69 [0.54;0.89] 0.003853
## Out of work 1.23 [1.04;1.46] 0.016974
## Retired 0.31 [0.27;0.36] < 1e-04
## Self-Employed 1.06 [0.91;1.23] 0.483047
## Student 0.64 [0.48;0.84] 0.001576
## Unable 0.65 [0.55;0.78] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.98 [0.85;1.13] 0.802366
## $35,000-74,999 0.74 [0.64;0.85] < 1e-04
## $75,000+ 0.31 [0.26;0.37] < 1e-04
## Missing 0.64 [0.54;0.75] < 1e-04
## educ_cat_fct <High School Ref
## College or More 0.92 [0.77;1.09] 0.331666
## High School 0.84 [0.71;0.99] 0.039315
## Some College 0.90 [0.76;1.07] 0.224564
tidy5<-fitstep5 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="drcost_d_fct")
formula<-as.formula(chron_num ~ drcost_d_fct+ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +drcost_d_fct+bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit6<- lm(formula,data=df,na.action=na.omit)
fitstep6<-stats::step(fit6,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep6)
## Variable Units Coefficient CI.95 p-value
## (Intercept) 0.53 [0.45;0.61] < 1e-04
## drcost_d_fct No Ref
## Yes 0.04 [0.01;0.07] 0.0154635
## smk_cat_fct Current smoker Ref
## DK/Refused -0.07 [-0.16;0.03] 0.1747441
## Former smoker -0.01 [-0.04;0.01] 0.4095806
## Never smoker -0.16 [-0.18;-0.13] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 0.28 [0.26;0.30] < 1e-04
## Overweight 0.11 [0.09;0.13] < 1e-04
## Underweight 0.02 [-0.04;0.08] 0.6021168
## drnkhvy_d_fct No Ref
## Yes -0.07 [-0.10;-0.04] < 1e-04
## mentqol14_d_fct No Ref
## Yes 0.07 [0.04;0.10] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only -0.05 [-0.13;0.04] 0.2914690
## Black or African American only -0.13 [-0.21;-0.06] 0.0005242
## Multiracial -0.02 [-0.11;0.07] 0.6547539
## Native Hawaiian or other Pacific Islander only -0.18 [-0.32;-0.04] 0.0120064
## Other race only -0.19 [-0.27;-0.11] < 1e-04
## White only -0.05 [-0.12;0.02] 0.1801248
## sex_d_fct Female Ref
## Male -0.07 [-0.08;-0.05] < 1e-04
## cvd_d_num 1.48 [1.44;1.51] < 1e-04
## asth_d_num 1.23 [1.21;1.26] < 1e-04
## cncr_d_num 1.15 [1.12;1.18] < 1e-04
## physqol14_d_fct No Ref
## Yes 0.38 [0.35;0.41] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.11 [0.06;0.15] < 1e-04
## Out of work 0.09 [0.05;0.12] < 1e-04
## Retired 0.45 [0.43;0.47] < 1e-04
## Self-Employed 0.04 [0.02;0.07] 0.0021124
## Student -0.16 [-0.21;-0.12] < 1e-04
## Unable 0.52 [0.49;0.56] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 -0.04 [-0.07;-0.01] 0.0143713
## $35,000-74,999 -0.11 [-0.14;-0.09] < 1e-04
## $75,000+ -0.14 [-0.17;-0.11] < 1e-04
## Missing -0.10 [-0.13;-0.07] < 1e-04
## educ_cat_fct <High School Ref
## College or More -0.14 [-0.18;-0.10] < 1e-04
## High School -0.09 [-0.12;-0.05] < 1e-04
## Some College -0.09 [-0.13;-0.05] < 1e-04
tidy6<-fitstep6 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="chron_num")
formula<-as.formula(cvd_d_num ~ chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + drcost_d_fct+race_cat_fct + sex_d_fct + chron_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit7<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep7<-stats::step(fit7,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep7)
## Variable Units OddsRatio CI.95 p-value
## chron_num 7.64 [7.02;8.32] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 2.31 [1.16;4.60] 0.016830
## Former smoker 1.75 [1.42;2.14] < 1e-04
## Never smoker 1.68 [1.36;2.07] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 0.61 [0.51;0.73] < 1e-04
## Overweight 0.98 [0.82;1.17] 0.821635
## Underweight 1.34 [0.81;2.21] 0.254190
## mentqol14_d_fct No Ref
## Yes 0.78 [0.63;0.95] 0.013811
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 1.28 [0.58;2.82] 0.535271
## Black or African American only 0.95 [0.50;1.81] 0.880822
## Multiracial 1.37 [0.68;2.78] 0.377392
## Native Hawaiian or other Pacific Islander only 1.60 [0.40;6.48] 0.509177
## Other race only 1.78 [0.90;3.50] 0.097266
## White only 1.29 [0.73;2.28] 0.376204
## sex_d_fct Female Ref
## Male 2.38 [2.07;2.75] < 1e-04
## asth_d_num 0.08 [0.07;0.10] < 1e-04
## cncr_d_num 0.16 [0.13;0.20] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 1.44 [0.93;2.21] 0.100060
## Out of work 0.82 [0.55;1.21] 0.318170
## Retired 1.53 [1.27;1.84] < 1e-04
## Self-Employed 1.46 [1.09;1.94] 0.009995
## Student 0.17 [0.04;0.76] 0.020773
## Unable 1.06 [0.82;1.38] 0.655860
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.83 [0.67;1.03] 0.088286
## $35,000-74,999 0.96 [0.77;1.19] 0.708446
## $75,000+ 0.94 [0.74;1.20] 0.607622
## Missing 0.88 [0.70;1.10] 0.258983
## educ_cat_fct <High School Ref
## College or More 1.29 [0.99;1.69] 0.061223
## High School 1.11 [0.87;1.43] 0.406875
## Some College 1.02 [0.79;1.33] 0.851822
tidy7<-fitstep7 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="cvd_d_num")
formula<-as.formula(asth_d_num ~cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + cncr_d_num + physqol14_d_fct + drcost_d_fct+
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit8<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep8<-stats::step(fit8,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep8)
## Variable Units OddsRatio CI.95 p-value
## cvd_d_num 0.04 [0.04;0.05] < 1e-04
## chron_num 9.23 [8.64;9.86] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 0.96 [0.58;1.61] 0.8910477
## Former smoker 0.94 [0.82;1.08] 0.3911989
## Never smoker 1.45 [1.27;1.66] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 0.69 [0.62;0.77] < 1e-04
## Overweight 0.81 [0.72;0.90] 0.0001143
## Underweight 0.84 [0.60;1.18] 0.3218275
## drnkhvy_d_fct No Ref
## Yes 1.19 [1.01;1.41] 0.0408298
## mentqol14_d_fct No Ref
## Yes 1.32 [1.16;1.50] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.90 [0.55;1.46] 0.6671413
## Black or African American only 1.58 [1.04;2.38] 0.0309911
## Multiracial 1.35 [0.84;2.18] 0.2149574
## Native Hawaiian or other Pacific Islander only 1.35 [0.63;2.86] 0.4403991
## Other race only 1.86 [1.19;2.91] 0.0061435
## White only 1.13 [0.77;1.67] 0.5291897
## sex_d_fct Female Ref
## Male 0.73 [0.67;0.80] < 1e-04
## drcost_d_fct No Ref
## Yes 1.17 [1.01;1.36] 0.0310979
## cncr_d_num 0.08 [0.06;0.09] < 1e-04
## physqol14_d_fct No Ref
## Yes 0.70 [0.61;0.80] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.56 [0.44;0.72] < 1e-04
## Out of work 0.81 [0.66;0.99] 0.0431719
## Retired 0.19 [0.17;0.22] < 1e-04
## Self-Employed 0.66 [0.56;0.78] < 1e-04
## Student 2.64 [2.13;3.29] < 1e-04
## Unable 0.39 [0.33;0.47] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.95 [0.81;1.11] 0.5376374
## $35,000-74,999 1.12 [0.96;1.31] 0.1499488
## $75,000+ 1.36 [1.16;1.60] 0.0001472
## Missing 1.19 [1.01;1.40] 0.0353729
## educ_cat_fct <High School Ref
## College or More 1.47 [1.21;1.78] 0.0001301
## High School 1.06 [0.88;1.29] 0.5174392
## Some College 1.19 [0.98;1.45] 0.0745898
tidy8<-fitstep8 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="asth_d_num")
formula<-as.formula(cncr_d_num ~ asth_d_num + cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + asth_d_num + physqol14_d_fct + drcost_d_fct+
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit9<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep9<-stats::step(fit9,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep9)
## Variable Units OddsRatio CI.95 p-value
## asth_d_num 0.09 [0.07;0.10] < 1e-04
## cvd_d_num 0.10 [0.08;0.12] < 1e-04
## chron_num 6.38 [5.97;6.81] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 1.51 [0.86;2.65] 0.1504630
## Former smoker 1.58 [1.34;1.85] < 1e-04
## Never smoker 1.55 [1.32;1.82] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 0.45 [0.39;0.51] < 1e-04
## Overweight 0.73 [0.65;0.83] < 1e-04
## Underweight 0.89 [0.60;1.30] 0.5451412
## mentqol14_d_fct No Ref
## Yes 0.74 [0.63;0.87] 0.0002186
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.59 [0.29;1.20] 0.1465189
## Black or African American only 1.29 [0.75;2.20] 0.3603275
## Multiracial 1.53 [0.84;2.78] 0.1680247
## Native Hawaiian or other Pacific Islander only 1.36 [0.42;4.44] 0.6084740
## Other race only 1.46 [0.81;2.63] 0.2130498
## White only 1.65 [1.01;2.69] 0.0473520
## sex_d_fct Female Ref
## Male 0.76 [0.69;0.84] < 1e-04
## drcost_d_fct No Ref
## Yes 0.82 [0.67;0.99] 0.0396769
## empl_cat_fct Employed for wages Ref
## Homemaker 1.14 [0.86;1.49] 0.3614784
## Out of work 0.99 [0.75;1.30] 0.9267677
## Retired 1.17 [1.03;1.33] 0.0175454
## Self-Employed 1.22 [1.00;1.48] 0.0519241
## Student 0.47 [0.24;0.93] 0.0305545
## Unable 0.81 [0.66;0.99] 0.0424775
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 1.19 [1.00;1.43] 0.0526843
## $35,000-74,999 1.59 [1.33;1.89] < 1e-04
## $75,000+ 1.60 [1.32;1.93] < 1e-04
## Missing 1.33 [1.10;1.60] 0.0028475
## educ_cat_fct <High School Ref
## College or More 2.20 [1.74;2.77] < 1e-04
## High School 1.51 [1.21;1.89] 0.0003269
## Some College 1.60 [1.27;2.01] < 1e-04
tidy9<-fitstep9 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="cncr_d_num")
formula<-as.formula(physqol14_d_fct ~ cncr_d_num + asth_d_num + cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + cncr_d_num +
empl_cat_fct + income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + asth_d_num + cncr_d_num + drcost_d_fct+
empl_cat_fct + income_4cats_fct + educ_cat_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+income_4cats_fct+educ_cat_fct)
fit10<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep10<-stats::step(fit10,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep10)
## Variable Units OddsRatio CI.95 p-value
## asth_d_num 0.79 [0.70;0.89] 0.0001056
## chron_num 1.74 [1.67;1.82] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 0.69 [0.41;1.17] 0.1668432
## Former smoker 1.00 [0.88;1.13] 0.9790969
## Never smoker 0.82 [0.73;0.92] 0.0010660
## bmi_cat_fct Normal Weight Ref
## Obese 1.23 [1.10;1.37] 0.0001785
## Overweight 1.00 [0.89;1.12] 0.9831508
## Underweight 1.05 [0.75;1.46] 0.7874152
## mentqol14_d_fct No Ref
## Yes 3.84 [3.45;4.26] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.65 [0.39;1.08] 0.0946269
## Black or African American only 0.83 [0.58;1.20] 0.3302520
## Multiracial 0.85 [0.56;1.32] 0.4748416
## Native Hawaiian or other Pacific Islander only 1.08 [0.53;2.20] 0.8349943
## Other race only 1.06 [0.71;1.57] 0.7796996
## White only 0.92 [0.66;1.28] 0.6149497
## sex_d_fct Female Ref
## Male 1.17 [1.07;1.27] 0.0007058
## drcost_d_fct No Ref
## Yes 1.58 [1.38;1.80] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 1.94 [1.54;2.44] < 1e-04
## Out of work 2.60 [2.17;3.11] < 1e-04
## Retired 1.80 [1.59;2.03] < 1e-04
## Self-Employed 1.09 [0.90;1.32] 0.3862397
## Student 1.05 [0.75;1.48] 0.7699286
## Unable 6.73 [5.82;7.78] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.96 [0.84;1.09] 0.5175086
## $35,000-74,999 0.78 [0.68;0.89] 0.0004105
## $75,000+ 0.69 [0.59;0.80] < 1e-04
## Missing 0.87 [0.75;1.00] 0.0488708
## educ_cat_fct <High School Ref
## College or More 0.84 [0.71;1.00] 0.0522989
## High School 1.00 [0.85;1.17] 0.9594839
## Some College 1.11 [0.94;1.30] 0.2289664
tidy10<-fitstep10 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="physqol14_d_fct")
formula<-as.formula(empl_cat_fct ~ physqol14_d_fct + cncr_d_num + asth_d_num + cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
income_4cats_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + asth_d_num +drcost_d_fct +cncr_d_num+
income_4cats_fct + educ_cat_fct+physqol14_d_fct,
lower=~race_cat_fct+sex_d_fct+income_4cats_fct+educ_cat_fct)
fit11<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep11<-stats::step(fit11,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep11)
## Variable Units OddsRatio CI.95 p-value
## physqol14_d_fct No Ref
## Yes 2.02 [1.82;2.24] < 1e-04
## asth_d_num 0.41 [0.37;0.45] < 1e-04
## cvd_d_num 1.25 [1.06;1.48] 0.0089549
## chron_num 1.99 [1.91;2.07] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 1.65 [1.18;2.30] 0.0036483
## Former smoker 1.84 [1.68;2.01] < 1e-04
## Never smoker 1.41 [1.30;1.53] < 1e-04
## bmi_cat_fct Normal Weight Ref
## Obese 0.67 [0.63;0.72] < 1e-04
## Overweight 0.87 [0.82;0.93] < 1e-04
## Underweight 0.96 [0.78;1.19] 0.7272545
## drnkhvy_d_fct No Ref
## Yes 0.83 [0.75;0.93] 0.0006261
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 0.99 [0.73;1.33] 0.9238966
## Black or African American only 0.81 [0.62;1.06] 0.1212630
## Multiracial 1.08 [0.79;1.48] 0.6252846
## Native Hawaiian or other Pacific Islander only 0.72 [0.45;1.17] 0.1833730
## Other race only 0.94 [0.70;1.25] 0.6541957
## White only 1.42 [1.10;1.82] 0.0063543
## sex_d_fct Female Ref
## Male 0.95 [0.90;1.01] 0.0935344
## drcost_d_fct No Ref
## Yes 0.63 [0.57;0.69] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 0.42 [0.37;0.47] < 1e-04
## $35,000-74,999 0.23 [0.21;0.26] < 1e-04
## $75,000+ 0.14 [0.12;0.15] < 1e-04
## Missing 0.53 [0.47;0.60] < 1e-04
## educ_cat_fct <High School Ref
## College or More 0.63 [0.55;0.72] < 1e-04
## High School 0.69 [0.60;0.79] < 1e-04
## Some College 0.63 [0.55;0.72] < 1e-04
tidy11<-fitstep11 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="empl_cat_fct")
formula<-as.formula( income_4cats_fct~ physqol14_d_fct + cncr_d_num + asth_d_num + cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + educ_cat_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + asth_d_num +drcost_d_fct +cncr_d_num+
empl_cat_fct + educ_cat_fct+physqol14_d_fct,
lower=~race_cat_fct+sex_d_fct+empl_cat_fct+educ_cat_fct)
fit12<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep12<-stats::step(fit12,scope=scope,trace=F,k=2,direction="both")
#Model Results
publish(fitstep12)
## Variable Units OddsRatio CI.95 p-value
## physqol14_d_fct No Ref
## Yes 0.83 [0.75;0.93] 0.0014599
## cncr_d_num 1.27 [1.10;1.46] 0.0009719
## asth_d_num 1.11 [0.98;1.25] 0.1045509
## cvd_d_num 0.88 [0.75;1.03] 0.1213360
## chron_num 0.85 [0.81;0.90] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 1.67 [1.03;2.72] 0.0378576
## Former smoker 1.54 [1.38;1.72] < 1e-04
## Never smoker 1.41 [1.27;1.56] < 1e-04
## drnkhvy_d_fct No Ref
## Yes 1.16 [0.98;1.37] 0.0784470
## mentqol14_d_fct No Ref
## Yes 0.80 [0.71;0.89] < 1e-04
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 1.23 [0.85;1.76] 0.2687885
## Black or African American only 1.14 [0.85;1.53] 0.3952518
## Multiracial 1.58 [1.10;2.28] 0.0133735
## Native Hawaiian or other Pacific Islander only 0.81 [0.48;1.38] 0.4465821
## Other race only 1.06 [0.77;1.45] 0.7389027
## White only 2.13 [1.62;2.80] < 1e-04
## sex_d_fct Female Ref
## Male 1.23 [1.14;1.34] < 1e-04
## drcost_d_fct No Ref
## Yes 0.68 [0.60;0.76] < 1e-04
## empl_cat_fct Employed for wages Ref
## Homemaker 0.44 [0.36;0.53] < 1e-04
## Out of work 0.15 [0.13;0.18] < 1e-04
## Retired 0.40 [0.36;0.45] < 1e-04
## Self-Employed 0.46 [0.39;0.54] < 1e-04
## Student 0.23 [0.19;0.28] < 1e-04
## Unable 0.12 [0.11;0.14] < 1e-04
## educ_cat_fct <High School Ref
## College or More 6.27 [5.43;7.25] < 1e-04
## High School 1.85 [1.63;2.09] < 1e-04
## Some College 2.90 [2.54;3.31] < 1e-04
tidy12<-fitstep12 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="income_4cats_fct")
formula<-as.formula( educ_cat_fct~ physqol14_d_fct + cncr_d_num + asth_d_num + cvd_d_num + chron_num + smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct +
drcost_d_fct + cvd_d_num + asth_d_num + cncr_d_num + physqol14_d_fct +
empl_cat_fct + income_4cats_fct)
scope<-list(upper=~ smk_cat_fct +bmi_cat_fct+drnkhvy_d_fct+mentqol14_d_fct + race_cat_fct + sex_d_fct + chron_num + cvd_d_num + asth_d_num +drcost_d_fct +cncr_d_num+
empl_cat_fct + income_4cats_fct+physqol14_d_fct)
fit13<- glm(formula,data=df,family=binomial(logit),na.action=na.omit)
fitstep13<-stats::step(fit13,scope=formula,trace=T,k=2,direction="both")
## Start: AIC=10680
## educ_cat_fct ~ physqol14_d_fct + cncr_d_num + asth_d_num + cvd_d_num +
## chron_num + smk_cat_fct + bmi_cat_fct + drnkhvy_d_fct + mentqol14_d_fct +
## race_cat_fct + sex_d_fct + drcost_d_fct + cvd_d_num + asth_d_num +
## cncr_d_num + physqol14_d_fct + empl_cat_fct + income_4cats_fct
##
## Df Deviance AIC
## - bmi_cat_fct 3 10619 10677
## - physqol14_d_fct 1 10616 10678
## - mentqol14_d_fct 1 10616 10678
## - cvd_d_num 1 10617 10679
## <none> 10616 10680
## - drcost_d_fct 1 10619 10681
## - asth_d_num 1 10619 10681
## - drnkhvy_d_fct 1 10623 10685
## - cncr_d_num 1 10631 10693
## - chron_num 1 10646 10708
## - smk_cat_fct 3 10664 10722
## - sex_d_fct 1 10688 10750
## - race_cat_fct 6 10797 10849
## - empl_cat_fct 6 10822 10874
## - income_4cats_fct 4 11380 11436
##
## Step: AIC=10676.78
## educ_cat_fct ~ physqol14_d_fct + cncr_d_num + asth_d_num + cvd_d_num +
## chron_num + smk_cat_fct + drnkhvy_d_fct + mentqol14_d_fct +
## race_cat_fct + sex_d_fct + drcost_d_fct + empl_cat_fct +
## income_4cats_fct
##
## Df Deviance AIC
## - physqol14_d_fct 1 10619 10675
## - mentqol14_d_fct 1 10619 10675
## - cvd_d_num 1 10620 10676
## <none> 10619 10677
## - drcost_d_fct 1 10622 10678
## - asth_d_num 1 10622 10678
## + bmi_cat_fct 3 10616 10680
## - drnkhvy_d_fct 1 10626 10682
## - cncr_d_num 1 10635 10691
## - chron_num 1 10651 10707
## - smk_cat_fct 3 10666 10718
## - sex_d_fct 1 10694 10750
## - race_cat_fct 6 10801 10847
## - empl_cat_fct 6 10825 10871
## - income_4cats_fct 4 11382 11432
##
## Step: AIC=10674.91
## educ_cat_fct ~ cncr_d_num + asth_d_num + cvd_d_num + chron_num +
## smk_cat_fct + drnkhvy_d_fct + mentqol14_d_fct + race_cat_fct +
## sex_d_fct + drcost_d_fct + empl_cat_fct + income_4cats_fct
##
## Df Deviance AIC
## - mentqol14_d_fct 1 10619 10673
## - cvd_d_num 1 10620 10674
## <none> 10619 10675
## - drcost_d_fct 1 10622 10676
## - asth_d_num 1 10622 10676
## + physqol14_d_fct 1 10619 10677
## + bmi_cat_fct 3 10616 10678
## - drnkhvy_d_fct 1 10626 10680
## - cncr_d_num 1 10635 10689
## - chron_num 1 10653 10707
## - smk_cat_fct 3 10666 10716
## - sex_d_fct 1 10694 10748
## - race_cat_fct 6 10801 10845
## - empl_cat_fct 6 10829 10873
## - income_4cats_fct 4 11383 11431
##
## Step: AIC=10673.19
## educ_cat_fct ~ cncr_d_num + asth_d_num + cvd_d_num + chron_num +
## smk_cat_fct + drnkhvy_d_fct + race_cat_fct + sex_d_fct +
## drcost_d_fct + empl_cat_fct + income_4cats_fct
##
## Df Deviance AIC
## - cvd_d_num 1 10620 10672
## <none> 10619 10673
## - drcost_d_fct 1 10622 10674
## - asth_d_num 1 10622 10674
## + mentqol14_d_fct 1 10619 10675
## + physqol14_d_fct 1 10619 10675
## + bmi_cat_fct 3 10616 10676
## - drnkhvy_d_fct 1 10626 10678
## - cncr_d_num 1 10635 10687
## - chron_num 1 10653 10705
## - smk_cat_fct 3 10666 10714
## - sex_d_fct 1 10695 10747
## - race_cat_fct 6 10802 10844
## - empl_cat_fct 6 10829 10871
## - income_4cats_fct 4 11383 11429
##
## Step: AIC=10672
## educ_cat_fct ~ cncr_d_num + asth_d_num + chron_num + smk_cat_fct +
## drnkhvy_d_fct + race_cat_fct + sex_d_fct + drcost_d_fct +
## empl_cat_fct + income_4cats_fct
##
## Df Deviance AIC
## <none> 10620 10672
## - asth_d_num 1 10623 10673
## - drcost_d_fct 1 10623 10673
## + cvd_d_num 1 10619 10673
## + mentqol14_d_fct 1 10620 10674
## + physqol14_d_fct 1 10620 10674
## + bmi_cat_fct 3 10617 10675
## - drnkhvy_d_fct 1 10627 10677
## - cncr_d_num 1 10635 10685
## - chron_num 1 10658 10708
## - smk_cat_fct 3 10668 10714
## - sex_d_fct 1 10695 10745
## - race_cat_fct 6 10802 10842
## - empl_cat_fct 6 10830 10870
## - income_4cats_fct 4 11384 11428
#Model Results
publish(fitstep13)
## Variable Units OddsRatio CI.95 p-value
## cncr_d_num 1.45 [1.20;1.77] 0.0001472
## asth_d_num 1.14 [0.97;1.34] 0.1036070
## chron_num 0.83 [0.79;0.88] < 1e-04
## smk_cat_fct Current smoker Ref
## DK/Refused 1.67 [0.90;3.08] 0.1022529
## Former smoker 1.39 [1.20;1.60] < 1e-04
## Never smoker 1.62 [1.41;1.85] < 1e-04
## drnkhvy_d_fct No Ref
## Yes 1.37 [1.08;1.74] 0.0099682
## race_cat_fct American Indian or Alaskan Native only Ref
## Asian only 1.65 [1.04;2.63] 0.0347368
## Black or African American only 1.01 [0.71;1.43] 0.9678445
## Multiracial 1.56 [1.00;2.43] 0.0515980
## Native Hawaiian or other Pacific Islander only 0.64 [0.35;1.16] 0.1423469
## Other race only 0.58 [0.40;0.83] 0.0030907
## White only 1.91 [1.39;2.63] < 1e-04
## sex_d_fct Female Ref
## Male 0.62 [0.55;0.69] < 1e-04
## drcost_d_fct No Ref
## Yes 0.88 [0.75;1.02] 0.0945535
## empl_cat_fct Employed for wages Ref
## Homemaker 0.27 [0.22;0.34] < 1e-04
## Out of work 0.69 [0.56;0.85] 0.0005527
## Retired 0.95 [0.81;1.12] 0.5406682
## Self-Employed 0.52 [0.43;0.62] < 1e-04
## Student 1.81 [1.21;2.73] 0.0041917
## Unable 0.52 [0.44;0.63] < 1e-04
## income_4cats_fct <$20,000 Ref
## $20,000-34,999 2.05 [1.77;2.36] < 1e-04
## $35,000-74,999 4.72 [3.97;5.61] < 1e-04
## $75,000+ 14.23 [11.07;18.31] < 1e-04
## Missing 1.56 [1.35;1.81] < 1e-04
tidy13<-fitstep13 %>%
tidy(exponentiate=T,conf.int=T) %>%
mutate(var="educ_cat_fct")
#Table reference for Visualization
categories<-tribble( ~term,~var,~p.value,~estimate,
"asth_d_num" ,"asth_d_num",2, "0",
"bmi_cat_fctObese" ,"bmi_cat_fct",2,"0",
"bmi_cat_fctOverweight" ,"bmi_cat_fct",2,"0",
"bmi_cat_fctUnderweight" ,"bmi_cat_fct",2,"0",
"chron_num" ,"chron_num",2,"0",
"cncr_d_num" ,"cncr_d_num",2,"0",
"cvd_d_num" ,"cvd_d_num" ,2,"0",
"drcost_d_fctYes" ,"drcost_d_fct",2,"0",
"drnkhvy_d_fctYes" ,"drnkhvy_d_fct",2,"0",
"educ_cat_fctCollege or More" ,"educ_cat_fct",2,"0",
"educ_cat_fctHigh School" ,"educ_cat_fct",2,"0",
"educ_cat_fctSome College" ,"educ_cat_fct",2,"0",
"empl_cat_fctHomemaker" ,"empl_cat_fct",2,"0",
"empl_cat_fctOut of work" ,"empl_cat_fct",2,"0",
"empl_cat_fctRetired" ,"empl_cat_fct",2,"0",
"empl_cat_fctSelf-Employed" ,"empl_cat_fct",2,"0",
"empl_cat_fctStudent" ,"empl_cat_fct",2,"0",
"empl_cat_fctUnable" ,"empl_cat_fct",2,"0",
"income_4cats_fct$20,000-34,999" ,"income_4cats_fct",2,"0",
"income_4cats_fct$35,000-74,999" ,"income_4cats_fct",2,"0",
"income_4cats_fct$75,000+" ,"income_4cats_fct",2,"0",
"income_4cats_fctMissing" ,"income_4cats_fct",2,"0",
"mentqol14_d_fctYes" ,"mentqol14_d_fct",2,"0",
"physqol14_d_fctYes" ,"physqol14_d_fct",2,"0",
"race_cat_fctAsian only" ,"race_cat_fct",2,"0",
"race_cat_fctBlack or African American only" ,"race_cat_fct",2,"0",
"race_cat_fctMultiracial" ,"race_cat_fct",2,"0",
"race_cat_fctNative Hawaiian or other Pacific Islander only" ,"race_cat_fct",2,"0",
"race_cat_fctOther race only" ,"race_cat_fct",2,"0",
"race_cat_fctWhite only" ,"race_cat_fct",2,"0",
"sex_d_fctMale" ,"sex_d_fct",2,"0",
"smk_cat_fctDK/Refused" ,"smk_cat_fct",2,"0",
"smk_cat_fctFormer smoker" ,"smk_cat_fct",2,"0",
"smk_cat_fctNever smoker" ,"smk_cat_fct",2,"0"
)
#Combine all tables
full_table<-rbind(tidy1,
tidy2,
tidy3,
tidy4,
tidy5,
tidy6,
tidy7,
tidy8,
tidy9,
tidy10,
tidy11,
tidy12,
tidy13) %>%
#Narrow Table
dplyr::select(var,term,p.value,estimate) %>%
#Remove intercept and filter for significance
filter(term!="(Intercept)" & p.value<=0.05) %>%
#Invert p values to for line thickness
mutate(p.value=(1-p.value)) %>%
#Combine categories for visualization groupings
rbind(categories) %>%
rename(factor="estimate")
full_table
## # A tibble: 293 x 4
## var term p.value factor
## <chr> <chr> <dbl> <chr>
## 1 mentqol14_d_f~ race_cat_fctAsian only 1.00 0.418285550725~
## 2 mentqol14_d_f~ race_cat_fctBlack or African American~ 0.986 0.661193425897~
## 3 mentqol14_d_f~ race_cat_fctOther race only 0.970 0.669971752240~
## 4 mentqol14_d_f~ race_cat_fctWhite only 0.992 0.668185005867~
## 5 mentqol14_d_f~ sex_d_fctMale 1.00 0.780310680717~
## 6 mentqol14_d_f~ drnkhvy_d_fctYes 1.00 1.591280345814~
## 7 mentqol14_d_f~ bmi_cat_fctObese 1.00 1.229515606087~
## 8 mentqol14_d_f~ bmi_cat_fctOverweight 0.961 0.890001833920~
## 9 mentqol14_d_f~ smk_cat_fctFormer smoker 1 0.602065107890~
## 10 mentqol14_d_f~ smk_cat_fctNever smoker 1 0.535937890023~
## # ... with 283 more rows
#table for Visualization
table2<-left_join(full_table,categories,by="term") %>%
dplyr::select(var.x,var.y,everything()) %>%
filter(p.value.x!=2) %>%
group_by(var.x,var.y) %>%
summarise(count=n())
## `summarise()` has grouped output by 'var.x'. You can override using the `.groups` argument.