# 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 | Kruskal-Wallis test |
You cannot compare more than 3 methods |
---|---|---|---|

Independent variables | Independent variables | Independent/grouping 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 | One categorical with $I$ independent groups ($I \geqslant 2$) | |

Dependent variable | Dependent variable | Dependent variable | |

One categorical with 2 independent groups | One categorical with 2 independent groups | One of ordinal level | |

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$
| If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
- H
_{0}: the population medians for the $I$ groups are equal
Formulation 1: - H
_{0}: the population scores in any of the $I$ groups are not systematically higher or lower than the population scores in any of the other groups
- H
_{0}: P(an observation from population $g$ exceeds an observation from population $h$) = P(an observation from population $h$ exceeds an observation from population $g$), for each pair of groups.
| |

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$
| If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
- H
_{1}: not all of the population medians for the $I$ groups are equal
Formulation 1: - H
_{1}: the poplation scores in some groups are systematically higher or lower than the population scores in other groups
- H
_{1}: for at least one pair of groups: P(an observation from population $g$ exceeds an observation from population $h$) $\neq$ P(an observation from population $h$ exceeds an observation from population $g$)
| |

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
| - Group 1 sample is a simple random sample (SRS) from population 1, group 2 sample is an independent SRS from population 2, $\ldots$, group $I$ sample is an independent SRS from population $I$. That is, within and between groups, observations 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.
| $H = \dfrac{12}{N (N + 1)} \sum \dfrac{R^2_i}{n_i} - 3(N + 1)$ | |

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 $H$ 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
| For large samples, approximately the chi-squared distribution with $I - 1$ degrees of freedom. For small samples, the exact distribution of $H$ should be used. | |

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$.
| For large samples, the table with critical $X^2$ values can be used. If we denote $X^2 = H$:
- 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? | Do people from different religions tend to score differently on social economic status? | |

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 > K Independent Samples...
- Put your dependent variable in the box below Test Variable List and your independent (grouping) variable in the box below Grouping Variable
- Click on the Define Range... button. If you can't click on it, first click on the grouping variable so its background turns yellow
- Fill in the smallest value you have used to indicate your groups in the box next to Minimum, and the largest value you have used to indicate your groups in the box next to Maximum
- Continue and click OK
| |

Jamovi | Jamovi | Jamovi | |

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'
| ANOVA > One Way ANOVA - Kruskal-Wallis
- Put your dependent variable in the box below Dependent Variables and your independent (grouping) variable in the box below Grouping Variable
| |

Practice questions | Practice questions | Practice questions | |