data<-read.csv("C:/R_work/ECMO909.csv")
head(data)
  Unit.number   Name Sex Age     Date Year Holiday Insertion.time
1   `08243022 이영순   1  49 20090511 2009       1              1
2    13034861 윤기정   1  77 20090518 2009       1             NA
3    14186610 임지현   1  33 20090722 2009       1              1
4    14340394 이수맹   0  67 20091007 2009       1              1
5    10870744 김창길   0  56 20100212 2010       1              0
6    11071670 이영익   0  67 20100217 2010       1              0
  ECMO.duration Death Height Weight   BMI Diagnosis Smoking CAD CVA PAD DM
1             8     1     NA     NA    NA         1       2   1   1   1  1
2            24     0     NA     NA    NA         4       2   1   1   1  1
3             8     2     NA     NA    NA         3       2   1   1   1  1
4            15     0     NA     NA    NA         4       0   0   1   1  0
5             5     0   1.65     68 29.76         4       2   1   1   1  1
6             2     0   1.70     65 26.37         3       2   1   1   1  1
  HBP Indication Mode CA OHCA CPR.duration CA.ECMO.Time EKG Weaning Vent
1   1          0    0  1   NA           NA           NA   2       0    0
2   0          0    0  1   NA           NA           NA   2       0    0
3   1          1    1  1   NA           NA           NA   2       0    0
4   0          0    0  0    1           37           37   0       0    0
5   0          0    0  0    1           25           25   0       1    0
6   1          1    1  0    1          210          210   2       1    0
  Intu.day HD ICU.stay CRRT CRRT.duration CAG PCI GCS Bleeding Tamponade
1        8 30       11    0             8   1   1  15        1         1
2       27 31       31    1            NA   0   1   5        1         1
3       27 28       28    1            NA   1   1  15        0         1
4       17 17       17    0            13   0   0   3        1         1
5        5  5        5    0             3   0   0   3        1         1
6        3 43        3    1            NA   1   1  12        1         1
  Pulmo AKI Liver.failure MOF Sepsis Stroke Leg.ischemia   WBC  Hct PLT
1     1   0             1   1      1      1            1 16400 43.0 248
2     1   0             1   1      1      1            1  5230 30.1 154
3     0   1             1   0      0      1            1 18030 37.8  55
4     0   0             1   0      1      1            1  9670 36.0  54
5     1   0             1   1      1      1            1 10930 44.8 293
6     1   0             1   1      0      1            1 17950 22.3  70
  Sodium   K Lactate   PH HCO3  BUN  Cr Glucose Albumin Total..bilirubin
1  143.2 3.9    10.6 7.20 15.9 20.1 2.3     184     4.7              1.1
2  143.2 3.1      NA 7.49 22.0  6.3 1.0     153     4.2              0.5
3  148.9 3.4      NA 7.59 23.3 22.3 1.3     150     3.1              1.1
4  144.8 3.4      NA 7.26  9.0 20.1 1.5      56     2.2              0.5
5  136.8 3.2      NA 7.18 13.4 15.9 1.5     200     2.5              0.6
6  143.2 6.5      NA 7.14 10.9 48.9 2.5     488     1.6              0.3
    CRP D.dimer  CK.MB Troponin PRC FFP  PC Cryo
1  0.31    2.29  30.95    3.050   5   3  72    0
2  1.03      NA   3.97    0.298  22   7  61    0
3  8.22   11.28 219.50    1.300   4  19  40    0
4 13.34    1.03   8.91    0.088  35   9 136    0
5  0.07      NA   3.47    0.020  10   0  18    0
6 23.27    0.44   4.38    0.036  24   5  42    0
str(data)
'data.frame':   76 obs. of  67 variables:
 $ Unit.number     : Factor w/ 76 levels "`08243022","10279578",..: 1 9 13 14 3 4 66 5 11 16 ...
 $ Name            : Factor w/ 74 levels "강신윤","강신훈",..: 43 36 54 41 13 44 37 29 17 60 ...
 $ Sex             : int  1 1 1 0 0 0 0 0 0 1 ...
 $ Age             : int  49 77 33 67 56 67 76 48 67 69 ...
 $ Date            : int  20090511 20090518 20090722 20091007 20100212 20100217 20100223 20100317 20100323 20100408 ...
 $ Year            : int  2009 2009 2009 2009 2010 2010 2010 2010 2010 2010 ...
 $ Holiday         : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Insertion.time  : int  1 NA 1 1 0 0 0 1 1 0 ...
 $ ECMO.duration   : int  8 24 8 15 5 2 5 1 14 6 ...
 $ Death           : int  1 0 2 0 0 0 0 0 0 0 ...
 $ Height          : num  NA NA NA NA 1.65 1.7 1.64 1.75 1.65 1.55 ...
 $ Weight          : num  NA NA NA NA 68 65 68 75 60 53 ...
 $ BMI             : num  NA NA NA NA 29.8 ...
 $ Diagnosis       : int  1 4 3 4 4 3 4 4 4 4 ...
 $ Smoking         : int  2 2 2 0 2 2 1 0 2 2 ...
 $ CAD             : int  1 1 1 0 1 1 1 1 1 1 ...
 $ CVA             : int  1 1 1 1 1 1 1 1 1 1 ...
 $ PAD             : int  1 1 1 1 1 1 1 1 1 1 ...
 $ DM              : int  1 1 1 0 1 1 0 0 0 0 ...
 $ HBP             : int  1 0 1 0 0 1 0 0 0 1 ...
 $ Indication      : int  0 0 1 0 0 1 0 0 0 0 ...
 $ Mode            : int  0 0 1 0 0 1 0 0 0 0 ...
 $ CA              : int  1 1 1 0 0 0 1 0 1 0 ...
 $ OHCA            : int  NA NA NA 1 1 1 NA 0 NA 0 ...
 $ CPR.duration    : int  NA NA NA 37 25 210 NA 30 NA 20 ...
 $ CA.ECMO.Time    : int  NA NA NA 37 25 210 NA 240 NA 540 ...
 $ EKG             : int  2 2 2 0 0 2 2 2 2 2 ...
 $ Weaning         : int  0 0 0 0 1 1 0 1 0 1 ...
 $ Vent            : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Intu.day        : Factor w/ 28 levels "0","1","10","11",..: 26 16 16 9 23 18 27 11 10 24 ...
 $ HD              : int  30 31 28 17 5 43 12 2 20 6 ...
 $ ICU.stay        : int  11 31 28 17 5 3 12 2 20 6 ...
 $ CRRT            : int  0 1 1 0 0 1 1 1 1 0 ...
 $ CRRT.duration   : int  8 NA NA 13 3 NA NA NA NA 5 ...
 $ CAG             : int  1 0 1 0 0 1 0 1 0 1 ...
 $ PCI             : int  1 1 1 0 0 1 0 1 1 1 ...
 $ GCS             : int  15 5 15 3 3 12 4 3 3 3 ...
 $ Bleeding        : int  1 1 0 1 1 1 1 0 0 1 ...
 $ Tamponade       : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Pulmo           : int  1 1 0 0 1 1 1 1 1 1 ...
 $ AKI             : int  0 0 1 0 0 0 1 1 1 0 ...
 $ Liver.failure   : int  1 1 1 1 1 1 1 1 1 1 ...
 $ MOF             : int  1 1 0 0 1 1 0 0 0 1 ...
 $ Sepsis          : int  1 1 0 1 1 0 1 1 0 1 ...
 $ Stroke          : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Leg.ischemia    : int  1 1 1 1 1 1 1 1 1 1 ...
 $ WBC             : int  16400 5230 18030 9670 10930 17950 6790 20410 18230 21500 ...
 $ Hct             : num  43 30.1 37.8 36 44.8 22.3 40.1 32.1 26.5 30.2 ...
 $ PLT             : int  248 154 55 54 293 70 173 203 334 235 ...
 $ Sodium          : num  143 143 149 145 137 ...
 $ K               : num  3.9 3.1 3.4 3.4 3.2 6.5 3.8 6.6 4.1 5.4 ...
 $ Lactate         : num  10.6 NA NA NA NA NA NA 15.5 15.6 7.6 ...
 $ PH              : num  7.2 7.49 7.59 7.26 7.18 ...
 $ HCO3            : num  15.9 22 23.3 9 13.4 10.9 14.9 10.5 12.7 12.5 ...
 $ BUN             : num  20.1 6.3 22.3 20.1 15.9 48.9 15.8 54.6 49.9 40.7 ...
 $ Cr              : num  2.3 1 1.3 1.5 1.5 2.5 0.9 3.9 1.3 1.6 ...
 $ Glucose         : int  184 153 150 56 200 488 178 256 230 208 ...
 $ Albumin         : num  4.7 4.2 3.1 2.2 2.5 1.6 3.8 3 4.1 2.8 ...
 $ Total..bilirubin: num  1.1 0.5 1.1 0.5 0.6 0.3 1.1 0.6 0.5 1 ...
 $ CRP             : num  0.31 1.03 8.22 13.34 0.07 ...
 $ D.dimer         : num  2.29 NA 11.28 1.03 NA ...
 $ CK.MB           : num  30.95 3.97 219.5 8.91 3.47 ...
 $ Troponin        : num  3.05 0.298 1.3 0.088 0.02 ...
 $ PRC             : int  5 22 4 35 10 24 14 9 42 10 ...
 $ FFP             : int  3 7 19 9 0 5 0 0 5 0 ...
 $ PC              : int  72 61 40 136 18 42 46 0 170 54 ...
 $ Cryo            : int  0 0 0 0 0 0 0 0 0 0 ...
