Table 1 without transplant no missing, used for analysis

# table1 <- final_cohort_1_no_missing  %>% 
#   tbl_summary(
#     by = group,
#     # first row: mean (SD), second row: median [IQR]
#     statistic = all_continuous() ~ "{mean} ({sd})",
#     missing_text = "Missing"
#   ) %>%add_p() 
# 

var1 <- names(final_cohort_1_no_missing)
var1_num <- names(final_cohort_1_no_missing)[sapply(final_cohort_1_no_missing, is.numeric)]

var1_cat <- setdiff(var1,var1_num)


#create table one for expourse response#
T1 <- CreateTableOne(vars = var1,strata ="group" ,includeNA = F,addOverall = TRUE,data = final_cohort_1_no_missing, factorVars = var1_cat)

#print table one 
T1_print <-  print(T1,showAllLevels = T,missing = T,quote = FALSE, noSpaces = TRUE, printToggle = FALSE)
#save 
write.csv(T1_print, file = "/Users/to909/Desktop/Annie final/Table1_3year_0313.csv")


T1_2 <- CreateTableOne(vars = var1,strata ="group" ,includeNA = F,addOverall = TRUE,data = final_cohort_1_no_missing, factorVars = var1_cat)

#print table one 
T1_2_print <-  print(T1_2,nonnormal =var1_num,showAllLevels = T,missing = T,quote = FALSE, noSpaces = TRUE, printToggle = FALSE)
#save 
write.csv(T1_2_print, file = "/Users/to909/Desktop/Annie final/Table1_3year_nonnormal_0313.csv")



# final_cohort_1_no_missing  %>% 
#   tbl_summary(
#     by = transplant_dec_v2,
#     # first row: mean (SD), second row: median [IQR]
#     statistic = all_continuous() ~ "{median} [{p25}, {p75}]",
#     missing_text = "Missing"
#   ) %>% add_p()

feature selection cohort without transplant

3 year

Model1 : age sex_cat

## Area under the curve: 0.6635
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction alive  died
##      alive  3185   828
##      died  37568 30736
##                                           
##                Accuracy : 0.4691          
##                  95% CI : (0.4654, 0.4727)
##     No Information Rate : 0.5635          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.0459          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.97377         
##             Specificity : 0.07815         
##          Pos Pred Value : 0.44999         
##          Neg Pred Value : 0.79367         
##              Prevalence : 0.43647         
##          Detection Rate : 0.42502         
##    Detection Prevalence : 0.94451         
##       Balanced Accuracy : 0.52596         
##                                           
##        'Positive' Class : died            
## 
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.335130   0.006014 -55.725   <2e-16 ***
## age          0.619440   0.004335 142.895   <2e-16 ***
## sex_catMale  0.067073   0.007902   8.488   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 372662  on 289265  degrees of freedom
## AIC: 372668
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.86 1.84, 1.87 <0.001
sex_catMale 1.07 1.05, 1.09 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

Model2 : age sex_cat ALBUMIN

## Area under the curve: 0.7309
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.413269   0.006294  -65.66   <2e-16 ***
## age          0.607550   0.004516  134.52   <2e-16 ***
## sex_catMale  0.181555   0.008308   21.85   <2e-16 ***
## ALBUMIN     -0.690252   0.004610 -149.72   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 346451  on 289264  degrees of freedom
## AIC: 346459
## 
## Number of Fisher Scoring iterations: 3
Characteristic OR1 95% CI1 p-value
age 1.84 1.82, 1.85 <0.001
sex_catMale 1.20 1.18, 1.22 <0.001
ALBUMIN 0.50 0.50, 0.51 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

Model_3 : age sex_cat ALBUMIN COMO_CHF

