# Confusion about coefficients of logistic regression model produced by glm(family = binomial) in R

I have a response variable that is binary ( 1 - recovered, 0 - dead) and I will use two predictor variables as an example. One is continuous (age) and one is binary ( condition x: ( 1 - patient has it, 0 - patient doesn't have it)). I use glm() function in R, specifying the family = "binomial". It gives out some parameters and then I use odds.ratio function to get the exponentiate values ( as the function summary(model) gives out the log values). The coefficient for age is equal to 1.26. Previously, I'd interpret it as for every y aged patient that dies there are 1.26 (y+1) aged patients that die. Now, I understand that this is incorrect, as this is not linear model, so how do I interpret the coefficient in this instance?

Then I have binary predictor (1 - has a condition x, 0 - doesn't have a condition). For this variable I get a coefficient of 0.13. This is absurd, because it can be interpreted as for every one patient, that doesn't have condition x and dies, there are 0.13x patients that has the condition x and dies. But from the sample, which I used to make the model it is obvious that the condition x has a negative influence on death rates. From the 143 that recovered, there are 83 patients, that had the condition, i.e., roughly 58% of recovered patients had the condition. From the 92 patients that died, 54 had the condition, i.e., 59 %.. So, the coefficient should be close to zero. I don't understand how can I interpret the coefficient 0.13 in this case. Please advice!

Here is a data frame where you can see the outcome and the number of cases that have this outcome and number of cases that have this outcome and has a condition x:

# A tibble: 13 x 4
# Groups:   outcome, age group [13]
outcome   age group     n condition x
<chr>     <fct>       <int>         <dbl>
1 recovered 21-30           3             0
2 recovered 31-40           8             0
4 recovered 41-50          21            10
6 recovered 51-60          36            17
8 recovered 61-70          47            31
10 recovered 71-80          18            17
12 recovered 81+            10             8


Here is the summary of the model, the variables that I referred to before are age and AH:

Call:
glm(formula = Izn ~ ., family = "binomial", data = myData14)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-2.00942  -0.20697  -0.01299   0.00155   2.62596

Coefficients: (1 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.868e+01  4.508e+00  -4.144 3.41e-05 ***
DZ           9.712e-01  7.510e-01   1.293 0.195917
age          2.309e-01  6.039e-02   3.824 0.000131 ***
DS           1.754e-01  1.117e-01   1.570 0.116412
DSCOv        2.290e-02  8.376e-02   0.273 0.784534
ITP          2.131e+00  1.256e+00   1.696 0.089918 .
Ran          3.660e+01  2.778e+03   0.013 0.989491
MPV                 NA         NA      NA       NA
ECMO        -1.244e+01  1.228e+04  -0.001 0.999191
NIV          5.427e+00  2.032e+00   2.671 0.007558 **
APNK         4.033e+00  1.494e+00   2.699 0.006954 **
CD          -1.546e+00  9.272e-01  -1.668 0.095382 .
AH          -2.018e+00  8.602e-01  -2.346 0.018975 *
HSM          2.406e+00  9.568e-01   2.515 0.011917 *
HNM          1.720e+00  1.508e+00   1.140 0.254092
HOPS        -8.647e-02  1.309e+00  -0.066 0.947332
BA          -5.312e+00  5.962e+00  -0.891 0.373010
PON          1.342e+01  1.242e+04   0.001 0.999138
CON          1.717e+00  1.182e+00   1.453 0.146330
imunsu      -2.467e+01  1.935e+03  -0.013 0.989829
aritm       -2.461e+00  1.027e+00  -2.396 0.016583 *
KSS         -2.394e+00  1.410e+00  -1.698 0.089557 .
VecsMI      -7.145e-01  1.563e+00  -0.457 0.647548
JaunsMI      1.734e+00  1.341e+00   1.292 0.196197
PCI         -1.366e+00  1.298e+00  -1.052 0.292592
aknuboj      1.297e+00  1.339e+00   0.969 0.332683
anemija     -2.841e-01  2.770e+00  -0.103 0.918300
akCI         7.927e-01  1.375e+00   0.577 0.564229
vecsCI       5.050e+00  1.606e+00   3.145 0.001660 **
pate         1.223e+00  2.214e+00   0.552 0.580868
citaAvS      3.499e-01  1.355e+00   0.258 0.796248
end          8.812e-01  2.879e+00   0.306 0.759529
transpl      1.779e+00  1.784e+04   0.000 0.999920
citaP        3.239e+00  1.806e+00   1.794 0.072882 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 314.623  on 234  degrees of freedom
Residual deviance:  78.696  on 201  degrees of freedom
AIC: 146.7

Number of Fisher Scoring iterations: 19


One person commented, that age most probably doesn't influence the outcome linearly, so I cut the age in several groups. All the coefficients for the age groups are not significant:

Call:
glm(formula = Izn ~ ., family = "binomial", data = myData14)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-2.19606  -0.18729  -0.00002   0.00117   2.56960

Coefficients: (1 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
(Intercept)    -2.876e+01  1.439e+04  -0.002  0.99841
DZ              8.621e-01  8.011e-01   1.076  0.28186
DS              1.464e-01  1.154e-01   1.269  0.20457
DSCOv           3.422e-02  1.035e-01   0.331  0.74085
ITP             2.469e+00  1.615e+00   1.528  0.12639
Ran             5.537e+01  4.960e+03   0.011  0.99109
MPV                    NA         NA      NA       NA
ECMO           -1.491e+01  1.784e+04  -0.001  0.99933
NIV             5.852e+00  2.403e+00   2.435  0.01490 *
APNK            3.804e+00  1.837e+00   2.070  0.03841 *
CD             -1.753e+00  1.074e+00  -1.633  0.10249
AH             -2.323e+00  1.005e+00  -2.313  0.02074 *
HSM             2.525e+00  9.798e-01   2.578  0.00995 **
HNM             1.535e+00  1.611e+00   0.953  0.34062
HOPS            2.038e-01  1.323e+00   0.154  0.87755
BA             -4.108e+00  4.226e+00  -0.972  0.33099
PON             1.348e+01  1.976e+04   0.001  0.99946
CON             1.475e+00  1.233e+00   1.196  0.23166
imunsu         -2.555e+01  3.003e+03  -0.009  0.99321
aritm          -2.813e+00  1.155e+00  -2.435  0.01490 *
KSS            -2.389e+00  1.473e+00  -1.622  0.10486
VecsMI         -9.956e-01  1.686e+00  -0.591  0.55484
JaunsMI         1.739e+00  1.406e+00   1.236  0.21628
PCI            -1.836e+00  1.354e+00  -1.356  0.17502
aknuboj         9.871e-01  1.514e+00   0.652  0.51449
anemija        -1.314e+00  2.705e+00  -0.486  0.62725
akCI            6.122e-01  1.420e+00   0.431  0.66647
vecsCI          5.408e+00  1.806e+00   2.995  0.00275 **
pate            1.285e+00  2.442e+00   0.526  0.59871
citaAvS        -3.175e-01  1.726e+00  -0.184  0.85407
end            -1.048e+00  3.988e+00  -0.263  0.79264
transpl        -1.461e+01  2.950e+04   0.000  0.99960
citaP           4.619e+00  2.298e+00   2.010  0.04446 *
age_group31-40  4.930e+00  2.085e+04   0.000  0.99981
age_group41-50  3.876e+00  1.462e+04   0.000  0.99979
age_group51-60  2.353e+01  1.439e+04   0.002  0.99870
age_group61-70  2.461e+01  1.439e+04   0.002  0.99864
age_group71-80  2.839e+01  1.439e+04   0.002  0.99843
age_group81+    3.059e+01  1.439e+04   0.002  0.99830
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 314.623  on 234  degrees of freedom
Residual deviance:  71.466  on 196  degrees of freedom
AIC: 149.47

Number of Fisher Scoring iterations: 20


Maybe I've done the cut incorrectly? What's the reason the age when cut in groups is no longer significant? The question about the coefficient for AH ( condition x, that I spoke of before) still remains. It doesn't make sense that the coefficient equals exp(-2.323e+00) = 0.09. From there it could be concluded that patients that have AH are much less likely die, which as I pointed out above, is not true. Here is the table, where you can see the count of cases of all possible combinations of outcomes and AH ( outcome = 0 => recovered, 1 => dead; AH = 0 => doesn't have the condition AH, 1 => has the condition AH). So all the cases where outcome = 0 equals 143, from those 83 had the condition AH, so the recovery proportion is 83/143 = 58%. From all the cases where outcome = 1, 54 patients had AH. So, the rate equals 54/92 = 58%.

  outcome AH count
1       0  0    60
2       1  0    38
3       0  1    83
4       1  1    54

• Interpreting odds ratios as relative risks is a cardinal rookie mistake. Surely this is a repeat question. The coefficient 0.13 for x seems like you haven't exponentiated it yet. Once you do, the interpretation is that the odds for recovery are approx 15% higher for patients with the condition adjusting for age. Apr 16 at 14:28
• @AdamO That's the problem, it is already exponentiated. I don't know what the problem could be... Apr 16 at 14:34
• So the coefficient is not 0.13 as you have said, but the odds ratio is 0.013 ( the coefficient must be approx -4). Inspect a simple $2 \times 2$ table, possibly broken out by a couple age groups to confirm your findings. Apr 16 at 14:37
• @AdamO The coefficient is approximately -2 and exp(-2) = 0.13. I added a data frame, where you can see the number of cases of outcome per age group and the corresponding number of cases that have the condition x. Apr 16 at 16:38
• The next problem is that you are overfitting: with 92 cases in the minority-outcome class, you shouldn't be evaluating more than about 6 predictors in your model (usual rule of thumb, 10-20 minority-class members per predictor). You have nearly 40 predictors. Next, binning by age can be inefficient as it adds many extra predictors. A flexible spline fit to age should handle non-linearities much more efficiently. Please edit this question to show a minimal model that brings out specifically your confusion about how to interpret logistic regression coefficients, and read up on overfitting.
– EdM
Apr 19 at 13:16