final_cohort_1_no_missing  <- final_cohort_1 %>% drop_na() %>% select(-RACE,-RACE_cate,-CLM_FROM_1year_num,-ICU_DAYS_1year_num,-HEMOSESSIONS_3year,-time_to_death_3year,-time_to_death_3year_month)


#########  training and testing 


index <-  createDataPartition(final_cohort_1_no_missing$time_to_death_1year_status,p=.8,list = F,times = 1)

#training 
training <- final_cohort_1_no_missing[index,]


#test
testing <- final_cohort_1_no_missing[-index,]



##################### CHECK zero-variance

nearZeroVar(training ,saveMetrics = T)
##                              freqRatio percentUnique zeroVar   nzv
## HISPANIC                      7.021185  0.0006914004   FALSE FALSE
## race_cat_4                    2.501681  0.0013828007   FALSE FALSE
## SEX                           1.341853  0.0006914004   FALSE FALSE
## state_cat                     2.161475  0.0013828007   FALSE FALSE
## age                           1.013715  0.0286931150   FALSE FALSE
## sex_cat                       1.341853  0.0006914004   FALSE FALSE
## COMO_CHF                      2.049259  0.0006914004   FALSE FALSE
## COMO_COPD                     8.083339  0.0006914004   FALSE FALSE
## COMO_TOBAC                   14.152061  0.0006914004   FALSE FALSE
## COMO_CANC                    12.086681  0.0006914004   FALSE FALSE
## COMO_ASHD                     5.510499  0.0006914004   FALSE FALSE
## COMO_OTHCARD                  3.449387  0.0006914004   FALSE FALSE
## COMO_CVATIA                   9.258458  0.0006914004   FALSE FALSE
## COMO_PVD                      8.005853  0.0006914004   FALSE FALSE
## COMO_HTN                      7.900828  0.0006914004   FALSE FALSE
## COMO_AMP                     26.681148  0.0006914004   FALSE  TRUE
## COMO_DM_INS                   1.219300  0.0006914004   FALSE FALSE
## COMO_DM_ORAL                  7.195025  0.0006914004   FALSE FALSE
## COMO_DM_NOMEDS               12.391417  0.0006914004   FALSE FALSE
## COMO_ALCHO                   72.661319  0.0006914004   FALSE  TRUE
## COMO_DRUG                    95.422667  0.0006914004   FALSE  TRUE
## COMO_INAMB                   12.177296  0.0006914004   FALSE FALSE
## COMO_INTRANS                 24.412281  0.0006914004   FALSE  TRUE
## COMO_NEEDASST                 5.786505  0.0006914004   FALSE FALSE
## COMO_INST_OTH               140.382209  0.0006914004   FALSE  TRUE
## COMO_INST                     9.690269  0.0006914004   FALSE FALSE
## COMO_INST_AL                115.593309  0.0006914004   FALSE  TRUE
## COMO_INST_NURS               11.697217  0.0006914004   FALSE FALSE
## PATTXOP_UNSUTAGE             25.208934  0.0006914004   FALSE  TRUE
## PATTXOP_PHYSUNFIT           239.455528  0.0006914004   FALSE  TRUE
## PATTXOP_MEDUNFIT             20.117535  0.0006914004   FALSE  TRUE
## FERRITIN                      1.009615  7.5760194698   FALSE FALSE
## HGB                           1.029770  0.6675470498   FALSE FALSE
## IRON_SAT_PERCENT              1.010322  0.3588367880   FALSE FALSE
## ALBUMIN                       1.008190  0.4632382427   FALSE FALSE
## CALCIUM_CORRECTED             1.003538  0.4155316177   FALSE FALSE
## CALCIUM_UNCORRECTED           1.017154  0.4075805136   FALSE FALSE
## PHOSPHORUS                    1.009131  0.6544104429   FALSE FALSE
## HEMOSESSIONS_1year           42.076155  0.0024199013   FALSE  TRUE
## HD_KTV                        1.053104  1.3696641177   FALSE FALSE
## CLM_FROM_3year_num            2.058270  0.0283474149   FALSE FALSE
## ICU_DAYS_3year_num           12.832061  0.7003885670   FALSE FALSE
## time_to_death_1year        1202.969849  0.1261805661   FALSE  TRUE
## time_to_death_1year_status    4.786286  0.0006914004   FALSE FALSE
## time_to_death_3year_status    1.298331  0.0006914004   FALSE FALSE
## ICU_DAYS_1year_cat            2.819072  0.0006914004   FALSE FALSE
## CLM_FROM_1year_cat            1.078523  0.0006914004   FALSE FALSE
## time_to_death_1year_month  1202.969849  0.1261805661   FALSE  TRUE
nz <- nearZeroVar(training)
nz[1:(length(nz) - 5)]
## [1] 16 20 21 23 25 27 29
# names(training)[nz[1:(length(nz) - 5)]]
training_no_zero <- training[,-nz[1:(length(nz) - 3)]]


