Logistična regresija

1 Podatki

Tudi logistično regresijo smo tu izvedli na celotni zbirki podatkov, da lahko dobimo vpogled v faktorje tveganja.

To delamo na zbirki df_imputed.pkl.

2 Logistična regresija ene spremenljivke za izračune OR

Predictor Level OR CI95 p
HospitalizationBeforeSurgeryMo HospitalizationBeforeSurgeryMo=1.0 (ref: 0.0) 1.511 1.096–2.084 0.012
Age Age 1.019 1.002–1.036 0.026
Gender Gender=1.0 (ref: 0.0) 1.135 0.795–1.621 0.486
BMI BMI 1.108 1.076–1.142 < 0.001
CardiogenicSchockYN CardiogenicSchockYN=1.0 (ref: 0.0) 1.899 1.277–2.824 0.002
FormerSmoker FormerSmoker=1.0 (ref: 0.0) 0.974 0.715–1.327 0.867
CurrentSmoker CurrentSmoker=1.0 (ref: 0.0) 0.960 0.675–1.366 0.820
Diabetes Diabetes=1.0 (ref: 0.0) 2.002 1.493–2.685 < 0.001
DiabetesPerOsTherapie DiabetesPerOsTherapie=1.0 (ref: 0.0) 1.433 1.039–1.977 0.028
DiabetesOnInsuline DiabetesOnInsuline=1.0 (ref: 0.0) 2.699 1.922–3.790 < 0.001
Hypertension Hypertension=1.0 (ref: 0.0) 1.414 0.658–3.039 0.375
Hyperlipidemia Hyperlipidemia=1.0 (ref: 0.0) 1.070 0.645–1.778 0.792
PerifernoArterijskoObolenje PerifernoArterijskoObolenje=1.0 (ref: 0.0) 2.065 1.463–2.917 < 0.001
ExtracardiacArteriopathy ExtracardiacArteriopathy=1.0 (ref: 0.0) 1.568 1.150–2.138 0.004
PsychoSyndrome PsychoSyndrome=1.0 (ref: 0.0) 3.750 2.626–5.357 < 0.001
TherapyRelevantPsychoSyndrome TherapyRelevantPsychoSyndrome=1.0 (ref: 0.0) 4.027 2.789–5.814 < 0.001
NYHA3rdOr4thCategory NYHA3rdOr4thCategory=1.0 (ref: 0.0) 1.025 0.764–1.375 0.868
UnstableAnginaPectoris UnstableAnginaPectoris=1.0 (ref: 0.0) 1.040 0.648–1.668 0.871
StrokeBeforeOp StrokeBeforeOp=1.0 (ref: 0.0) 1.070 0.635–1.804 0.800
PreoperativeInfectionYN PreoperativeInfectionYN=1.0 (ref: 0.0) 2.074 0.949–4.533 0.068
KongestiveHeartFailure KongestiveHeartFailure=1.0 (ref: 0.0) 1.614 1.196–2.178 0.002
EjectionFractionEF EjectionFractionEF 0.983 0.972–0.994 0.003
EF50 EF50=1.0 (ref: 0.0) 1.540 1.118–2.121 0.008
AtrialFibrillationYN AtrialFibrillationYN=1.0 (ref: 0.0) 1.755 1.120–2.749 0.014
PCI PCI=1.0 (ref: 0.0) 1.102 0.787–1.544 0.571
PreviousOperationCABG PreviousOperationCABG=1.0 (ref: 0.0) 0.000 0.000–inf 0.997
PreviousCardiacOperation PreviousCardiacOperation=1.0 (ref: 0.0) 0.000 0.000–inf 1.000
LiverDiseaseYN LiverDiseaseYN=1.0 (ref: 0.0) 0.000 0.000–inf 1.000
ChronicLungDiseaseYN ChronicLungDiseaseYN=1.0 (ref: 0.0) 1.524 1.032–2.250 0.034
VentilationBeforeOperation VentilationBeforeOperation=1.0 (ref: 0.0) 1.128 0.272–4.673 0.868
CockcraftGaultIndexPreop CockcraftGaultIndexPreop 0.994 0.989–0.999 0.031
CC50 CC50=1.0 (ref: 0.0) 1.372 0.925–2.035 0.116
CC5085 CC5085=1.0 (ref: 0.0) 1.148 0.857–1.539 0.355
ChronicDialysis ChronicDialysis=1.0 (ref: 0.0) 1.536 0.666–3.542 0.314
RenalReplacementTherapy RenalReplacementTherapy=1.0 (ref: 0.0) 1.312 0.636–2.708 0.463
ACEInhibitors ACEInhibitors=1.0 (ref: 0.0) 1.460 1.076–1.981 0.015
ATIIAntagonists ATIIAntagonists=1.0 (ref: 0.0) 0.806 0.529–1.228 0.316
Betablocker Betablocker=1.0 (ref: 0.0) 1.087 0.785–1.506 0.615
CaAntagonists CaAntagonists=1.0 (ref: 0.0) 1.112 0.788–1.569 0.548
EUROscore10 EUROscore10 1.172 0.778–1.767 0.447
EUROscore EUROscore 1.012 0.995–1.030 0.158
IABPPreoperatively IABPPreoperatively=1.0 (ref: 0.0) 0.175 0.024–1.255 0.083
LMMainStenosisOfLeftMainCorona LMMainStenosisOfLeftMainCorona=1.0 (ref: 0.0) 0.929 0.683–1.264 0.641
DurationOfTheOperation DurationOfTheOperation 1.003 1.001–1.005 0.012
Urgent Urgent=1.0 (ref: 0.0) 0.868 0.638–1.180 0.366
Emergency Emergency=1.0 (ref: 0.0) 0.976 0.475–2.006 0.947
PericardialEffusion PericardialEffusion 0.993 0.983–1.004 0.208
NumberOfGrafts NumberOfGrafts 1.195 0.984–1.452 0.072
PericardDrainage PericardDrainage=1.0 (ref: 0.0) 1.465 1.080–1.987 0.014
RethoracotomyYN RethoracotomyYN=1.0 (ref: 0.0) 4.177 2.673–6.526 < 0.001
LowOutputYN LowOutputYN=1.0 (ref: 0.0) 1.537 0.799–2.956 0.198
InfarctionPerioperativelyYN InfarctionPerioperativelyYN=1.0 (ref: 0.0) 0.499 0.069–3.626 0.492
CoagulationDisorder CoagulationDisorder=1.0 (ref: 0.0) 2.314 1.194–4.486 0.013
Rebleeding Rebleeding=1.0 (ref: 0.0) 1.494 0.777–2.873 0.228
NewOperationOnPump NewOperationOnPump=1.0 (ref: 0.0) 2.415 0.565–10.320 0.234
AtrialFibrillationPostopNewOns AtrialFibrillationPostopNewOns=1.0 (ref: 0.0) 1.226 0.797–1.885 0.353
Cardioversion Cardioversion=1.0 (ref: 0.0) 2.866 1.725–4.761 < 0.001
StrokeJN StrokeJN=1.0 (ref: 0.0) 0.706 0.096–5.167 0.732
SumOtherInfectYN SumOtherInfectYN=1.0 (ref: 0.0) 1.857 1.296–2.659 < 0.001
AcuteKidneyFailure AcuteKidneyFailure=1.0 (ref: 0.0) 3.660 2.647–5.060 < 0.001
TotalDrainage TotalDrainage 1.000 1.000–1.001 0.003
Drainage24h Drainage24h 1.000 1.000–1.001 0.709
Drainage24hMlKg Drainage24hMlKg 1.003 0.972–1.035 0.842
NumberOfPlasmaUnits NumberOfPlasmaUnits 1.066 1.024–1.110 0.002
PlateletUnitNumber PlateletUnitNumber 1.050 0.953–1.156 0.327
Transfusion Transfusion=1.0 (ref: 0.0) 2.895 2.133–3.930 < 0.001
MoreThan2UnitsOfErythrocytes MoreThan2UnitsOfErythrocytes=1.0 (ref: 0.0) 2.953 2.140–4.076 < 0.001
RespiratoryFailureYN RespiratoryFailureYN=1.0 (ref: 0.0) 2.530 1.768–3.621 < 0.001
ProlongedMechanicalVentilation ProlongedMechanicalVentilation=1.0 (ref: 0.0) 3.902 2.570–5.924 < 0.001
Reintubation Reintubation=1.0 (ref: 0.0) 4.378 2.701–7.098 < 0.001
NumberOfReintubations NumberOfReintubations 2.916 1.849–4.599 < 0.001
Tracheotomy Tracheotomy=1.0 (ref: 0.0) 4.735 3.021–7.420 < 0.001
AorticClampingTime AorticClampingTime 1.010 1.001–1.020 0.025
BypassOperationTime BypassOperationTime 1.006 1.000–1.011 0.035
MinimumTemperature MinimumTemperature 1.063 0.915–1.236 0.425
AtrialAppendageClosure AtrialAppendageClosure=1.0 (ref: 0.0) 1.690 0.815–3.503 0.158
AorticCalcificatio AorticCalcificatio=1.0 (ref: 0.0) 1.380 1.007–1.891 0.045
TotalRevascularization TotalRevascularization=1.0 (ref: 0.0) 0.869 0.577–1.309 0.502
LeukocytesPreoperatively LeukocytesPreoperatively 1.010 0.997–1.023 0.117
LeukocytesFirstPostoperativeDa LeukocytesFirstPostoperativeDa 1.010 1.000–1.020 0.056
LeukocytesSecondPostoperativeD LeukocytesSecondPostoperativeD 1.026 1.011–1.042 < 0.001
HbPreop12GDl HbPreop12GDl=1.0 (ref: 0.0) 1.841 1.285–2.636 < 0.001
HbPreoperativelyGDl HbPreoperativelyGDl 0.886 0.817–0.960 0.003
HbFirstPostoperativeDayGDl HbFirstPostoperativeDayGDl 0.961 0.879–1.050 0.377
HbSecondPostoperativeDayGDl HbSecondPostoperativeDayGDl 0.991 0.931–1.054 0.763
PlateletsPreoperatively PlateletsPreoperatively 1.001 0.999–1.003 0.308
PlateletsFirstPostoperativeDay PlateletsFirstPostoperativeDay 1.001 0.999–1.002 0.552
PlateletsSecondPostoperativeDa PlateletsSecondPostoperativeDa 1.001 0.998–1.003 0.583
INRFirstPostoperativeDay INRFirstPostoperativeDay 0.919 0.414–2.039 0.836
INRSecondPostoperativeDay INRSecondPostoperativeDay 0.977 0.845–1.129 0.749
PoorGlycemicControlPrediabetes PoorGlycemicControlPrediabetes=1.0 (ref: 0.0) 1.544 1.045–2.280 0.029
ITA ITA=1.0 (ref: 0.0) 0.509 0.327–0.792 0.003
BIMA BIMA=1.0 (ref: 0.0) 2.465 1.539–3.950 < 0.001
CPBTime100Min CPBTime100Min=1.0 (ref: 0.0) 1.166 0.795–1.712 0.431
SaEtAlCreatinine226MgDdlOrPost SaEtAlCreatinine226MgDdlOrPost=1.0 (ref: 0.0) 3.222 2.102–4.937 < 0.001
RecentMIWithin90Days RecentMIWithin90Days=1.0 (ref: 0.0) 1.240 0.923–1.665 0.154
BoneWaxFolG BoneWaxFolG=1.0 (ref: 0.0) 1.004 0.596–1.691 0.988
BoneWaxOsteneG BoneWaxOsteneG=1.0 (ref: 0.0) 0.753 0.487–1.163 0.201
VancomycinG VancomycinG=1.0 (ref: 0.0) 0.973 0.425–2.226 0.949
TiesselFibrinGlueMl TiesselFibrinGlueMl=1.0 (ref: 0.0) 2.240 1.273–3.939 0.005
GFRLaurisProdop60NotNormal GFRLaurisProdop60NotNormal=1.0 (ref: 0.0) 1.897 1.398–2.574 < 0.001
GFRLaurisPostop1stDay60NotNorm GFRLaurisPostop1stDay60NotNorm=1.0 (ref: 0.0) 1.816 1.337–2.466 < 0.001
GFRLaurisPostop2ndDay60NotNorm GFRLaurisPostop2ndDay60NotNorm=1.0 (ref: 0.0) 2.004 1.475–2.722 < 0.001
CRPLaurisPreop3NotNormal CRPLaurisPreop3NotNormal=1.0 (ref: 0.0) 1.310 0.776–2.213 0.312
CRPLaurisPostop1stDay3NotNorma CRPLaurisPostop1stDay3NotNorma=1.0 (ref: 0.0) 1.018 0.605–1.716 0.945
CRPLaurisPostop2ndDay3NotNorma CRPLaurisPostop2ndDay3NotNorma=1.0 (ref: 0.0) 0.506 0.066–3.868 0.512
PneumothoraxJN PneumothoraxJN=1.0 (ref: 0.0) 0.434 0.137–1.370 0.154
PleuralEffusion PleuralEffusion=1.0 (ref: 0.0) 3.055 2.217–4.210 < 0.001

