##Delta Meld as predictor

## 
## Call:
## glm(formula = as.factor(responder) ~ delta.MELD, family = binomial, 
##     data = beax1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5605  -1.2666   0.9284   1.0908   1.3017  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.0423     0.2792   0.151    0.880
## delta.MELD    0.1649     0.1132   1.456    0.145
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 85.369  on 61  degrees of freedom
## Residual deviance: 83.151  on 60  degrees of freedom
## AIC: 87.151
## 
## Number of Fisher Scoring iterations: 4

#intercepts

## # A tibble: 2 x 5
##   term        estimate std.error statistic p.value
##   <chr>          <dbl>     <dbl>     <dbl>   <dbl>
## 1 (Intercept)   0.0423     0.279     0.151   0.880
## 2 delta.MELD    0.165      0.113     1.46    0.145

#####Delta Albumin as predictor

## 
## Call:
## glm(formula = as.factor(responder) ~ delta.Albumin, family = binomial, 
##     data = beax1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6753  -1.2073   0.9306   1.0914   1.3234  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.002274   0.314466   0.007    0.994
## delta.Albumin 0.678168   0.653744   1.037    0.300
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 85.369  on 61  degrees of freedom
## Residual deviance: 84.253  on 60  degrees of freedom
## AIC: 88.253
## 
## Number of Fisher Scoring iterations: 4
## # A tibble: 2 x 5
##   term          estimate std.error statistic p.value
##   <chr>            <dbl>     <dbl>     <dbl>   <dbl>
## 1 (Intercept)    0.00227     0.314   0.00723   0.994
## 2 delta.Albumin  0.678       0.654   1.04      0.300

BEA SCORE VS MODEL

## 
## Call:
## glm(formula = responder ~ BE3A.Score, family = "binomial", data = beax1)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -2.006  -1.200   0.536   1.155   1.959  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -3.5745     1.1249  -3.178 0.001485 ** 
## BE3A.Score    1.8141     0.5322   3.409 0.000652 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 85.369  on 61  degrees of freedom
## Residual deviance: 67.402  on 60  degrees of freedom
## AIC: 71.402
## 
## Number of Fisher Scoring iterations: 4
## 
## Call:
## glm(formula = responder ~ age + c_sex + Bilirubin + c_ascites + 
##     Albumin + INR + ALT + Encephalopathy + eGFR + Platelet, family = "binomial", 
##     data = beax1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1259  -0.7637   0.1980   0.7512   1.6184  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)   
## (Intercept)     -2.789527   5.968747  -0.467  0.64025   
## age             -0.018021   0.037882  -0.476  0.63428   
## c_sexMale       -0.634485   0.801651  -0.791  0.42867   
## Bilirubin       -1.278650   0.477822  -2.676  0.00745 **
## c_ascitesSevere -0.089119   0.797281  -0.112  0.91100   
## Albumin          1.912596   1.116173   1.714  0.08662 . 
## INR             -0.839159   1.326783  -0.632  0.52708   
## ALT              0.035072   0.019849   1.767  0.07724 . 
## Encephalopathy  -1.913290   1.603119  -1.193  0.23268   
## eGFR             0.035958   0.024060   1.494  0.13505   
## Platelet        -0.001798   0.010248  -0.175  0.86071   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 85.369  on 61  degrees of freedom
## Residual deviance: 57.937  on 51  degrees of freedom
## AIC: 79.937
## 
## Number of Fisher Scoring iterations: 5

Confusion matrix of our model

## Confusion Matrix and Statistics
## 
##          response
## predicted  0  1
##         0 19  7
##         1  9 27
##                                          
##                Accuracy : 0.7419         
##                  95% CI : (0.615, 0.8447)
##     No Information Rate : 0.5484         
##     P-Value [Acc > NIR] : 0.001343       
##                                          
##                   Kappa : 0.4757         
##                                          
##  Mcnemar's Test P-Value : 0.802587       
##                                          
##             Sensitivity : 0.6786         
##             Specificity : 0.7941         
##          Pos Pred Value : 0.7308         
##          Neg Pred Value : 0.7500         
##              Prevalence : 0.4516         
##          Detection Rate : 0.3065         
##    Detection Prevalence : 0.4194         
##       Balanced Accuracy : 0.7363         
##                                          
##        'Positive' Class : 0              
## 

confusion matrix of be3a score

## Confusion Matrix and Statistics
## 
##          response
## predicted  0  1
##         0  9  3
##         1 19 31
##                                           
##                Accuracy : 0.6452          
##                  95% CI : (0.5134, 0.7626)
##     No Information Rate : 0.5484          
##     P-Value [Acc > NIR] : 0.079335        
##                                           
##                   Kappa : 0.2456          
##                                           
##  Mcnemar's Test P-Value : 0.001384        
##                                           
##             Sensitivity : 0.3214          
##             Specificity : 0.9118          
##          Pos Pred Value : 0.7500          
##          Neg Pred Value : 0.6200          
##              Prevalence : 0.4516          
##          Detection Rate : 0.1452          
##    Detection Prevalence : 0.1935          
##       Balanced Accuracy : 0.6166          
##                                           
##        'Positive' Class : 0               
## 

THUS AUC of our Model lightly better but not by much.

## 
##  DeLong's test for two correlated ROC curves
## 
## data:  g and g1
## Z = 1.0549, p-value = 0.2915
## alternative hypothesis: true difference in AUC is not equal to 0
## sample estimates:
## AUC of roc1 AUC of roc2 
##   0.8413866   0.7710084

BOth curves together

## 
## Call:
## roc.formula(formula = responder ~ BE3A.Score, data = beax1)
## 
## Data: BE3A.Score in 28 controls (responder No) < 34 cases (responder Yes).
## Area under the curve: 0.771
## [1] "1/exp^-((Intercept)*-2.7895+age*-0.018+c_sexMale*-0.6345+Bilirubin*-1.2786+c_ascitesSevere*-0.0891+Albumin*1.9126+INR*-0.8392+ALT*0.0351+Encephalopathy*-1.9133+eGFR*0.036+Platelet*-0.0018)"