## Area under the curve: 0.7374
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.569073   0.007008  -81.20   <2e-16 ***
## age          0.587618   0.004550  129.15   <2e-16 ***
## sex_catMale  0.185538   0.008352   22.21   <2e-16 ***
## ALBUMIN     -0.681172   0.004621 -147.42   <2e-16 ***
## COMO_CHFY    0.457387   0.008682   52.68   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 343675  on 289263  degrees of freedom
## AIC: 343685
## 
## Number of Fisher Scoring iterations: 3
Characteristic OR1 95% CI1 p-value
age 1.80 1.78, 1.82 <0.001
sex_catMale 1.20 1.18, 1.22 <0.001
ALBUMIN 0.51 0.50, 0.51 <0.001
COMO_CHFY 1.58 1.55, 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.7376
## 
## Call:
## NULL
## 
## Coefficients:
##               Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)  -0.593365   0.007968  -74.469  < 2e-16 ***
## age           0.592089   0.004608  128.491  < 2e-16 ***
## sex_catMale   0.187209   0.008356   22.403  < 2e-16 ***
## ALBUMIN      -0.678758   0.004634 -146.488  < 2e-16 ***
## COMO_CHFY     0.451465   0.008729   51.718  < 2e-16 ***
## COMO_DM_INSY  0.054199   0.008424    6.434 1.24e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 395983  on 289267  degrees of freedom
## Residual deviance: 343633  on 289262  degrees of freedom
## AIC: 343645
## 
## Number of Fisher Scoring iterations: 3
Characteristic OR1 95% CI1 p-value
age 1.81 1.79, 1.82 <0.001
sex_catMale 1.21 1.19, 1.23 <0.001
ALBUMIN 0.51 0.50, 0.51 <0.001
COMO_CHFY 1.57 1.54, 1.60 <0.001
COMO_DM_INSY 1.06 1.04, 1.07 <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.7383
## 
## Call:
## NULL
## 
## Coefficients:
##               Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)  -0.382622   0.013970  -27.388  < 2e-16 ***
## age           0.593702   0.004612  128.727  < 2e-16 ***
## sex_catMale   0.185036   0.008362   22.128  < 2e-16 ***
## ALBUMIN      -0.675364   0.004638 -145.616  < 2e-16 ***
## COMO_CHFY     0.453370   0.008736   51.896  < 2e-16 ***
## COMO_DM_INSY  0.059086   0.008434    7.006 2.45e-12 ***
## COMO_HTNY    -0.239224   0.013062  -18.314  < 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: 395983  on 289267  degrees of freedom
## Residual deviance: 343298  on 289261  degrees of freedom
## AIC: 343312
## 
## Number of Fisher Scoring iterations: 3
Characteristic OR1 95% CI1 p-value
age 1.81 1.79, 1.83 <0.001
sex_catMale 1.20 1.18, 1.22 <0.001
ALBUMIN 0.51 0.50, 0.51 <0.001
COMO_CHFY 1.57 1.55, 1.60 <0.001
COMO_DM_INSY 1.06 1.04, 1.08 <0.001
COMO_HTNY 0.79 0.77, 0.81 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_6 : age sex_cat ALBUMIN COMO_CHF COMO_DM_INS COMO_HTN CLM_FROM_3year_cat

## Area under the curve: 0.7489
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -0.394771   0.014096  -28.01  < 2e-16 ***
## age                 0.600553   0.004649  129.18  < 2e-16 ***
## sex_catMale         0.203954   0.008439   24.17  < 2e-16 ***
## ALBUMIN            -0.649967   0.004662 -139.42  < 2e-16 ***
## COMO_CHFY           0.432255   0.008812   49.05  < 2e-16 ***
## COMO_DM_INSY        0.051478   0.008508    6.05 1.45e-09 ***
## COMO_HTNY          -0.237231   0.013176  -18.00  < 2e-16 ***
## CLM_FROM_3year_cat  0.291374   0.004271   68.23  < 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: 395983  on 289267  degrees of freedom
## Residual deviance: 338541  on 289260  degrees of freedom
## AIC: 338557
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.82 1.81, 1.84 <0.001
sex_catMale 1.23 1.21, 1.25 <0.001
ALBUMIN 0.52 0.52, 0.53 <0.001
COMO_CHFY 1.54 1.51, 1.57 <0.001
COMO_DM_INSY 1.05 1.04, 1.07 <0.001
COMO_HTNY 0.79 0.77, 0.81 <0.001
CLM_FROM_3year_cat 1.34 1.33, 1.35 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_ : age sex_cat ALBUMIN COMO_CHF COMO_DM_INS COMO_HTN CLM_FROM_3year_cat ICU_DAYS_3year_cat

model_7 : age ALBUMIN COMO_CHF