##################### CHECK colinearity 
library(corrplot)
## corrplot 0.95 loaded
descrCor <-cor( training_no_zero %>% select(which(sapply(training_no_zero, is.numeric))))

highlyCorDescr <- findCorrelation(descrCor,cutoff = .7,names = T)

training_no_zero_no_co <- training_no_zero



################### Centering and Scaling


preProcValues_training <- preProcess(training_no_zero_no_co %>% select(names(training_no_zero_no_co),-time_to_death_1year), method = c("center", "scale"))

training_no_zero_no_co_st <- predict(preProcValues_training,training_no_zero_no_co)


preProcValues_testing <- preProcess(testing %>% select(names(training_no_zero_no_co_st),-time_to_death_1year), method = c("center", "scale"))

testing_no_zero_no_co_st <- predict(preProcValues_testing,testing)







##################### data preprocess 
training_no_zero_no_co_st_1year <- training_no_zero_no_co_st[ , !grepl("3year", names(training_no_zero_no_co_st))]
testing_no_zero_no_co_st_1year <- testing_no_zero_no_co_st[ , !grepl("3year", names(testing_no_zero_no_co_st))]




levels(training_no_zero_no_co_st_1year$time_to_death_1year_status) <- c("alive", "died")


dummies <- dummyVars(time_to_death_1year_status ~ ., data = training_no_zero_no_co_st_1year) # Using caret to create dummy variables
training_no_zero_no_co_st_1year_dummies <- as.data.frame(predict(dummies, newdata = training_no_zero_no_co_st_1year))
## Warning in model.frame.default(Terms, newdata, na.action = na.action, xlev =
## object$lvls): variable 'time_to_death_1year_status' is not a factor
training_no_zero_no_co_st_1year_dummies$time_to_death_1year_status <- training_no_zero_no_co_st_1year$time_to_death_1year_status



###### testing 

levels(testing_no_zero_no_co_st_1year$time_to_death_1year_status) <- c("alive", "died")


dummies_testing <- dummyVars(time_to_death_1year_status ~ ., data = testing_no_zero_no_co_st_1year) # Using caret to create dummy variables
testing_no_zero_no_co_st_1year_dummies <- as.data.frame(predict(dummies_testing, newdata = testing_no_zero_no_co_st_1year))
## Warning in model.frame.default(Terms, newdata, na.action = na.action, xlev =
## object$lvls): variable 'time_to_death_1year_status' is not a factor
testing_no_zero_no_co_st_1year_dummies$time_to_death_1year_status <- testing_no_zero_no_co_st_1year$time_to_death_1year_status

Model1 : age sex_cat

## Area under the curve: 0.6686
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction alive  died
##      alive 41673  5846
##      died  18146  6652
##                                           
##                Accuracy : 0.6682          
##                  95% CI : (0.6648, 0.6717)
##     No Information Rate : 0.8272          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.1648          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.53225         
##             Specificity : 0.69665         
##          Pos Pred Value : 0.26825         
##          Neg Pred Value : 0.87698         
##              Prevalence : 0.17282         
##          Detection Rate : 0.09198         
##    Detection Prevalence : 0.34291         
##       Balanced Accuracy : 0.61445         
##                                           
##        'Positive' Class : died            
## 
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error  z value Pr(>|z|)    
## (Intercept) -1.721799   0.008075 -213.216  < 2e-16 ***
## age          0.657208   0.005948  110.491  < 2e-16 ***
## sex_catMale  0.044462   0.010191    4.363 1.28e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 252169  on 289265  degrees of freedom
## AIC: 252175
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.93 1.91, 1.95 <0.001
sex_catMale 1.05 1.02, 1.07 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

Model2 : age sex_cat ALBUMIN

## Area under the curve: 0.7781
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.021156   0.009084 -222.50   <2e-16 ***
## age          0.646368   0.006270  103.09   <2e-16 ***
## sex_catMale  0.165173   0.010947   15.09   <2e-16 ***
## ALBUMIN     -0.885629   0.005455 -162.34   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 221723  on 289264  degrees of freedom
## AIC: 221731
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.91 1.89, 1.93 <0.001
sex_catMale 1.18 1.15, 1.21 <0.001
ALBUMIN 0.41 0.41, 0.42 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