data1=data[data$Death<2,-c(1,2,5)]
data1$Survive=ifelse(data1$Death==0,0,1)

table(data1$Death)

 0  1 
51 22 
library(compareGroups)
data1$Sex=ifelse(data1$Sex==1,"Female","Male")
data1$Holiday=ifelse(data1$Holiday==1,"Not Holiday","Holiday")
data1$Insertion.time=ifelse(data1$Insertion.time==1,"Emergency","Elective")
data1$Death=ifelse(data1$Death==1,"Survivor","Non-survivor")
data1$Smoking=ifelse(data1$Smoking==1,"No","Yes")
data1$CAD=ifelse(data1$CAD==1,"No","Yes")
data1$CVA=ifelse(data1$CVA==1,"No","Yes")
data1$PAD=ifelse(data1$PAD==1,"No","Yes")
data1$DM=ifelse(data1$DM==1,"No","Yes")
data1$HBP=ifelse(data1$HBP==1,"No","Yes")
data1$Indication=ifelse(data1$Indication==1,"Respiratory","Cardiology")
data1$Mode=ifelse(data1$Mode==1,"VV","VA")
data1$CA=ifelse(data1$CA==1,"No","Yes")
data1$OHCA=ifelse(data1$OHCA==1,"IHCA","OHCA")
data1$EKG=ifelse(data1$EKG==0,"Asystole",
                 ifelse(data1$EKG==1,"PEA","ETC"))
data1$Diagnosis=ifelse(data1$Diagnosis==1,"Myocarditis",
                 ifelse(data1$Diagnosis==2,"PTE",
                  ifelse(data1$Diagnosis==3,"ARDS",
                   ifelse(data1$Diagnosis==4,"ACS",
                    ifelse(data1$Diagnosis==5,"pump failure","ETC")))))
data1$Weaning=ifelse(data1$Weaning==1,"Fail","Success")
data1$Vent=ifelse(data1$Vent==1,"No","Yes")
data1$CRRT=ifelse(data1$CRRT==1,"No","Yes")
data1$CAG=ifelse(data1$CAG==1,"No","Yes")
data1$PCI=ifelse(data1$PCI==1,"No","Yes")
data1$Bleeding=ifelse(data1$Bleeding==1,"No","Yes")
data1$Tamponade=ifelse(data1$Tamponade==1,"No","Yes")
data1$Pulmo=ifelse(data1$Pulmo==1,"No","Yes")
data1$AKI=ifelse(data1$AKI==1,"No","Yes")
data1$Liver.failure=ifelse(data1$Liver.failure==1,"No","Yes")
data1$MOF=ifelse(data1$MOF==1,"No","Yes")
data1$Sepsis=ifelse(data1$Sepsis==1,"No","Yes")
data1$Stroke=ifelse(data1$Stroke==1,"No","Yes")
data1$Leg.ischemia=ifelse(data1$Leg.ischemia==1,"No","Yes")
mosaicplot(~Year+Death,data=data1,color=TRUE,main="Distribution of ECMO")

plot of chunk unnamed-chunk-1

summary(data1)
     Sex                 Age            Year        Holiday         
 Length:73          Min.   : 2.0   Min.   :2009   Length:73         
 Class :character   1st Qu.:53.0   1st Qu.:2011   Class :character  
 Mode  :character   Median :65.0   Median :2012   Mode  :character  
                    Mean   :60.5   Mean   :2012                     
                    3rd Qu.:73.0   3rd Qu.:2013                     
                    Max.   :86.0   Max.   :2014                     
                                                                    
 Insertion.time     ECMO.duration      Death               Height    
 Length:73          Min.   : 1.00   Length:73          Min.   :0.91  
 Class :character   1st Qu.: 2.00   Class :character   1st Qu.:1.60  
 Mode  :character   Median : 6.00   Mode  :character   Median :1.65  
                    Mean   : 7.42                      Mean   :1.64  
                    3rd Qu.:10.00                      3rd Qu.:1.70  
                    Max.   :24.00                      Max.   :1.83  
                                                       NA's   :9     
     Weight          BMI        Diagnosis           Smoking         
 Min.   :11.5   Min.   :12.5   Length:73          Length:73         
 1st Qu.:55.0   1st Qu.:24.4   Class :character   Class :character  
 Median :60.0   Median :27.0   Mode  :character   Mode  :character  
 Mean   :60.5   Mean   :26.6                                        
 3rd Qu.:68.0   3rd Qu.:28.8                                        
 Max.   :80.0   Max.   :33.5                                        
 NA's   :7      NA's   :9                                           
     CAD                CVA                PAD           
 Length:73          Length:73          Length:73         
 Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character  
                                                         
                                                         
                                                         
                                                         
      DM                HBP             Indication       
 Length:73          Length:73          Length:73         
 Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character  
                                                         
                                                         
                                                         
                                                         
     Mode                CA                OHCA            CPR.duration  
 Length:73          Length:73          Length:73          Min.   :  2.0  
 Class :character   Class :character   Class :character   1st Qu.: 10.2  
 Mode  :character   Mode  :character   Mode  :character   Median : 22.5  
                                                          Mean   : 29.9  
                                                          3rd Qu.: 40.0  
                                                          Max.   :210.0  
                                                          NA's   :35     
  CA.ECMO.Time        EKG              Weaning              Vent          
 Min.   :   0.0   Length:73          Length:73          Length:73         
 1st Qu.:  18.5   Class :character   Class :character   Class :character  
 Median :  39.0   Mode  :character   Mode  :character   Mode  :character  
 Mean   :  95.6                                                           
 3rd Qu.:  49.5                                                           
 Max.   :1080.0                                                           
 NA's   :35                                                               
    Intu.day        HD          ICU.stay        CRRT          
 2      : 7   Min.   : 0.0   Min.   : 0.0   Length:73         
 3      : 6   1st Qu.: 4.0   1st Qu.: 4.0   Class :character  
 4      : 6   Median :19.0   Median : 9.0   Mode  :character  
 6      : 6   Mean   :23.1   Mean   :12.9                     
 1      : 5   3rd Qu.:37.0   3rd Qu.:19.0                     
 10     : 4   Max.   :86.0   Max.   :44.0                     
 (Other):39                                                   
 CRRT.duration       CAG                PCI                 GCS       
 Min.   : 1.00   Length:73          Length:73          Min.   : 3.00  
 1st Qu.: 3.00   Class :character   Class :character   1st Qu.: 4.00  
 Median : 5.00   Mode  :character   Mode  :character   Median : 7.00  
 Mean   : 6.48                                         Mean   : 8.03  
 3rd Qu.: 8.00                                         3rd Qu.:13.00  
 Max.   :20.00                                         Max.   :15.00  
 NA's   :44                                                           
   Bleeding          Tamponade            Pulmo          
 Length:73          Length:73          Length:73         
 Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character  
                                                         
                                                         
                                                         
                                                         
     AKI            Liver.failure          MOF           
 Length:73          Length:73          Length:73         
 Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character  
                                                         
                                                         
                                                         
                                                         
    Sepsis             Stroke          Leg.ischemia            WBC       
 Length:73          Length:73          Length:73          Min.   :  610  
 Class :character   Class :character   Class :character   1st Qu.: 8780  
 Mode  :character   Mode  :character   Mode  :character   Median :12510  
                                                          Mean   :13571  
                                                          3rd Qu.:16670  
                                                          Max.   :48290  
                                                                         
      Hct            PLT          Sodium          K           Lactate     
 Min.   :18.1   Min.   : 17   Min.   :128   Min.   :2.40   Min.   : 0.50  
 1st Qu.:30.7   1st Qu.: 97   1st Qu.:139   1st Qu.:3.70   1st Qu.: 1.70  
 Median :33.9   Median :142   Median :141   Median :4.00   Median : 3.05  
 Mean   :34.6   Mean   :160   Mean   :141   Mean   :4.23   Mean   : 6.15  
 3rd Qu.:40.0   3rd Qu.:214   3rd Qu.:144   3rd Qu.:4.50   3rd Qu.:10.90  
 Max.   :53.8   Max.   :414   Max.   :157   Max.   :7.60   Max.   :18.50  
                                                           NA's   :25     
       PH            HCO3           BUN             Cr          Glucose   
 Min.   :6.75   Min.   : 5.9   Min.   : 6.3   Min.   :0.40   Min.   : 50  
 1st Qu.:7.14   1st Qu.:10.9   1st Qu.:15.8   1st Qu.:0.90   1st Qu.:136  
 Median :7.27   Median :13.6   Median :21.1   Median :1.20   Median :184  
 Mean   :7.26   Mean   :14.7   Mean   :26.5   Mean   :1.46   Mean   :204  
 3rd Qu.:7.41   3rd Qu.:18.1   3rd Qu.:32.8   3rd Qu.:1.60   3rd Qu.:247  
 Max.   :7.52   Max.   :32.3   Max.   :88.9   Max.   :8.30   Max.   :488  
                                                             NA's   :1    
    Albumin     Total..bilirubin      CRP           D.dimer     
 Min.   :1.40   Min.   :0.30     Min.   : 0.02   Min.   : 0.05  
 1st Qu.:2.40   1st Qu.:0.50     1st Qu.: 0.48   1st Qu.: 1.19  
 Median :2.90   Median :1.00     Median : 2.66   Median : 4.71  
 Mean   :2.98   Mean   :1.27     Mean   : 7.27   Mean   : 9.54  
 3rd Qu.:3.70   3rd Qu.:1.40     3rd Qu.:13.50   3rd Qu.:15.23  
 Max.   :4.70   Max.   :7.10     Max.   :30.25   Max.   :45.00  
                                                 NA's   :24     
     CK.MB          Troponin           PRC             FFP      
 Min.   :  0.7   Min.   : 0.010   Min.   :  0.0   Min.   : 0.0  
 1st Qu.:  3.0   1st Qu.: 0.034   1st Qu.:  9.0   1st Qu.: 0.0  
 Median : 15.5   Median : 0.232   Median : 19.0   Median : 7.0  
 Mean   : 35.6   Mean   : 1.426   Mean   : 25.0   Mean   :11.3  
 3rd Qu.: 34.8   3rd Qu.: 1.120   3rd Qu.: 32.2   3rd Qu.:17.2  
 Max.   :300.0   Max.   :17.190   Max.   :150.0   Max.   :72.0  
 NA's   :9       NA's   :11       NA's   :1       NA's   :1     
       PC             Cryo          Survive     
 Min.   :  0.0   Min.   : 0.00   Min.   :0.000  
 1st Qu.: 10.0   1st Qu.: 0.00   1st Qu.:0.000  
 Median : 32.0   Median : 0.00   Median :0.000  
 Mean   : 48.9   Mean   : 1.82   Mean   :0.301  
 3rd Qu.: 60.2   3rd Qu.: 0.00   3rd Qu.:1.000  
 Max.   :240.0   Max.   :20.00   Max.   :1.000  
 NA's   :1       NA's   :1                      
