# Logistic regression - overview

This page offers structured overviews of one or more selected methods. Add additional methods for comparisons (max. of 3) by clicking on the dropdown button in the right-hand column. To practice with a specific method click the button at the bottom row of the table

Logistic regression | Logistic regression | Marginal Homogeneity test / Stuart-Maxwell test |
You cannot compare more than 3 methods |
---|---|---|---|

Independent variables | Independent variables | Independent variable | |

One or more quantitative of interval or ratio level and/or one or more categorical with independent groups, transformed into code variables | One or more quantitative of interval or ratio level and/or one or more categorical with independent groups, transformed into code variables | 2 paired groups | |

Dependent variable | Dependent variable | Dependent variable | |

One categorical with 2 independent groups | One categorical with 2 independent groups | One categorical with $J$ independent groups ($J \geqslant 2$) | |

Null hypothesis | Null hypothesis | Null hypothesis | |

Model chi-squared test for the complete regression model:
- H
_{0}: $\beta_1 = \beta_2 = \ldots = \beta_K = 0$
- H
_{0}: $\beta_k = 0$ or in terms of odds ratio: - H
_{0}: $e^{\beta_k} = 1$
- H
_{0}: $\beta_k = 0$ or in terms of odds ratio: - H
_{0}: $e^{\beta_k} = 1$
| Model chi-squared test for the complete regression model:
- H
_{0}: $\beta_1 = \beta_2 = \ldots = \beta_K = 0$
- H
_{0}: $\beta_k = 0$ or in terms of odds ratio: - H
_{0}: $e^{\beta_k} = 1$
- H
_{0}: $\beta_k = 0$ or in terms of odds ratio: - H
_{0}: $e^{\beta_k} = 1$
| H_{0}: for each category $j$ of the dependent variable, $\pi_j$ for the first paired group = $\pi_j$ for the second paired group.
Here $\pi_j$ is the population proportion in category $j.$ | |

Alternative hypothesis | Alternative hypothesis | Alternative hypothesis | |

Model chi-squared test for the complete regression model:
- H
_{1}: not all population regression coefficients are 0
- H
_{1}: $\beta_k \neq 0$ or in terms of odds ratio: - H
_{1}: $e^{\beta_k} \neq 1$ If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$ (see 'Test statistic'), also one sided alternatives can be tested: - H
_{1}right sided: $\beta_k > 0$ - H
_{1}left sided: $\beta_k < 0$
- H
_{1}: $\beta_k \neq 0$ or in terms of odds ratio: - H
_{1}: $e^{\beta_k} \neq 1$
| Model chi-squared test for the complete regression model:
- H
_{1}: not all population regression coefficients are 0
- H
_{1}: $\beta_k \neq 0$ or in terms of odds ratio: - H
_{1}: $e^{\beta_k} \neq 1$ If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$ (see 'Test statistic'), also one sided alternatives can be tested: - H
_{1}right sided: $\beta_k > 0$ - H
_{1}left sided: $\beta_k < 0$
- H
_{1}: $\beta_k \neq 0$ or in terms of odds ratio: - H
_{1}: $e^{\beta_k} \neq 1$
| H_{1}: for some categories of the dependent variable, $\pi_j$ for the first paired group $\neq$ $\pi_j$ for the second paired group. | |

Assumptions | Assumptions | Assumptions | |

- In the population, the relationship between the independent variables and the log odds $\ln (\frac{\pi_{y=1}}{1 - \pi_{y=1}})$ is linear
- The residuals are independent of one another
- Variables are measured without error
- Multicollinearity
- Outliers
| - In the population, the relationship between the independent variables and the log odds $\ln (\frac{\pi_{y=1}}{1 - \pi_{y=1}})$ is linear
- The residuals are independent of one another
- Variables are measured without error
- Multicollinearity
- Outliers
| - Sample of pairs is a simple random sample from the population of pairs. That is, pairs are independent of one another
| |

Test statistic | Test statistic | Test statistic | |

Model chi-squared test for the complete regression model:
- $X^2 = D_{null} - D_K = \mbox{null deviance} - \mbox{model deviance} $
$D_{null}$, the null deviance, is conceptually similar to the total variance of the dependent variable in OLS regression analysis. $D_K$, the model deviance, is conceptually similar to the residual variance in OLS regression analysis.
The wald statistic can be defined in two ways: - Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$
- Wald $ = \dfrac{b_k}{SE_{b_k}}$
Likelihood ratio chi-squared test for individual $\beta_k$: - $X^2 = D_{K-1} - D_K$
$D_{K-1}$ is the model deviance, where independent variable $k$ is excluded from the model. $D_{K}$ is the model deviance, where independent variable $k$ is included in the model.
| Model chi-squared test for the complete regression model:
- $X^2 = D_{null} - D_K = \mbox{null deviance} - \mbox{model deviance} $
$D_{null}$, the null deviance, is conceptually similar to the total variance of the dependent variable in OLS regression analysis. $D_K$, the model deviance, is conceptually similar to the residual variance in OLS regression analysis.
The wald statistic can be defined in two ways: - Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$
- Wald $ = \dfrac{b_k}{SE_{b_k}}$
Likelihood ratio chi-squared test for individual $\beta_k$: - $X^2 = D_{K-1} - D_K$
$D_{K-1}$ is the model deviance, where independent variable $k$ is excluded from the model. $D_{K}$ is the model deviance, where independent variable $k$ is included in the model.
| Computing the test statistic is a bit complicated and involves matrix algebra. Unless you are following a technical course, you probably won't need to calculate it by hand. | |