Model_3 : age sex_cat ALBUMIN COMO_CHF

## Area under the curve: 0.783
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.190874   0.010184 -215.13   <2e-16 ***
## age          0.624261   0.006318   98.80   <2e-16 ***
## sex_catMale  0.168705   0.010987   15.36   <2e-16 ***
## ALBUMIN     -0.882142   0.005479 -161.00   <2e-16 ***
## COMO_CHFY    0.454742   0.011042   41.19   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 220046  on 289263  degrees of freedom
## AIC: 220056
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.87 1.84, 1.89 <0.001
sex_catMale 1.18 1.16, 1.21 <0.001
ALBUMIN 0.41 0.41, 0.42 <0.001
COMO_CHFY 1.58 1.54, 1.61 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_4 : age sex_cat ALBUMIN COMO_CHF COMO_DM_INS

## Area under the curve: 0.7832
## 
## Call:
## NULL
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.161257   0.011356 -190.32  < 2e-16 ***
## age           0.617511   0.006414   96.28  < 2e-16 ***
## sex_catMale   0.166359   0.010996   15.13  < 2e-16 ***
## ALBUMIN      -0.883798   0.005487 -161.07  < 2e-16 ***
## COMO_CHFY     0.461541   0.011107   41.55  < 2e-16 ***
## COMO_DM_INSY -0.064885   0.011169   -5.81 6.26e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 220012  on 289262  degrees of freedom
## AIC: 220024
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.85 1.83, 1.88 <0.001
sex_catMale 1.18 1.16, 1.21 <0.001
ALBUMIN 0.41 0.41, 0.42 <0.001
COMO_CHFY 1.59 1.55, 1.62 <0.001
COMO_DM_INSY 0.94 0.92, 0.96 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_5 : age sex_cat ALBUMIN COMO_CHF COMO_DM_INS COMO_HTN

## Area under the curve: 0.7839
## 
## Call:
## NULL
## 
## Coefficients:
##               Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)  -1.907899   0.017931 -106.404  < 2e-16 ***
## age           0.619979   0.006422   96.546  < 2e-16 ***
## sex_catMale   0.161899   0.011005   14.711  < 2e-16 ***
## ALBUMIN      -0.879503   0.005492 -160.156  < 2e-16 ***
## COMO_CHFY     0.463878   0.011117   41.727  < 2e-16 ***
## COMO_DM_INSY -0.059215   0.011179   -5.297 1.18e-07 ***
## COMO_HTNY    -0.289558   0.016070  -18.018  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 219697  on 289261  degrees of freedom
## AIC: 219711
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.86 1.84, 1.88 <0.001
sex_catMale 1.18 1.15, 1.20 <0.001
ALBUMIN 0.41 0.41, 0.42 <0.001
COMO_CHFY 1.59 1.56, 1.63 <0.001
COMO_DM_INSY 0.94 0.92, 0.96 <0.001
COMO_HTNY 0.75 0.73, 0.77 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_6 : age sex_cat ALBUMIN COMO_CHF COMO_DM_INS COMO_HTN CLM_FROM_1year_cat

## Area under the curve: 0.8056
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -1.994173   0.018289 -109.04  < 2e-16 ***
## age                 0.595808   0.006495   91.73  < 2e-16 ***
## sex_catMale         0.188199   0.011163   16.86  < 2e-16 ***
## ALBUMIN            -0.814854   0.005574 -146.19  < 2e-16 ***
## COMO_CHFY           0.417570   0.011282   37.01  < 2e-16 ***
## COMO_DM_INSY       -0.071434   0.011339   -6.30 2.98e-10 ***
## COMO_HTNY          -0.274014   0.016297  -16.81  < 2e-16 ***
## CLM_FROM_1year_cat  0.462243   0.005877   78.66  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 213184  on 289260  degrees of freedom
## AIC: 213200
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.81 1.79, 1.84 <0.001
sex_catMale 1.21 1.18, 1.23 <0.001
ALBUMIN 0.44 0.44, 0.45 <0.001
COMO_CHFY 1.52 1.49, 1.55 <0.001
COMO_DM_INSY 0.93 0.91, 0.95 <0.001
COMO_HTNY 0.76 0.74, 0.79 <0.001
CLM_FROM_1year_cat 1.59 1.57, 1.61 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_7 : age ALBUMIN COMO_CHF