res=compareGroups(Survive~.,data=data1)
res


-------- Summary of results by groups of 'Survive'---------


   var              N  p.value  method            selection
1  Sex              73 0.812    categorical       ALL      
2  Age              73 0.034**  continuous normal ALL      
3  Year             73 0.026**  continuous normal ALL      
4  Holiday          73 1.000    categorical       ALL      
5  Insertion.time   72 0.729    categorical       ALL      
6  ECMO.duration    73 0.170    continuous normal ALL      
7  Death            73 <0.001** categorical       ALL      
8  Height           64 0.684    continuous normal ALL      
9  Weight           66 0.910    continuous normal ALL      
10 BMI              64 0.629    continuous normal ALL      
11 Diagnosis        73 0.101    categorical       ALL      
12 Smoking          73 0.476    categorical       ALL      
13 CAD              73 0.320    categorical       ALL      
14 CVA              73 1.000    categorical       ALL      
15 PAD              73 .        categorical       ALL      
16 DM               73 0.196    categorical       ALL      
17 HBP              73 0.188    categorical       ALL      
18 Indication       73 0.747    categorical       ALL      
19 Mode             73 0.747    categorical       ALL      
20 CA               73 0.132    categorical       ALL      
21 OHCA             38 1.000    categorical       ALL      
22 CPR.duration     38 0.065*   continuous normal ALL      
23 CA.ECMO.Time     38 0.074*   continuous normal ALL      
24 EKG              73 0.041**  categorical       ALL      
25 Weaning          73 <0.001** categorical       ALL      
26 Vent             73 0.088*   categorical       ALL      
27 HD               73 <0.001** continuous normal ALL      
28 ICU.stay         73 <0.001** continuous normal ALL      
29 CRRT             73 0.243    categorical       ALL      
30 CRRT.duration    29 0.175    continuous normal ALL      
31 CAG              73 0.231    categorical       ALL      
32 PCI              73 0.476    categorical       ALL      
33 GCS              73 0.002**  continuous normal ALL      
34 Bleeding         73 0.578    categorical       ALL      
35 Tamponade        73 1.000    categorical       ALL      
36 Pulmo            73 0.714    categorical       ALL      
37 AKI              73 0.342    categorical       ALL      
38 Liver.failure    73 0.308    categorical       ALL      
39 MOF              73 0.029**  categorical       ALL      
40 Sepsis           73 1.000    categorical       ALL      
41 Stroke           73 0.088*   categorical       ALL      
42 Leg.ischemia     73 0.579    categorical       ALL      
43 WBC              73 0.632    continuous normal ALL      
44 Hct              73 0.604    continuous normal ALL      
45 PLT              73 0.429    continuous normal ALL      
46 Sodium           73 0.441    continuous normal ALL      
47 K                73 0.017**  continuous normal ALL      
48 Lactate          48 0.046**  continuous normal ALL      
49 PH               73 0.103    continuous normal ALL      
50 HCO3             73 0.048**  continuous normal ALL      
51 BUN              73 0.018**  continuous normal ALL      
52 Cr               73 0.004**  continuous normal ALL      
53 Glucose          72 0.392    continuous normal ALL      
54 Albumin          73 0.676    continuous normal ALL      
55 Total..bilirubin 73 0.532    continuous normal ALL      
56 CRP              73 0.161    continuous normal ALL      
57 D.dimer          49 0.796    continuous normal ALL      
58 CK.MB            64 0.829    continuous normal ALL      
59 Troponin         62 0.556    continuous normal ALL      
60 PRC              72 0.219    continuous normal ALL      
61 FFP              72 0.381    continuous normal ALL      
62 PC               72 0.087*   continuous normal ALL      
63 Cryo             72 0.787    continuous normal ALL      
-----
Signif. codes:  0 '**' 0.05 '*' 0.1 ' ' 1 
createTable(res)

--------Summary descriptives table by 'Survive'---------

____________________________________________________ 
                      0            1       p.overall 
                     N=51         N=22               
<U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF> 
Sex:                                         0.812   
    Female        20 (39.2%)   10 (45.5%)            
    Male          31 (60.8%)   12 (54.5%)            
Age              63.6 (13.6)  53.3 (19.7)    0.034   
Year             2012 (1.41)  2013 (1.44)    0.026   
Holiday:                                     1.000   
    Holiday       7 (13.7%)    3 (13.6%)             
    Not Holiday   44 (86.3%)   19 (86.4%)            
Insertion.time:                              0.729   
    Elective      28 (56.0%)   14 (63.6%)            
    Emergency     22 (44.0%)   8 (36.4%)             
ECMO.duration    6.86 (6.52)  8.73 (4.61)    0.170   
Death:                                      <0.001   
    Non-survivor  51 (100%)    0 (0.00%)             
    Survivor      0 (0.00%)    22 (100%)             
