# Interpretting binary logistic regression in R

So I have a data set, and I'd like to test the influence of a continuous variable (cont) on a categorical (binary) variable (cat) that can be 0 (yes) or 1 (no). I've looked on the internet and binary logistic regression seems to be a good choice. So I plugged this into R:

glm(cat~cont, family = binomial(logit"))


and got the following results from the summary:

Deviance residuals:
Min      1Q      Median   3Q      Max
-1.0757  -0.9077 -0.7019  1.3583  1.9911

Coefficients:
Estimate   Std. Error   z value   Pr(>|z|)
(Intercept)  0.65847    0.58545     1.125     0.26070
cont        -0.04297    0.01652    -2.602     0.00927

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 244.35  on 199  degrees of freedom
Residual deviance: 237.11  on 198  degrees of freedom
AIC: 241.11
Number of Fisher Scoring iterations: 4


I can see that the p-value is 0.00927, so I definitely have something significant. But how can I interpret this? I've looked on the internet but haven't found anything useful, but it's possible I just didn't understand it. From what I did understand though, the deviances are really high, but then why do I get something significant? If anyone could help me, or explain how logistic regression works, that'd be great!

## 1 Answer

Let $cat = Y$ and $cont = X$. Your theoretical model is $$\mathbb{P}(Y_i=0|X_i=x_i) = \left( 1 + \exp\{-(\beta_0 + \beta_1x_{i}\} \right)^{-1},$$ the estimated model is $$\widehat{\mathbb{P}(Y_i=0|X_i=x_i)} = \left( 1 + \exp\{-(-0.66 - 0.043_1x_{i}\} \right)^{-1}.$$ The likelihood ratio test is $$D(\beta_1, \beta_0|\beta_0)=Dev(\beta_0)-Dev(\beta_0, \beta_1) =2\log\Lambda\xrightarrow{D}\chi^2_{(1)},$$ hence you a can use the quantiles of $\chi^2_{(1)}$ distribution to test the model's significance, i.e., $$p.value=\mathbb{P}(\chi^2_{(1)} \ge 6.85) =0.00886,$$
that is very close to the p.value of the Wald ($z$ test), i.e., the square of the $z$ statistic is $2.06 ^2 = 6.76$, that is approximately the value of the $\chi^2$ statistic. Your estimated odds ratio (OR) for $\Delta$ change in $X$ is $$\widehat{OR} = \exp\{-0.043\Delta x\}.$$