## Area under the curve: 0.7819
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.093260   0.007819 -267.71   <2e-16 ***
## age          0.622924   0.006315   98.64   <2e-16 ***
## ALBUMIN     -0.877384   0.005467 -160.50   <2e-16 ***
## COMO_CHFY    0.453278   0.011033   41.08   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 220283  on 289264  degrees of freedom
## AIC: 220291
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.86 1.84, 1.89 <0.001
ALBUMIN 0.42 0.41, 0.42 <0.001
COMO_CHFY 1.57 1.54, 1.61 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_8 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT

## Area under the curve: 0.7944
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -2.121043   0.007962 -266.38   <2e-16 ***
## age               0.644748   0.006398  100.77   <2e-16 ***
## ALBUMIN          -0.859458   0.005519 -155.74   <2e-16 ***
## COMO_CHFY         0.404469   0.011155   36.26   <2e-16 ***
## IRON_SAT_PERCENT -0.345400   0.005589  -61.80   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 216292  on 289263  degrees of freedom
## AIC: 216302
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.91 1.88, 1.93 <0.001
ALBUMIN 0.42 0.42, 0.43 <0.001
COMO_CHFY 1.50 1.47, 1.53 <0.001
IRON_SAT_PERCENT 0.71 0.70, 0.72 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_9 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT HGB

## Area under the curve: 0.8008
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -2.146852   0.008062 -266.30   <2e-16 ***
## age               0.660195   0.006459  102.21   <2e-16 ***
## ALBUMIN          -0.759916   0.005785 -131.37   <2e-16 ***
## COMO_CHFY         0.423171   0.011254   37.60   <2e-16 ***
## IRON_SAT_PERCENT -0.292260   0.005645  -51.77   <2e-16 ***
## HGB              -0.311487   0.005761  -54.06   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 213317  on 289262  degrees of freedom
## AIC: 213329
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.94 1.91, 1.96 <0.001
ALBUMIN 0.47 0.46, 0.47 <0.001
COMO_CHFY 1.53 1.49, 1.56 <0.001
IRON_SAT_PERCENT 0.75 0.74, 0.75 <0.001
HGB 0.73 0.72, 0.74 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_10 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT

## Area under the curve: 0.8132
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -2.180200   0.008258 -264.02   <2e-16 ***
## age                 0.620832   0.006460   96.10   <2e-16 ***
## ALBUMIN            -0.799336   0.005594 -142.89   <2e-16 ***
## COMO_CHFY           0.362263   0.011306   32.04   <2e-16 ***
## IRON_SAT_PERCENT   -0.320349   0.005643  -56.77   <2e-16 ***
## CLM_FROM_1year_cat  0.440702   0.005911   74.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 210466  on 289262  degrees of freedom
## AIC: 210478
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.86 1.84, 1.88 <0.001
ALBUMIN 0.45 0.44, 0.45 <0.001
COMO_CHFY 1.44 1.41, 1.47 <0.001
IRON_SAT_PERCENT 0.73 0.72, 0.73 <0.001
CLM_FROM_1year_cat 1.55 1.54, 1.57 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_11 : age,ALBUMIN

## Area under the curve: 0.777
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.926110   0.006396  -301.1   <2e-16 ***
## age          0.644985   0.006267   102.9   <2e-16 ***
## ALBUMIN     -0.880964   0.005443  -161.9   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 221952  on 289265  degrees of freedom
## AIC: 221958
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.91 1.88, 1.93 <0.001
ALBUMIN 0.41 0.41, 0.42 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_12 : age ALBUMIN IRON_SAT_PERCENT

## Area under the curve: 0.791
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -1.973510   0.006598 -299.12   <2e-16 ***
## age               0.665406   0.006354  104.73   <2e-16 ***
## ALBUMIN          -0.861807   0.005499 -156.72   <2e-16 ***
## IRON_SAT_PERCENT -0.359041   0.005568  -64.48   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 217592  on 289264  degrees of freedom
## AIC: 217600
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.95 1.92, 1.97 <0.001
ALBUMIN 0.42 0.42, 0.43 <0.001
IRON_SAT_PERCENT 0.70 0.69, 0.71 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_13 : age ALBUMIN IRON_SAT_PERCENT HGB