Height           1.64 (0.08)  1.62 (0.19)    0.684   
Weight           60.6 (8.69)  60.2 (14.5)    0.910   
BMI              26.7 (3.50)  26.2 (4.04)    0.629   
Diagnosis:                                   0.101   
    ACS           26 (51.0%)   5 (22.7%)             
    ARDS          8 (15.7%)    5 (22.7%)             
    ETC           6 (11.8%)    2 (9.09%)             
    Myocarditis   2 (3.92%)    4 (18.2%)             
    PTE           4 (7.84%)    4 (18.2%)             
    pump failure  5 (9.80%)    2 (9.09%)             
Smoking:                                     0.476   
    No            6 (11.8%)    4 (18.2%)             
    Yes           45 (88.2%)   18 (81.8%)            
CAD:                                         0.320   
    No            40 (78.4%)   20 (90.9%)            
    Yes           11 (21.6%)   2 (9.09%)             
CVA:                                         1.000   
    No            48 (94.1%)   21 (95.5%)            
    Yes           3 (5.88%)    1 (4.55%)             
PAD: No           51 (100%)    22 (100%)       .     
DM:                                          0.196   
    No            35 (68.6%)   19 (86.4%)            
    Yes           16 (31.4%)   3 (13.6%)             
HBP:                                         0.188   
    No            27 (52.9%)   16 (72.7%)            
    Yes           24 (47.1%)   6 (27.3%)             
Indication:                                  0.747   
    Cardiology    42 (82.4%)   17 (77.3%)            
    Respiratory   9 (17.6%)    5 (22.7%)             
Mode:                                        0.747   
    VA            42 (82.4%)   17 (77.3%)            
    VV            9 (17.6%)    5 (22.7%)             
CA:                                          0.132   
    No            21 (41.2%)   14 (63.6%)            
    Yes           30 (58.8%)   8 (36.4%)             
OHCA:                                        1.000   
    IHCA          26 (86.7%)   7 (87.5%)             
    OHCA          4 (13.3%)    1 (12.5%)             
CPR.duration     33.4 (37.2)  16.9 (15.0)    0.065   
CA.ECMO.Time      112 (224)   35.2 (16.3)    0.074   
EKG:                                         0.041   
    Asystole      15 (29.4%)   1 (4.55%)             
    ETC           33 (64.7%)   20 (90.9%)            
    PEA           3 (5.88%)    1 (4.55%)             
Weaning:                                    <0.001   
    Fail          43 (84.3%)   0 (0.00%)             
    Success       8 (15.7%)    22 (100%)             
Vent:                                        0.088   
    No            0 (0.00%)    2 (9.09%)             
    Yes           51 (100%)    20 (90.9%)            
HD               15.0 (15.6)  41.8 (17.3)   <0.001   
ICU.stay         9.92 (9.44)  19.7 (9.61)   <0.001   
CRRT:                                        0.243   
    No            28 (54.9%)   16 (72.7%)            
    Yes           23 (45.1%)   6 (27.3%)             
CRRT.duration    5.78 (4.65)  9.17 (5.00)    0.175   
CAG:                                         0.231   
    No            23 (45.1%)   14 (63.6%)            
    Yes           28 (54.9%)   8 (36.4%)             
PCI:                                         0.476   
    No            36 (70.6%)   18 (81.8%)            
    Yes           15 (29.4%)   4 (18.2%)             
GCS              6.88 (4.25)  10.7 (4.51)    0.002   
Bleeding:                                    0.578   
    No            32 (62.7%)   16 (72.7%)            
    Yes           19 (37.3%)   6 (27.3%)             
Tamponade:                                   1.000   
    No            48 (94.1%)   21 (95.5%)            
    Yes           3 (5.88%)    1 (4.55%)             
Pulmo:                                       0.714   
    No            44 (86.3%)   20 (90.9%)            
    Yes           7 (13.7%)    2 (9.09%)             
AKI:                                         0.342   
    No            27 (52.9%)   15 (68.2%)            
    Yes           24 (47.1%)   7 (31.8%)             
Liver.failure:                               0.308   
    No            47 (92.2%)   22 (100%)             
    Yes           4 (7.84%)    0 (0.00%)             
MOF:                                         0.029   
    No            35 (68.6%)   21 (95.5%)            
    Yes           16 (31.4%)   1 (4.55%)             
Sepsis:                                      1.000   
    No            45 (88.2%)   19 (86.4%)            
    Yes           6 (11.8%)    3 (13.6%)             
Stroke:                                      0.088   
    No            51 (100%)    20 (90.9%)            
    Yes           0 (0.00%)    2 (9.09%)             
Leg.ischemia:                                0.579   
    No            49 (96.1%)   20 (90.9%)            
    Yes           2 (3.92%)    2 (9.09%)             
WBC              13814 (8323) 13009 (5637)   0.632   
Hct              34.3 (7.27)  35.3 (7.98)    0.604   
PLT               166 (100)    148 (78.2)    0.429   
Sodium            142 (5.28)   141 (5.91)    0.441   
K                4.36 (1.08)  3.93 (0.45)    0.017   
Lactate          7.13 (5.48)  4.00 (4.52)    0.046   
PH               7.24 (0.16)  7.32 (0.21)    0.103   
HCO3             13.8 (5.12)  17.0 (6.54)    0.048   
BUN              29.0 (17.7)  20.9 (10.3)    0.018   
Cr               1.64 (1.23)  1.05 (0.41)    0.004   
Glucose           209 (108)    192 (59.6)    0.392   
Albumin          2.95 (0.86)  3.04 (0.78)    0.676   
Total..bilirubin 1.21 (1.37)  1.42 (1.26)    0.532   
CRP              6.19 (7.69)  9.78 (10.6)    0.161   
D.dimer          9.86 (12.2)  8.94 (11.4)    0.796   
CK.MB            36.8 (47.6)  33.0 (72.6)    0.829   
Troponin         1.56 (3.52)  1.13 (2.17)    0.556   
PRC              27.0 (27.6)  20.1 (18.2)    0.219   
FFP              12.2 (14.3)  9.33 (11.4)    0.381   
PC               54.6 (62.3)  35.0 (33.2)    0.087   
Cryo             1.90 (4.88)  1.62 (3.61)    0.787   
<U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF> 
data1$EKG1=ifelse(data1$EKG=="ETC","ETC", "Asystole/PEA")

head(data1)
     Sex Age Year     Holiday Insertion.time ECMO.duration        Death
1 Female  49 2009 Not Holiday      Emergency             8     Survivor
2 Female  77 2009 Not Holiday           <NA>            24 Non-survivor
4   Male  67 2009 Not Holiday      Emergency            15 Non-survivor
5   Male  56 2010 Not Holiday       Elective             5 Non-survivor
6   Male  67 2010 Not Holiday       Elective             2 Non-survivor
7   Male  76 2010 Not Holiday       Elective             5 Non-survivor
  Height Weight   BMI   Diagnosis Smoking CAD CVA PAD  DM HBP  Indication
1     NA     NA    NA Myocarditis     Yes  No  No  No  No  No  Cardiology
2     NA     NA    NA         ACS     Yes  No  No  No  No Yes  Cardiology
4     NA     NA    NA         ACS     Yes Yes  No  No Yes Yes  Cardiology
5   1.65     68 29.76         ACS     Yes  No  No  No  No Yes  Cardiology
6   1.70     65 26.37        ARDS     Yes  No  No  No  No  No Respiratory
7   1.64     68 30.21         ACS      No  No  No  No Yes Yes  Cardiology
  Mode  CA OHCA CPR.duration CA.ECMO.Time      EKG Weaning Vent Intu.day
1   VA  No <NA>           NA           NA      ETC Success  Yes        8
2   VA  No <NA>           NA           NA      ETC Success  Yes       27
4   VA Yes IHCA           37           37 Asystole Success  Yes       17
5   VA Yes IHCA           25           25 Asystole    Fail  Yes        5
6   VV Yes IHCA          210          210      ETC    Fail  Yes        3
7   VA  No <NA>           NA           NA      ETC Success  Yes        9
  HD ICU.stay CRRT CRRT.duration CAG PCI GCS Bleeding Tamponade Pulmo AKI
1 30       11  Yes             8  No  No  15       No        No    No Yes
2 31       31   No            NA Yes  No   5       No        No    No Yes
4 17       17  Yes            13 Yes Yes   3       No        No   Yes Yes
5  5        5  Yes             3 Yes Yes   3       No        No    No Yes
6 43        3   No            NA  No  No  12       No        No    No Yes
7 12       12   No            NA Yes Yes   4       No        No    No  No
  Liver.failure MOF Sepsis Stroke Leg.ischemia   WBC  Hct PLT Sodium   K