Sampling distribution of $X^2$ and of the Wald statistic if H_{0} were true | Sampling distribution of $X^2$ and of the Wald statistic if H_{0} were true | Sampling distribution of the test statistic if H_{0} were true | |

Sampling distribution of $X^2$, as computed in the model chi-squared test for the complete model:
- chi-squared distribution with $K$ (number of independent variables) degrees of freedom
- If defined as Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$: approximately the chi-squared distribution with 1 degree of freedom
- If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$: approximately the standard normal distribution
- chi-squared distribution with 1 degree of freedom
| Sampling distribution of $X^2$, as computed in the model chi-squared test for the complete model:
- chi-squared distribution with $K$ (number of independent variables) degrees of freedom
- If defined as Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$: approximately the chi-squared distribution with 1 degree of freedom
- If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$: approximately the standard normal distribution
- chi-squared distribution with 1 degree of freedom
| Approximately the chi-squared distribution with $J - 1$ degrees of freedom | |

Significant? | Significant? | Significant? | |

For the model chi-squared test for the complete regression model and likelihood ratio chi-squared test for individual $\beta_k$:
- Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
- Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
- If defined as Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$: same procedure as for the chi-squared tests. Wald can be interpret as $X^2$
- If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$: same procedure as for any $z$ test. Wald can be interpreted as $z$.
| For the model chi-squared test for the complete regression model and likelihood ratio chi-squared test for individual $\beta_k$:
- Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
- Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
- If defined as Wald $ = \dfrac{b_k^2}{SE^2_{b_k}}$: same procedure as for the chi-squared tests. Wald can be interpret as $X^2$
- If defined as Wald $ = \dfrac{b_k}{SE_{b_k}}$: same procedure as for any $z$ test. Wald can be interpreted as $z$.
| If we denote the test statistic as $X^2$:
- Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
- Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
| |

Wald-type approximate $C\%$ confidence interval for $\beta_k$ | Wald-type approximate $C\%$ confidence interval for $\beta_k$ | n.a. | |

$b_k \pm z^* \times SE_{b_k}$ where the critical value $z^*$ is the value under the normal curve with the area $C / 100$ between $-z^*$ and $z^*$ (e.g. $z^*$ = 1.96 for a 95% confidence interval). | $b_k \pm z^* \times SE_{b_k}$ where the critical value $z^*$ is the value under the normal curve with the area $C / 100$ between $-z^*$ and $z^*$ (e.g. $z^*$ = 1.96 for a 95% confidence interval). | - | |

Goodness of fit measure $R^2_L$ | Goodness of fit measure $R^2_L$ | n.a. | |

$R^2_L = \dfrac{D_{null} - D_K}{D_{null}}$ There are several other goodness of fit measures in logistic regression. In logistic regression, there is no single agreed upon measure of goodness of fit. | $R^2_L = \dfrac{D_{null} - D_K}{D_{null}}$ There are several other goodness of fit measures in logistic regression. In logistic regression, there is no single agreed upon measure of goodness of fit. | - | |

Example context | Example context | Example context | |

Can body mass index, stress level, and gender predict whether people get diagnosed with diabetes? | Can body mass index, stress level, and gender predict whether people get diagnosed with diabetes? | Subjects are asked to taste three different types of mayonnaise, and to indicate which of the three types of mayonnaise they like best. They then have to drink a glass of beer, and taste and rate the three types of mayonnaise again. Does drinking a beer change which type of mayonnaise people like best? | |

SPSS | SPSS | SPSS | |

Analyze > Regression > Binary Logistic...
- Put your dependent variable in the box below Dependent and your independent (predictor) variables in the box below Covariate(s)
| Analyze > Regression > Binary Logistic...
- Put your dependent variable in the box below Dependent and your independent (predictor) variables in the box below Covariate(s)
| Analyze > Nonparametric Tests > Legacy Dialogs > 2 Related Samples...
- Put the two paired variables in the boxes below Variable 1 and Variable 2
- Under Test Type, select the Marginal Homogeneity test
| |

Jamovi | Jamovi | n.a. | |

Regression > 2 Outcomes - Binomial
- Put your dependent variable in the box below Dependent Variable and your independent variables of interval/ratio level in the box below Covariates
- If you also have code (dummy) variables as independent variables, you can put these in the box below Covariates as well
- Instead of transforming your categorical independent variable(s) into code variables, you can also put the untransformed categorical independent variables in the box below Factors. Jamovi will then make the code variables for you 'behind the scenes'
| Regression > 2 Outcomes - Binomial
- Put your dependent variable in the box below Dependent Variable and your independent variables of interval/ratio level in the box below Covariates
- If you also have code (dummy) variables as independent variables, you can put these in the box below Covariates as well
- Instead of transforming your categorical independent variable(s) into code variables, you can also put the untransformed categorical independent variables in the box below Factors. Jamovi will then make the code variables for you 'behind the scenes'
| - | |

Practice questions | Practice questions | Practice questions | |