## Area under the curve: 0.7972
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -1.991916   0.006667 -298.76   <2e-16 ***
## age               0.681436   0.006414  106.25   <2e-16 ***
## ALBUMIN          -0.764150   0.005763 -132.59   <2e-16 ***
## IRON_SAT_PERCENT -0.307330   0.005622  -54.66   <2e-16 ***
## HGB              -0.305663   0.005747  -53.19   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 214716  on 289263  degrees of freedom
## AIC: 214726
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.98 1.95, 2.00 <0.001
ALBUMIN 0.47 0.46, 0.47 <0.001
IRON_SAT_PERCENT 0.74 0.73, 0.74 <0.001
HGB 0.74 0.73, 0.74 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_14 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat

## Area under the curve: 0.8156
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -2.064292   0.007017 -294.18   <2e-16 ***
## age                 0.655180   0.006473  101.21   <2e-16 ***
## ALBUMIN            -0.714410   0.005832 -122.51   <2e-16 ***
## IRON_SAT_PERCENT   -0.287782   0.005672  -50.73   <2e-16 ***
## HGB                -0.274668   0.005782  -47.50   <2e-16 ***
## CLM_FROM_1year_cat  0.431525   0.005938   72.67   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 209195  on 289262  degrees of freedom
## AIC: 209207
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.93 1.90, 1.95 <0.001
ALBUMIN 0.49 0.48, 0.50 <0.001
IRON_SAT_PERCENT 0.75 0.74, 0.76 <0.001
HGB 0.76 0.75, 0.77 <0.001
CLM_FROM_1year_cat 1.54 1.52, 1.56 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_15 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat race_cat_4

## Area under the curve: 0.818
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)        -2.508537   0.035075  -71.518  < 2e-16 ***
## age                 0.634762   0.006549   96.931  < 2e-16 ***
## ALBUMIN            -0.711977   0.005846 -121.792  < 2e-16 ***
## IRON_SAT_PERCENT   -0.282247   0.005681  -49.686  < 2e-16 ***
## HGB                -0.286745   0.005817  -49.292  < 2e-16 ***
## CLM_FROM_1year_cat  0.424845   0.005953   71.368  < 2e-16 ***
## race_cat_4Black     0.206247   0.036868    5.594 2.22e-08 ***
## race_cat_4Other    -0.037393   0.057833   -0.647    0.518    
## race_cat_4White     0.558290   0.035312   15.810  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 208205  on 289259  degrees of freedom
## AIC: 208223
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.89 1.86, 1.91 <0.001
ALBUMIN 0.49 0.49, 0.50 <0.001
IRON_SAT_PERCENT 0.75 0.75, 0.76 <0.001
HGB 0.75 0.74, 0.76 <0.001
CLM_FROM_1year_cat 1.53 1.51, 1.55 <0.001
race_cat_4Black 1.23 1.14, 1.32 <0.001
race_cat_4Other 0.96 0.86, 1.08 0.5
race_cat_4White 1.75 1.63, 1.87 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_16 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat race_cat_4 state_cat

## Area under the curve: 0.818
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)        -2.420995   0.037655  -64.295  < 2e-16 ***
## age                 0.637712   0.006582   96.888  < 2e-16 ***
## ALBUMIN            -0.712204   0.005848 -121.791  < 2e-16 ***
## IRON_SAT_PERCENT   -0.282566   0.005683  -49.725  < 2e-16 ***
## HGB                -0.286541   0.005829  -49.158  < 2e-16 ***
## CLM_FROM_1year_cat  0.423348   0.005962   71.005  < 2e-16 ***
## race_cat_4Black     0.162747   0.037702    4.317 1.58e-05 ***
## race_cat_4Other    -0.050267   0.057882   -0.868   0.3852    
## race_cat_4White     0.525975   0.035798   14.693  < 2e-16 ***
## state_catFIPSNE    -0.131690   0.017992   -7.320 2.49e-13 ***
## state_catFIPSS     -0.029338   0.014646   -2.003   0.0452 *  
## state_catFIPSW     -0.108808   0.018206   -5.977 2.28e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 208128  on 289256  degrees of freedom
## AIC: 208152
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.89 1.87, 1.92 <0.001
ALBUMIN 0.49 0.48, 0.50 <0.001
IRON_SAT_PERCENT 0.75 0.75, 0.76 <0.001
HGB 0.75 0.74, 0.76 <0.001
CLM_FROM_1year_cat 1.53 1.51, 1.55 <0.001
race_cat_4Black 1.18 1.09, 1.27 <0.001
race_cat_4Other 0.95 0.85, 1.06 0.4
race_cat_4White 1.69 1.58, 1.82 <0.001
state_catFIPSNE 0.88 0.85, 0.91 <0.001
state_catFIPSS 0.97 0.94, 1.00 0.045
state_catFIPSW 0.90 0.87, 0.93 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_17 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat CALCIUM_UNCORRECTED