1            No  No     No     No           No 16400 43.0 248  143.2 3.9
2            No  No     No     No           No  5230 30.1 154  143.2 3.1
4            No Yes     No     No           No  9670 36.0  54  144.8 3.4
5            No  No     No     No           No 10930 44.8 293  136.8 3.2
6            No  No    Yes     No           No 17950 22.3  70  143.2 6.5
7            No Yes     No     No           No  6790 40.1 173  140.5 3.8
  Lactate   PH HCO3  BUN  Cr Glucose Albumin Total..bilirubin   CRP
1    10.6 7.20 15.9 20.1 2.3     184     4.7              1.1  0.31
2      NA 7.49 22.0  6.3 1.0     153     4.2              0.5  1.03
4      NA 7.26  9.0 20.1 1.5      56     2.2              0.5 13.34
5      NA 7.18 13.4 15.9 1.5     200     2.5              0.6  0.07
6      NA 7.14 10.9 48.9 2.5     488     1.6              0.3 23.27
7      NA 7.29 14.9 15.8 0.9     178     3.8              1.1  0.29
  D.dimer CK.MB Troponin PRC FFP  PC Cryo Survive         EKG1
1    2.29 30.95    3.050   5   3  72    0       1          ETC
2      NA  3.97    0.298  22   7  61    0       0          ETC
4    1.03  8.91    0.088  35   9 136    0       0 Asystole/PEA
5      NA  3.47    0.020  10   0  18    0       0 Asystole/PEA
6    0.44  4.38    0.036  24   5  42    0       0          ETC
7      NA 17.70    0.674  14   0  46    0       0          ETC
boxplot(K~Survive,data=data1)

plot of chunk unnamed-chunk-1

boxplot(PH~Survive,data=data1)

plot of chunk unnamed-chunk-1

boxplot(HCO3~Survive,data=data1)

plot of chunk unnamed-chunk-1

data2=data1[data1$EKG1=="ETC",]
data3=data1[data1$EKG1!="ETC",]

cor.test(data1$K,data1$PH)

    Pearson's product-moment correlation

data:  data1$K and data1$PH
t = -0.9558, df = 71, p-value = 0.3424
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.3341  0.1205
sample estimates:
    cor 
-0.1127 
cor.test(data1$K,data1$HCO3)

    Pearson's product-moment correlation

data:  data1$K and data1$HCO3
t = -1.81, df = 71, p-value = 0.07445
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.41985  0.02101
sample estimates:
    cor 
-0.2101 
Mo=glm(Survive~Age+DM+Diagnosis+GCS+K+HCO3+PH+Cr+CRP+EKG1,data=data1)
summary(Mo)

Call:
glm(formula = Survive ~ Age + DM + Diagnosis + GCS + K + HCO3 + 
    PH + Cr + CRP + EKG1, data = data1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.7749  -0.2645  -0.0688   0.2569   0.7973  

Coefficients:
                      Estimate Std. Error t value Pr(>|t|)   
(Intercept)            1.25388    2.72574    0.46   0.6472   
Age                   -0.00773    0.00359   -2.15   0.0356 * 
DMYes                  0.03937    0.12290    0.32   0.7499   
DiagnosisARDS         -0.01733    0.17079   -0.10   0.9195   
DiagnosisETC          -0.07112    0.18399   -0.39   0.7005   
DiagnosisMyocarditis   0.12154    0.21525    0.56   0.5745   
DiagnosisPTE           0.24032    0.17690    1.36   0.1796   
Diagnosispump failure -0.17644    0.19142   -0.92   0.3605   
GCS                    0.03447    0.01205    2.86   0.0059 **
K                     -0.04917    0.06984   -0.70   0.4843   
HCO3                   0.01551    0.01264    1.23   0.2248   
PH                    -0.11567    0.38713   -0.30   0.7662   
Cr                    -0.03855    0.06589   -0.58   0.5608   
CRP                    0.00234    0.00736    0.32   0.7518   
EKG1ETC                0.10826    0.13263    0.82   0.4177   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1674)

    Null deviance: 15.3699  on 72  degrees of freedom
Residual deviance:  9.7091  on 58  degrees of freedom
AIC: 91.9

Number of Fisher Scoring iterations: 2
Mo1=glm(Survive~Age+GCS+K+HCO3+EKG1,data=data1)
summary(Mo1)

Call:
glm(formula = Survive ~ Age + GCS + K + HCO3 + EKG1, data = data1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.5760  -0.3013  -0.0797   0.3036   0.8899  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  0.69950    0.34699    2.02   0.0478 * 
Age         -0.00794    0.00292   -2.72   0.0084 **
GCS          0.03222    0.01033    3.12   0.0027 **
K           -0.10053    0.05115   -1.97   0.0535 . 
HCO3         0.01095    0.00911    1.20   0.2338   
EKG1ETC      0.12062    0.11768    1.02   0.3091   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1572)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 10.534  on 67  degrees of freedom
AIC: 79.85

Number of Fisher Scoring iterations: 2
Mo2=glm(Survive~Age+GCS+K+EKG1,data=data1)
summary(Mo2)

Call:
glm(formula = Survive ~ Age + GCS + K + EKG1, data = data1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.6175  -0.2880  -0.0973   0.3360   0.9145  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  0.88030    0.31367    2.81   0.0065 **
Age         -0.00784    0.00293   -2.68   0.0093 **
GCS          0.03225    0.01037    3.11   0.0027 **
K           -0.11607    0.04965   -2.34   0.0223 * 
EKG1ETC      0.17617    0.10856    1.62   0.1093   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1582)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 10.761  on 68  degrees of freedom
AIC: 79.4

Number of Fisher Scoring iterations: 2
Mo3=glm(Survive~Age+GCS+K,data=data1)
summary(Mo3)

Call:
glm(formula = Survive ~ Age + GCS + K, data = data1)

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-0.634  -0.260  -0.125   0.325   0.855  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.00046    0.30839    3.24   0.0018 ** 
Age         -0.00857    0.00293   -2.92   0.0047 ** 
GCS          0.03591    0.01024    3.51   0.0008 ***
K           -0.11078    0.05012   -2.21   0.0304 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.162)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 11.177  on 69  degrees of freedom
AIC: 80.18

Number of Fisher Scoring iterations: 2
anova(Mo3,Mo2,Mo1,Mo,test="Chisq")
Analysis of Deviance Table

Model 1: Survive ~ Age + GCS + K
Model 2: Survive ~ Age + GCS + K + EKG1
Model 3: Survive ~ Age + GCS + K + HCO3 + EKG1
Model 4: Survive ~ Age + DM + Diagnosis + GCS + K + HCO3 + PH + Cr + CRP + 
    EKG1
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1        69      11.18                     
2        68      10.76  1    0.417     0.11
3        67      10.53  1    0.227     0.24
4        58       9.71  9    0.825     0.84
model=glm(Survive~Age+DM+GCS+CA+K+HCO3+PH+Cr+CRP+EKG1,data=data1)
summary(model)

Call:
glm(formula = Survive ~ Age + DM + GCS + CA + K + HCO3 + PH + 
    Cr + CRP + EKG1, data = data1)

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-0.548  -0.303  -0.053   0.326   0.892  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  1.47879    2.60637    0.57   0.5725   
Age         -0.00709    0.00321   -2.21   0.0310 * 
DMYes        0.03011    0.12038    0.25   0.8033   
GCS          0.03605    0.01172    3.08   0.0031 **
CAYes        0.11194    0.14165    0.79   0.4324   
K           -0.08269    0.06730   -1.23   0.2239   
HCO3         0.01238    0.01248    0.99   0.3253   
PH          -0.14453    0.37088   -0.39   0.6981   
Cr          -0.03774    0.06479   -0.58   0.5623   
CRP          0.00395    0.00643    0.61   0.5412   
EKG1ETC      0.19206    0.14599    1.32   0.1932   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1662)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 10.305  on 62  degrees of freedom
AIC: 88.25

Number of Fisher Scoring iterations: 2
exp(coef(model))
(Intercept)         Age       DMYes         GCS       CAYes           K 
     4.3876      0.9929      1.0306      1.0367      1.1185      0.9206 
       HCO3          PH          Cr         CRP     EKG1ETC 
     1.0125      0.8654      0.9630      1.0040      1.2117 