3 Multipla logistična regresija

Število spremenljivk s p < 0.10: 53

Predictor Level OR CI95 p
HospitalizationBeforeSurgeryMo HospitalizationBeforeSurgeryMo=1.0 1.671 1.172–2.383 0.005
CardiogenicSchockYN CardiogenicSchockYN=1.0 0.859 0.522–1.414 0.551
Diabetes Diabetes=1.0 1.126 0.620–2.044 0.697
DiabetesPerOsTherapie DiabetesPerOsTherapie=1.0 1.074 0.622–1.853 0.798
DiabetesOnInsuline DiabetesOnInsuline=1.0 1.704 0.992–2.925 0.053
PerifernoArterijskoObolenje PerifernoArterijskoObolenje=1.0 2.480 1.351–4.551 0.003
ExtracardiacArteriopathy ExtracardiacArteriopathy=1.0 0.740 0.429–1.275 0.278
PsychoSyndrome PsychoSyndrome=1.0 1.506 0.435–5.210 0.518
TherapyRelevantPsychoSyndrome TherapyRelevantPsychoSyndrome=1.0 1.500 0.411–5.477 0.539
PreoperativeInfectionYN PreoperativeInfectionYN=1.0 1.494 0.607–3.677 0.382
KongestiveHeartFailure KongestiveHeartFailure=1.0 1.073 0.572–2.013 0.827
EF50 EF50=1.0 0.950 0.489–1.848 0.881
AtrialFibrillationYN AtrialFibrillationYN=1.0 1.144 0.685–1.911 0.607
ChronicLungDiseaseYN ChronicLungDiseaseYN=1.0 1.076 0.699–1.657 0.739
ACEInhibitors ACEInhibitors=1.0 1.306 0.939–1.815 0.113
IABPPreoperatively IABPPreoperatively=1.0 0.084 0.011–0.638 0.017
PericardDrainage PericardDrainage=1.0 1.262 0.892–1.786 0.188
RethoracotomyYN RethoracotomyYN=1.0 2.289 1.283–4.086 0.005
CoagulationDisorder CoagulationDisorder=1.0 0.832 0.359–1.927 0.667
Cardioversion Cardioversion=1.0 1.758 0.971–3.186 0.063
SumOtherInfectYN SumOtherInfectYN=1.0 0.697 0.429–1.133 0.145
AcuteKidneyFailure AcuteKidneyFailure=1.0 2.227 1.425–3.481 < 0.001
Transfusion Transfusion=1.0 1.999 1.337–2.989 < 0.001
MoreThan2UnitsOfErythrocytes MoreThan2UnitsOfErythrocytes=1.0 1.092 0.694–1.719 0.703
RespiratoryFailureYN RespiratoryFailureYN=1.0 0.649 0.332–1.268 0.206
ProlongedMechanicalVentilation ProlongedMechanicalVentilation=1.0 0.880 0.338–2.294 0.794
Reintubation Reintubation=1.0 1.554 0.607–3.979 0.358
Tracheotomy Tracheotomy=1.0 1.816 0.776–4.252 0.169
AorticCalcificatio AorticCalcificatio=1.0 1.206 0.844–1.723 0.303
HbPreop12GDl HbPreop12GDl=1.0 0.986 0.613–1.588 0.955
PoorGlycemicControlPrediabetes PoorGlycemicControlPrediabetes=1.0 1.171 0.734–1.867 0.508
ITA ITA=1.0 1.401 0.404–4.854 0.595
BIMA BIMA=1.0 7.174 1.849–27.831 0.004
SaEtAlCreatinine226MgDdlOrPost SaEtAlCreatinine226MgDdlOrPost=1.0 1.005 0.553–1.825 0.988
TiesselFibrinGlueMl TiesselFibrinGlueMl=1.0 1.679 0.882–3.197 0.115
GFRLaurisProdop60NotNormal GFRLaurisProdop60NotNormal=1.0 1.150 0.711–1.859 0.570
GFRLaurisPostop1stDay60NotNorm GFRLaurisPostop1stDay60NotNorm=1.0 0.662 0.394–1.114 0.120
GFRLaurisPostop2ndDay60NotNorm GFRLaurisPostop2ndDay60NotNorm=1.0 0.648 0.388–1.082 0.097
PleuralEffusion PleuralEffusion=1.0 2.239 1.532–3.271 < 0.001
Age Age 1.009 0.986–1.032 0.455
BMI BMI 1.174 1.128–1.222 < 0.001
EjectionFractionEF EjectionFractionEF 0.987 0.962–1.012 0.299
CockcraftGaultIndexPreop CockcraftGaultIndexPreop 0.988 0.979–0.997 0.007
DurationOfTheOperation DurationOfTheOperation 1.000 0.995–1.006 0.894
NumberOfGrafts NumberOfGrafts 1.250 0.941–1.658 0.123
TotalDrainage TotalDrainage 1.000 1.000–1.000 0.133
NumberOfPlasmaUnits NumberOfPlasmaUnits 1.001 0.934–1.074 0.969
NumberOfReintubations NumberOfReintubations 1.272 0.631–2.564 0.501
AorticClampingTime AorticClampingTime 1.010 0.989–1.033 0.344
BypassOperationTime BypassOperationTime 0.991 0.977–1.005 0.200
LeukocytesFirstPostoperativeDa LeukocytesFirstPostoperativeDa 0.996 0.977–1.015 0.656
LeukocytesSecondPostoperativeD LeukocytesSecondPostoperativeD 1.019 0.996–1.043 0.103
HbPreoperativelyGDl HbPreoperativelyGDl 1.003 0.957–1.052 0.885

