Logistic regression

This page offers all the basic information you need about logistic regression analysis. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find p values, SPSS how-to’s and more.

To compare logistic regression analysis with other statistical methods, go to Statkat's or practice with logistic regression analysis at Statkat's

Contents

When to use?

Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables. Logistic regression analysis requires the following variable types:

Variable types required for logistic regression analysis :
Independent variables:
One or more quantitative of interval or ratio level and/or one or more categorical with independent groups, transformed into code variables
Dependent variable:
One categorical with 2 independent groups

Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).

If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.

Null hypothesis

Logistic regression analysis tests the following null hypothesis (H0):

Model chi-squared test for the complete regression model: Wald test for individual regression coefficient $\beta_k$: Likelihood ratio chi-squared test for individual regression coefficient $\beta_k$: in the regression equation $ \ln \big(\frac{\pi_{y = 1}}{1 - \pi_{y = 1}} \big) = \beta_0 + \beta_1 \times x_1 + \beta_2 \times x_2 + \ldots + \beta_K \times x_K $. Here $ x_i$ represents independent variable $ i$, $\beta_i$ is the regression weight for independent variable $ x_i$, and $\pi_{y = 1}$ represents the true probability that the dependent variable $ y = 1$ (or equivalently, the proportion of $ y = 1$ in the population) given the scores on the independent variables.
Alternative hypothesis

Logistic regression analysis tests the above null hypothesis against the following alternative hypothesis (H1 or Ha):

Model chi-squared test for the complete regression model: Wald test for individual regression coefficient $\beta_k$: Likelihood ratio chi-squared test for individual regression coefficient $\beta_k$:
Assumptions

Statistical tests always make assumptions about the sampling procedure that was used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).

Logistic regression analysis makes the following assumptions:

Often ignored additional assumption: Also pay attention to:
Test statistic

Logistic regression analysis is based on the following test statistic:

Model chi-squared test for the complete regression model: Wald test for individual $\beta_k$:
The wald statistic can be defined in two ways: SPSS uses the first definition.

Likelihood ratio chi-squared test for individual $\beta_k$:
Sampling distribution

Sampling distribution of $X^2$ and of the Wald statistic if H0 were true:

Sampling distribution of $X^2$, as computed in the model chi-squared test for the complete model: Sampling distribution of the Wald statistic: Sampling distribution of $X^2$, as computed in the likelihood ratio chi-squared test for individual $\beta_k$:
Significant?

This is how you find out if your test result is significant:

For the model chi-squared test for the complete regression model and likelihood ratio chi-squared test for individual $\beta_k$: For the Wald test:
Wald-type approximate $C\%$ confidence interval for $\beta_k$

$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$

$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

Logistic regression analysis could for instance be used to answer the question:

Can body mass index, stress level, and gender predict whether people get diagnosed with diabetes?
SPSS

How to perform a logistic regression analysis in SPSS:

Analyze > Regression > Binary Logistic...
Jamovi

How to perform a logistic regression analysis in jamovi:

Regression > 2 Outcomes - Binomial