confint(model)
                2.5 %    97.5 %
(Intercept) -3.629609  6.587183
Age         -0.013385 -0.000793
DMYes       -0.205823  0.266048
GCS          0.013088  0.059010
CAYes       -0.165693  0.389580
K           -0.214599  0.049225
HCO3        -0.012088  0.036841
PH          -0.871452  0.582387
Cr          -0.164725  0.089240
CRP         -0.008649  0.016548
EKG1ETC     -0.094087  0.478200
exp(confint(model))
              2.5 %   97.5 %
(Intercept) 0.02653 725.7335
Age         0.98670   0.9992
DMYes       0.81398   1.3048
GCS         1.01317   1.0608
CAYes       0.84731   1.4764
K           0.80687   1.0505
HCO3        0.98799   1.0375
PH          0.41834   1.7903
Cr          0.84813   1.0933
CRP         0.99139   1.0167
EKG1ETC     0.91020   1.6132
model1=glm(Survive~Age+GCS+HCO3+K+EKG1,data=data1)
summary(model1)

Call:
glm(formula = Survive ~ Age + GCS + HCO3 + K + EKG1, data = data1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.5760  -0.3013  -0.0797   0.3036   0.8899  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  0.69950    0.34699    2.02   0.0478 * 
Age         -0.00794    0.00292   -2.72   0.0084 **
GCS          0.03222    0.01033    3.12   0.0027 **
HCO3         0.01095    0.00911    1.20   0.2338   
K           -0.10053    0.05115   -1.97   0.0535 . 
EKG1ETC      0.12062    0.11768    1.02   0.3091   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1572)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 10.534  on 67  degrees of freedom
AIC: 79.85

Number of Fisher Scoring iterations: 2
model2=glm(Survive~Age+GCS+K+EKG1,data=data1)
summary(model2)

Call:
glm(formula = Survive ~ Age + GCS + K + EKG1, data = data1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.6175  -0.2880  -0.0973   0.3360   0.9145  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  0.88030    0.31367    2.81   0.0065 **
Age         -0.00784    0.00293   -2.68   0.0093 **
GCS          0.03225    0.01037    3.11   0.0027 **
K           -0.11607    0.04965   -2.34   0.0223 * 
EKG1ETC      0.17617    0.10856    1.62   0.1093   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1582)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 10.761  on 68  degrees of freedom
AIC: 79.4

Number of Fisher Scoring iterations: 2
anova(model2,model1,model,test="Chisq")
Analysis of Deviance Table

Model 1: Survive ~ Age + GCS + K + EKG1
Model 2: Survive ~ Age + GCS + HCO3 + K + EKG1
Model 3: Survive ~ Age + DM + GCS + CA + K + HCO3 + PH + Cr + CRP + EKG1
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1        68       10.8                     
2        67       10.5  1    0.227     0.24
3        62       10.3  5    0.228     0.93
kmodel=glm(Survive~K,data=data1)
summary(kmodel)

Call:
glm(formula = Survive ~ K, data = data1)

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-0.490  -0.336  -0.253   0.623   0.747  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   0.7380     0.2442    3.02   0.0035 **
K            -0.1031     0.0563   -1.83   0.0712 . 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.2067)

    Null deviance: 15.370  on 72  degrees of freedom
Residual deviance: 14.676  on 71  degrees of freedom
AIC: 96.06

Number of Fisher Scoring iterations: 2
exp(coef(model2))
(Intercept)         Age         GCS           K     EKG1ETC 
     2.4116      0.9922      1.0328      0.8904      1.1926 
confint(model2)
               2.5 %    97.5 %
(Intercept)  0.26552  1.495074
Age         -0.01359 -0.002097
GCS          0.01194  0.052567
K           -0.21337 -0.018765
EKG1ETC     -0.03661  0.388951
exp(confint(model2))
             2.5 % 97.5 %
(Intercept) 1.3041 4.4597
Age         0.9865 0.9979
GCS         1.0120 1.0540
K           0.8079 0.9814
EKG1ETC     0.9641 1.4754
plot(Survive~K,data=data1)

plot of chunk unnamed-chunk-1

plot(Survive~K,data=data2)

plot of chunk unnamed-chunk-1

plot(Survive~K,data=data3)

curve(predict(kmodel,data.frame(K=x),type="resp"),add=TRUE,col="blue",lty=3)

plot of chunk unnamed-chunk-1

predict.data = seq(3,8,0.1)
y=plogis(kmodel$coefficients[1]+kmodel$coefficient[2]*predict.data)
xy=data.frame(K=predict.data)
yhat=predict(kmodel,xy,type="link",se.fit=TRUE)
yhat
$fit
        1         2         3         4         5         6         7 
 0.428538  0.418224  0.407909  0.397594  0.387279  0.376964  0.366650 
        8         9        10        11        12        13        14 
 0.356335  0.346020  0.335705  0.325391  0.315076  0.304761  0.294446 
       15        16        17        18        19        20        21 
 0.284131  0.273817  0.263502  0.253187  0.242872  0.232558  0.222243 
       22        23        24        25        26        27        28 
 0.211928  0.201613  0.191298  0.180984  0.170669  0.160354  0.150039 
       29        30        31        32        33        34        35 
 0.139725  0.129410  0.119095  0.108780  0.098465  0.088151  0.077836 
       36        37        38        39        40        41        42 
 0.067521  0.057206  0.046891  0.036577  0.026262  0.015947  0.005632 
       43        44        45        46        47        48        49 
-0.004682 -0.014997 -0.025312 -0.035627 -0.045942 -0.056256 -0.066571 
       50        51 
-0.076886 -0.087201 

$se.fit
      1       2       3       4       5       6       7       8       9 
0.08748 0.08308 0.07883 0.07478 0.07093 0.06734 0.06405 0.06109 0.05853 
     10      11      12      13      14      15      16      17      18 
0.05642 0.05481 0.05374 0.05325 0.05335 0.05404 0.05530 0.05709 0.05936 
     19      20      21      22      23      24      25      26      27 
0.06206 0.06514 0.06854 0.07222 0.07614 0.08027 0.08457 0.08901 0.09359 
     28      29      30      31      32      33      34      35      36 
0.09827 0.10305 0.10792 0.11285 0.11784 0.12290 0.12799 0.13314 0.13832 
     37      38      39      40      41      42      43      44      45 
0.14353 0.14878 0.15405 0.15935 0.16466 0.17000 0.17536 0.18073 0.18612 
     46      47      48      49      50      51 
0.19153 0.19694 0.20237 0.20781 0.21326 0.21872 

$residual.scale
[1] 0.4547
upperlogit=yhat$fit+1.96*yhat$se.fit
lowerlogit=yhat$fit-1.96*yhat$se.fit
ucl=plogis(upperlogit)
lcl=plogis(lowerlogit)
plot(predict.data,y,type="l",ylim=c(0,1),ylab="Predicted probability of survival",xlab="K")
lines(predict.data,ucl,lty=2,lwd=2)
lines(predict.data,lcl,lty=2,lwd=2)

plot of chunk unnamed-chunk-1

data4=data[data$CA<1,-c(1,2,5)]
data4$Survive4=ifelse(data4$Death==0,0,1)
table(data4$Death)

 0  1  2 
30  8  1 
data4$Sex=ifelse(data4$Sex==1,"Female","Male")
data4$Holiday=ifelse(data4$Holiday==1,"Not Holiday","Holiday")
data4$Insertion.time=ifelse(data4$Insertion.time==1,"Emergency","Elective")
data4$Death=ifelse(data4$Death==1,"Survivor","Non-survivor")
data4$Smoking=ifelse(data4$Smoking==1,"No","Yes")
data4$CAD=ifelse(data4$CAD==1,"No","Yes")
data4$CVA=ifelse(data4$CVA==1,"No","Yes")
data4$PAD=ifelse(data4$PAD==1,"No","Yes")
data4$DM=ifelse(data4$DM==1,"No","Yes")
data4$HBP=ifelse(data4$HBP==1,"No","Yes")
data4$Indication=ifelse(data4$Indication==1,"Respiratory","Cardiology")
data4$Mode=ifelse(data4$Mode==1,"VV","VA")
data4$CA=ifelse(data4$CA==1,"No","Yes")
data4$OHCA=ifelse(data4$OHCA==1,"IHCA","OHCA")
data4$EKG=ifelse(data4$EKG==0,"Asystole",
                 ifelse(data4$EKG==1,"PEA","ETC"))