3.1 Vrednotenje modela

To vrednotenje modela je “nepošteno”, saj učimo in evalviramo model na istih podatkih. Vendar bomo to vseeno naredili, saj se to “običajno” poroča na medicinskih člankih.

Posledica so boljši rezultati, kot so potem v klinični praksi.

3.1.1 ROC analiza

3.1.2 Vrednotenje napovednih vrednosti

Pripravimo osnovne metrike za vrednotenje modelov.

Tukaj uporabljamo dva način poročanja rezultatov pri optimalni vrednosti izbire praga za pozitivno odločitev (Youden):

  • z uporabo mer senzitivnosti, specifičnosti in točnosti,
  • lahko pa tudi z merami precision, recall in accuracy iz paketa sklearn.

Youden index: 0.505 (threshold 0.033)

Pred 0 Pred 1
True 0 3863 1270
True 1 46 140

Medical-oriented classification measures:

Sensitivity    : 0.7527
Specificity    : 0.7526
Pos Pred Value : 0.0993
Neg Pred Value : 0.9882
Accuracy       : 0.7526

Classification_report (sklearn):
              precision    recall  f1-score   support

     class 0     0.9882    0.7526    0.8545      5133
     class 1     0.0993    0.7527    0.1754       186

    accuracy                         0.7526      5319
   macro avg     0.5438    0.7526    0.5149      5319
weighted avg     0.9571    0.7526    0.8307      5319