## Area under the curve: 0.8166
## 
## Call:
## NULL
## 
## Coefficients:
##                      Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         -2.068786   0.007037 -293.98   <2e-16 ***
## age                  0.641270   0.006510   98.50   <2e-16 ***
## ALBUMIN             -0.777355   0.006559 -118.51   <2e-16 ***
## IRON_SAT_PERCENT    -0.286026   0.005680  -50.35   <2e-16 ***
## HGB                 -0.278934   0.005788  -48.19   <2e-16 ***
## CLM_FROM_1year_cat   0.429547   0.005944   72.27   <2e-16 ***
## CALCIUM_UNCORRECTED  0.135079   0.006227   21.69   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 208722  on 289261  degrees of freedom
## AIC: 208736
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.90 1.87, 1.92 <0.001
ALBUMIN 0.46 0.45, 0.47 <0.001
IRON_SAT_PERCENT 0.75 0.74, 0.76 <0.001
HGB 0.76 0.75, 0.77 <0.001
CLM_FROM_1year_cat 1.54 1.52, 1.55 <0.001
CALCIUM_UNCORRECTED 1.14 1.13, 1.16 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_18 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat CALCIUM_UNCORRECTED FERRITIN

## Area under the curve: 0.8167
## 
## Call:
## NULL
## 
## Coefficients:
##                      Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         -2.069259   0.007039 -293.96   <2e-16 ***
## age                  0.635825   0.006525   97.45   <2e-16 ***
## ALBUMIN             -0.768787   0.006587 -116.72   <2e-16 ***
## IRON_SAT_PERCENT    -0.306653   0.005885  -52.10   <2e-16 ***
## HGB                 -0.264919   0.005873  -45.11   <2e-16 ***
## CLM_FROM_1year_cat   0.427847   0.005948   71.93   <2e-16 ***
## CALCIUM_UNCORRECTED  0.126133   0.006264   20.14   <2e-16 ***
## FERRITIN             0.073668   0.005282   13.95   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 208529  on 289260  degrees of freedom
## AIC: 208545
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.89 1.86, 1.91 <0.001
ALBUMIN 0.46 0.46, 0.47 <0.001
IRON_SAT_PERCENT 0.74 0.73, 0.74 <0.001
HGB 0.77 0.76, 0.78 <0.001
CLM_FROM_1year_cat 1.53 1.52, 1.55 <0.001
CALCIUM_UNCORRECTED 1.13 1.12, 1.15 <0.001
FERRITIN 1.08 1.07, 1.09 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_19 : age ALBUMIN IRON_SAT_PERCENT HGB CLM_FROM_1year_cat CALCIUM_UNCORRECTED FERRITIN PHOSPHORUS

## Area under the curve: 0.8168
## 
## Call:
## NULL
## 
## Coefficients:
##                      Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)         -2.068959   0.007039 -293.943  < 2e-16 ***
## age                  0.629128   0.006731   93.469  < 2e-16 ***
## ALBUMIN             -0.763495   0.006715 -113.706  < 2e-16 ***
## IRON_SAT_PERCENT    -0.306566   0.005886  -52.088  < 2e-16 ***
## HGB                 -0.264875   0.005872  -45.111  < 2e-16 ***
## CLM_FROM_1year_cat   0.427795   0.005949   71.916  < 2e-16 ***
## CALCIUM_UNCORRECTED  0.123506   0.006303   19.596  < 2e-16 ***
## FERRITIN             0.072153   0.005295   13.627  < 2e-16 ***
## PHOSPHORUS          -0.024473   0.006101   -4.012 6.03e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 266319  on 289267  degrees of freedom
## Residual deviance: 208513  on 289259  degrees of freedom
## AIC: 208531
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
age 1.88 1.85, 1.90 <0.001
ALBUMIN 0.47 0.46, 0.47 <0.001
IRON_SAT_PERCENT 0.74 0.73, 0.74 <0.001
HGB 0.77 0.76, 0.78 <0.001
CLM_FROM_1year_cat 1.53 1.52, 1.55 <0.001
CALCIUM_UNCORRECTED 1.13 1.12, 1.15 <0.001
FERRITIN 1.07 1.06, 1.09 <0.001
PHOSPHORUS 0.98 0.96, 0.99 <0.001
1 OR = Odds Ratio, CI = Confidence Interval