data4$Diagnosis=ifelse(data4$Diagnosis==1,"Myocarditis",
                 ifelse(data4$Diagnosis==2,"PTE",
                  ifelse(data4$Diagnosis==3,"ARDS",
                   ifelse(data4$Diagnosis==4,"ACS",
                    ifelse(data4$Diagnosis==5,"pump failure","ETC")))))
data4$Weaning=ifelse(data4$Weaning==1,"Fail","Success")
data4$Vent=ifelse(data4$Vent==1,"No","Yes")
data4$CRRT=ifelse(data4$CRRT==1,"No","Yes")
data4$CAG=ifelse(data4$CAG==1,"No","Yes")
data4$PCI=ifelse(data4$PCI==1,"No","Yes")
data4$Bleeding=ifelse(data4$Bleeding==1,"No","Yes")
data4$Tamponade=ifelse(data4$Tamponade==1,"No","Yes")
data4$Pulmo=ifelse(data4$Pulmo==1,"No","Yes")
data4$AKI=ifelse(data4$AKI==1,"No","Yes")
data4$Liver.failure=ifelse(data4$Liver.failure==1,"No","Yes")
data4$MOF=ifelse(data4$MOF==1,"No","Yes")
data4$Sepsis=ifelse(data4$Sepsis==1,"No","Yes")
data4$Stroke=ifelse(data4$Stroke==1,"No","Yes")
data4$Leg.ischemia=ifelse(data4$Leg.ischemia==1,"No","Yes")

res=compareGroups(Survive4~.,data=data4)
res


-------- Summary of results by groups of 'Survive4'---------


   var              N  p.value  method            selection
1  Sex              39 0.266    categorical       ALL      
2  Age              39 0.125    continuous normal ALL      
3  Year             39 0.160    continuous normal ALL      
4  Holiday          39 0.572    categorical       ALL      
5  Insertion.time   39 0.704    categorical       ALL      
6  ECMO.duration    39 0.035**  continuous normal ALL      
7  Death            39 <0.001** categorical       ALL      
8  Height           32 0.156    continuous normal ALL      
9  Weight           34 0.688    continuous normal ALL      
10 BMI              32 0.205    continuous normal ALL      
11 Diagnosis        39 0.089*   categorical       ALL      
12 Smoking          39 1.000    categorical       ALL      
13 CAD              39 0.400    categorical       ALL      
14 CVA              39 1.000    categorical       ALL      
15 PAD              39 .        categorical       ALL      
16 DM               39 0.228    categorical       ALL      
17 HBP              39 0.251    categorical       ALL      
18 Indication       39 1.000    categorical       ALL      
19 Mode             39 1.000    categorical       ALL      
20 CA               39 .        categorical       ALL      
21 OHCA             39 1.000    categorical       ALL      
22 CPR.duration     39 0.116    continuous normal ALL      
23 CA.ECMO.Time     39 0.075*   continuous normal ALL      
24 EKG              39 0.088*   categorical       ALL      
25 Weaning          39 <0.001** categorical       ALL      
26 Vent             39 .        categorical       ALL      
27 HD               39 <0.001** continuous normal ALL      
28 ICU.stay         39 0.001**  continuous normal ALL      
29 CRRT             39 0.464    categorical       ALL      
30 CRRT.duration    18 0.489    continuous normal ALL      
31 CAG              39 0.251    categorical       ALL      
32 PCI              39 0.228    categorical       ALL      
33 GCS              39 0.114    continuous normal ALL      
34 Bleeding         39 0.225    categorical       ALL      
35 Tamponade        39 1.000    categorical       ALL      
36 Pulmo            39 0.318    categorical       ALL      
37 AKI              39 0.464    categorical       ALL      
38 Liver.failure    39 1.000    categorical       ALL      
39 MOF              39 0.160    categorical       ALL      
40 Sepsis           39 0.572    categorical       ALL      
41 Stroke           39 0.231    categorical       ALL      
42 Leg.ischemia     39 0.556    categorical       ALL      
43 WBC              39 0.419    continuous normal ALL      
44 Hct              39 0.600    continuous normal ALL      
45 PLT              39 0.969    continuous normal ALL      
46 Sodium           39 0.657    continuous normal ALL      
47 K                39 0.024**  continuous normal ALL      
48 Lactate          26 0.755    continuous normal ALL      
49 PH               39 0.922    continuous normal ALL      
50 HCO3             39 0.444    continuous normal ALL      
51 BUN              39 0.008**  continuous normal ALL      
52 Cr               39 0.010**  continuous normal ALL      
53 Glucose          38 0.672    continuous normal ALL      
54 Albumin          39 0.773    continuous normal ALL      
55 Total..bilirubin 39 0.512    continuous normal ALL      
56 CRP              39 0.456    continuous normal ALL      
57 D.dimer          25 0.244    continuous normal ALL      
58 CK.MB            37 0.832    continuous normal ALL      
59 Troponin         35 0.083*   continuous normal ALL      
60 PRC              39 0.477    continuous normal ALL      
61 FFP              39 0.478    continuous normal ALL      
62 PC               39 0.912    continuous normal ALL      
63 Cryo             39 0.052*   continuous normal ALL      
-----
Signif. codes:  0 '**' 0.05 '*' 0.1 ' ' 1 
createTable(res)

--------Summary descriptives table by 'Survive4'---------

____________________________________________________ 
                      0            1       p.overall 
                     N=30         N=9                
<U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF> 
Sex:                                         0.266   
    Female        10 (33.3%)   5 (55.6%)             
    Male          20 (66.7%)   4 (44.4%)             
Age              62.0 (14.5)  52.1 (16.2)    0.125   
Year             2012 (1.49)  2013 (1.32)    0.160   
Holiday:                                     0.572   
    Holiday       3 (10.0%)    2 (22.2%)             
    Not Holiday   27 (90.0%)   7 (77.8%)             
Insertion.time:                              0.704   
    Elective      16 (53.3%)   6 (66.7%)             
    Emergency     14 (46.7%)   3 (33.3%)             
ECMO.duration    4.40 (4.27)  9.11 (5.42)    0.035   
Death:                                      <0.001   
    Non-survivor  30 (100%)    1 (11.1%)             
    Survivor      0 (0.00%)    8 (88.9%)             
Height           1.67 (0.08)  1.62 (0.07)    0.156   
Weight           60.9 (9.11)  59.5 (8.79)    0.688   
BMI              25.9 (3.77)  27.5 (2.44)    0.205   
Diagnosis:                                   0.089   
    ACS           16 (53.3%)   2 (22.2%)             
    ARDS          2 (6.67%)    1 (11.1%)             
    ETC           6 (20.0%)    1 (11.1%)             
    Myocarditis   1 (3.33%)    0 (0.00%)             
    PTE           2 (6.67%)    4 (44.4%)             
    pump failure  3 (10.0%)    1 (11.1%)             
Smoking:                                     1.000   
    No            4 (13.3%)    1 (11.1%)             
    Yes           26 (86.7%)   8 (88.9%)             
CAD:                                         0.400   
    No            21 (70.0%)   8 (88.9%)             
    Yes           9 (30.0%)    1 (11.1%)             
CVA:                                         1.000   
    No            27 (90.0%)    9 (100%)             
    Yes           3 (10.0%)    0 (0.00%)             
PAD: No           30 (100%)     9 (100%)       .     
DM:                                          0.228   
    No            19 (63.3%)   8 (88.9%)             
    Yes           11 (36.7%)   1 (11.1%)             
HBP:                                         0.251   
    No            15 (50.0%)   7 (77.8%)             
    Yes           15 (50.0%)   2 (22.2%)             
Indication:                                  1.000   
    Cardiology    27 (90.0%)   8 (88.9%)             
    Respiratory   3 (10.0%)    1 (11.1%)             
Mode:                                        1.000   
    VA            27 (90.0%)   8 (88.9%)             
    VV            3 (10.0%)    1 (11.1%)             
CA: Yes           30 (100%)     9 (100%)       .     
OHCA:                                        1.000   
    IHCA          26 (86.7%)   8 (88.9%)             
    OHCA          4 (13.3%)    1 (11.1%)             
CPR.duration     33.4 (37.2)  19.4 (16.0)    0.116   
CA.ECMO.Time      112 (224)   35.8 (15.3)    0.075   
EKG:                                         0.088   
    Asystole      15 (50.0%)   1 (11.1%)             
    ETC           12 (40.0%)   7 (77.8%)             
    PEA           3 (10.0%)    1 (11.1%)             