## Area under the curve: 0.7367
## 
## Call:
## NULL
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.462695   0.005077  -91.13   <2e-16 ***
## age          0.584412   0.004540  128.73   <2e-16 ***
## ALBUMIN     -0.672429   0.004592 -146.43   <2e-16 ***
## COMO_CHFY    0.455627   0.008674   52.53   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 344170  on 289264  degrees of freedom
## AIC: 344178
## 
## Number of Fisher Scoring iterations: 3
Characteristic OR1 95% CI1 p-value
age 1.79 1.78, 1.81 <0.001
ALBUMIN 0.51 0.51, 0.52 <0.001
COMO_CHFY 1.58 1.55, 1.60 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_8 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT

## Area under the curve: 0.7424
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.456212   0.005103  -89.40   <2e-16 ***
## age               0.600756   0.004581  131.13   <2e-16 ***
## ALBUMIN          -0.650195   0.004599 -141.38   <2e-16 ***
## COMO_CHFY         0.424024   0.008735   48.54   <2e-16 ***
## IRON_SAT_PERCENT -0.222513   0.004234  -52.55   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 341365  on 289263  degrees of freedom
## AIC: 341375
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.82 1.81, 1.84 <0.001
ALBUMIN 0.52 0.52, 0.53 <0.001
COMO_CHFY 1.53 1.50, 1.55 <0.001
IRON_SAT_PERCENT 0.80 0.79, 0.81 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_9 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT HGB

## Area under the curve: 0.746
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.458925   0.005123  -89.58   <2e-16 ***
## age               0.609162   0.004599  132.46   <2e-16 ***
## ALBUMIN          -0.591095   0.004773 -123.83   <2e-16 ***
## COMO_CHFY         0.435216   0.008773   49.61   <2e-16 ***
## IRON_SAT_PERCENT -0.194505   0.004288  -45.36   <2e-16 ***
## HGB              -0.202541   0.004549  -44.52   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 339349  on 289262  degrees of freedom
## AIC: 339361
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.84 1.82, 1.86 <0.001
ALBUMIN 0.55 0.55, 0.56 <0.001
COMO_CHFY 1.55 1.52, 1.57 <0.001
IRON_SAT_PERCENT 0.82 0.82, 0.83 <0.001
HGB 0.82 0.81, 0.82 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_8 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT

## Area under the curve: 0.7424
## 
## Call:
## NULL
## 
## Coefficients:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      -0.456212   0.005103  -89.40   <2e-16 ***
## age               0.600756   0.004581  131.13   <2e-16 ***
## ALBUMIN          -0.650195   0.004599 -141.38   <2e-16 ***
## COMO_CHFY         0.424024   0.008735   48.54   <2e-16 ***
## IRON_SAT_PERCENT -0.222513   0.004234  -52.55   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 341365  on 289263  degrees of freedom
## AIC: 341375
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.82 1.81, 1.84 <0.001
ALBUMIN 0.52 0.52, 0.53 <0.001
COMO_CHFY 1.53 1.50, 1.55 <0.001
IRON_SAT_PERCENT 0.80 0.79, 0.81 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

model_10 : age ALBUMIN COMO_CHF IRON_SAT_PERCENT HGB CLM_FROM_3year_cat

## Area under the curve: 0.7554
## 
## Call:
## NULL
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -0.462347   0.005169  -89.44   <2e-16 ***
## age                 0.614898   0.004630  132.81   <2e-16 ***
## ALBUMIN            -0.569823   0.004797 -118.79   <2e-16 ***
## COMO_CHFY           0.414871   0.008841   46.92   <2e-16 ***
## IRON_SAT_PERCENT   -0.188390   0.004318  -43.63   <2e-16 ***
## HGB                -0.191165   0.004567  -41.85   <2e-16 ***
## CLM_FROM_3year_cat  0.276352   0.004299   64.28   <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: 395983  on 289267  degrees of freedom
## Residual deviance: 335138  on 289261  degrees of freedom
## AIC: 335152
## 
## Number of Fisher Scoring iterations: 4
Characteristic OR1 95% CI1 p-value
age 1.85 1.83, 1.87 <0.001
ALBUMIN 0.57 0.56, 0.57 <0.001
COMO_CHFY 1.51 1.49, 1.54 <0.001
IRON_SAT_PERCENT 0.83 0.82, 0.84 <0.001
HGB 0.83 0.82, 0.83 <0.001
CLM_FROM_3year_cat 1.32 1.31, 1.33 <0.001
1 OR = Odds Ratio, CI = Confidence Interval