Weaning:                                    <0.001   
    Fail          29 (96.7%)   0 (0.00%)             
    Success       1 (3.33%)     9 (100%)             
Vent: Yes         30 (100%)     9 (100%)       .     
HD               9.00 (10.7)  42.6 (13.0)   <0.001   
ICU.stay         6.23 (5.72)  21.6 (8.96)    0.001   
CRRT:                                        0.464   
    No            15 (50.0%)   6 (66.7%)             
    Yes           15 (50.0%)   3 (33.3%)             
CRRT.duration    6.20 (5.32)  7.67 (2.52)    0.489   
CAG:                                         0.251   
    No            15 (50.0%)   7 (77.8%)             
    Yes           15 (50.0%)   2 (22.2%)             
PCI:                                         0.228   
    No            19 (63.3%)   8 (88.9%)             
    Yes           11 (36.7%)   1 (11.1%)             
GCS              6.13 (4.24)  8.89 (4.28)    0.114   
Bleeding:                                    0.225   
    No            18 (60.0%)   8 (88.9%)             
    Yes           12 (40.0%)   1 (11.1%)             
Tamponade:                                   1.000   
    No            29 (96.7%)    9 (100%)             
    Yes           1 (3.33%)    0 (0.00%)             
Pulmo:                                       0.318   
    No            25 (83.3%)    9 (100%)             
    Yes           5 (16.7%)    0 (0.00%)             
AKI:                                         0.464   
    No            15 (50.0%)   6 (66.7%)             
    Yes           15 (50.0%)   3 (33.3%)             
Liver.failure:                               1.000   
    No            28 (93.3%)    9 (100%)             
    Yes           2 (6.67%)    0 (0.00%)             
MOF:                                         0.160   
    No            22 (73.3%)    9 (100%)             
    Yes           8 (26.7%)    0 (0.00%)             
Sepsis:                                      0.572   
    No            27 (90.0%)   7 (77.8%)             
    Yes           3 (10.0%)    2 (22.2%)             
Stroke:                                      0.231   
    No            30 (100%)    8 (88.9%)             
    Yes           0 (0.00%)    1 (11.1%)             
Leg.ischemia:                                0.556   
    No            28 (93.3%)   8 (88.9%)             
    Yes           2 (6.67%)    1 (11.1%)             
WBC              14799 (6937) 13201 (4411)   0.419   
Hct              34.7 (8.10)  36.8 (10.9)    0.600   
PLT               175 (97.3)   174 (69.7)    0.969   
Sodium            143 (4.96)   142 (4.01)    0.657   
K                4.50 (1.25)  3.82 (0.53)    0.024   
Lactate          8.26 (5.07)  7.33 (5.84)    0.755   
PH               7.17 (0.15)  7.17 (0.25)    0.922   
HCO3             11.5 (4.22)  12.7 (4.01)    0.444   
BUN              28.7 (20.5)  16.2 (7.22)    0.008   
Cr               1.81 (1.48)  1.03 (0.27)    0.010   
Glucose           226 (126)    238 (52.8)    0.672   
Albumin          2.97 (0.86)  2.89 (0.68)    0.773   
Total..bilirubin 0.95 (1.11)  1.19 (0.86)    0.512   
CRP              3.63 (5.66)  6.55 (10.8)    0.456   
D.dimer          9.13 (12.7)  17.6 (16.2)    0.244   
CK.MB            29.7 (33.6)  37.0 (98.7)    0.832   
Troponin         1.29 (3.47)  0.08 (0.14)    0.083   
PRC              22.6 (17.2)  18.7 (13.4)    0.477   
FFP              11.6 (15.4)  8.44 (10.0)    0.478   
PC               34.6 (41.8)  36.4 (43.5)    0.912   
Cryo             1.30 (3.51)  0.00 (0.00)    0.052   
<U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF><U+00AF> 
data4$EKG4=ifelse(data4$EKG=="ETC","ETC", "Asystole/PEA")

out=glm(Survive4~Age+DM+CPR.duration+GCS+CA.ECMO.Time+K+Cr+EKG4,data=data4)
summary(out)

Call:
glm(formula = Survive4 ~ Age + DM + CPR.duration + GCS + CA.ECMO.Time + 
    K + Cr + EKG4, data = data4)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.5870  -0.1804  -0.0631   0.1875   0.9244  

Coefficients:
              Estimate Std. Error t value Pr(>|t|)  
(Intercept)   0.624095   0.430111    1.45    0.157  
Age          -0.003273   0.004621   -0.71    0.484  
DMYes        -0.007365   0.153773   -0.05    0.962  
CPR.duration -0.001407   0.001995   -0.71    0.486  
GCS           0.013800   0.015914    0.87    0.393  
CA.ECMO.Time -0.000601   0.000349   -1.72    0.095 .
K            -0.066572   0.076327   -0.87    0.390  
Cr           -0.050037   0.070946   -0.71    0.486  
EKG4ETC       0.371335   0.149903    2.48    0.019 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1472)

    Null deviance: 6.9231  on 38  degrees of freedom
Residual deviance: 4.4174  on 30  degrees of freedom
AIC: 45.74

Number of Fisher Scoring iterations: 2
out2=glm(Survive4~Age+CPR.duration+GCS+CA.ECMO.Time+Cr+EKG4,data=data4)
summary(out2)

Call:
glm(formula = Survive4 ~ Age + CPR.duration + GCS + CA.ECMO.Time + 
    Cr + EKG4, data = data4)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.6289  -0.2324  -0.0694   0.1834   0.9045  

Coefficients:
              Estimate Std. Error t value Pr(>|t|)  
(Intercept)   0.374463   0.313722    1.19    0.241  
Age          -0.002749   0.004434   -0.62    0.540  
CPR.duration -0.001626   0.001935   -0.84    0.407  
GCS           0.013375   0.015078    0.89    0.382  
CA.ECMO.Time -0.000615   0.000341   -1.80    0.081 .
Cr           -0.090193   0.050330   -1.79    0.083 .
EKG4ETC       0.377265   0.144187    2.62    0.013 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1415)

    Null deviance: 6.9231  on 38  degrees of freedom
Residual deviance: 4.5295  on 32  degrees of freedom
AIC: 42.71

Number of Fisher Scoring iterations: 2
out3=glm(Survive4~CA.ECMO.Time+Cr+EKG4,data=data4)
summary(out3)

Call:
glm(formula = Survive4 ~ CA.ECMO.Time + Cr + EKG4, data = data4)

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-0.544  -0.165  -0.101   0.233   0.907  

Coefficients:
              Estimate Std. Error t value Pr(>|t|)   
(Intercept)   0.271014   0.103476    2.62    0.013 * 
CA.ECMO.Time -0.000692   0.000323   -2.15    0.039 * 
Cr           -0.114798   0.046413   -2.47    0.018 * 
EKG4ETC       0.434804   0.130159    3.34    0.002 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.1374)

    Null deviance: 6.9231  on 38  degrees of freedom
Residual deviance: 4.8078  on 35  degrees of freedom
AIC: 39.04

Number of Fisher Scoring iterations: 2
anova(out3,out2,out,test="Chisq")
Analysis of Deviance Table

Model 1: Survive4 ~ CA.ECMO.Time + Cr + EKG4
Model 2: Survive4 ~ Age + CPR.duration + GCS + CA.ECMO.Time + Cr + EKG4
Model 3: Survive4 ~ Age + DM + CPR.duration + GCS + CA.ECMO.Time + K + 
    Cr + EKG4
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1        35       4.81                     
2        32       4.53  3    0.278     0.60
3        30       4.42  2    0.112     0.68
exp(coef(out3))
 (Intercept) CA.ECMO.Time           Cr      EKG4ETC 
      1.3113       0.9993       0.8915       1.5447 
confint(out3)
                 2.5 %     97.5 %
(Intercept)   0.068204  4.738e-01
CA.ECMO.Time -0.001324 -5.999e-05
Cr           -0.205767 -2.383e-02
EKG4ETC       0.179698  6.899e-01
exp(confint(out3))
              2.5 % 97.5 %
(Intercept)  1.0706 1.6061
CA.ECMO.Time 0.9987 0.9999
Cr           0.8140 0.9765
EKG4ETC      1.1969 1.9935
mosaicplot(~Year+Death,data=data4,color=TRUE,main="Distribution of ECMO in cardiac arrest patient")

plot of chunk unnamed-chunk-1