# Logistic regression - overview

This page offers structured overviews of one or more selected methods. Add additional methods for comparisons 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
Spearman's rho
Binomial test for a single proportion
Independent variablesIndependent variableIndependent variable
One or more quantitative of interval or ratio level and/or one or more categorical with independent groups, transformed into code variablesOne of ordinal levelNone
Dependent variableDependent variableDependent variable
One categorical with 2 independent groupsOne of ordinal levelOne categorical with 2 independent groups
Null hypothesisNull hypothesisNull hypothesis
Model chi-squared test for the complete regression model:
• $\beta_1 = \beta_2 = \ldots = \beta_K = 0$
Wald test for individual regression coefficient $\beta_k$:
• $\beta_k = 0$
or in terms of odds ratio:
• $e^{\beta_k} = 1$
Likelihood ratio chi-squared test for individual regression coefficient $\beta_k$:
• $\beta_k = 0$
or in terms of odds ratio:
• $e^{\beta_k} = 1$
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$
$\rho_s = 0$
$\rho_s$ is the unknown Spearman correlation in the population.

In words:
there is no monotonic relationship between the two variables in the population
$\pi = \pi_0$
$\pi$ is the population proportion of "successes"; $\pi_0$ is the population proportion of successes according to the null hypothesis
Alternative hypothesisAlternative hypothesisAlternative hypothesis
Model chi-squared test for the complete regression model:
• not all population regression coefficients are 0
Wald test for individual $\beta_k$:
• $\beta_k \neq 0$
or in terms of odds ratio:
• $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:
• right sided: $\beta_k > 0$
• left sided: $\beta_k < 0$
Likelihood ratio chi-squared test for individual $\beta_k$:
• $\beta_k \neq 0$
or in terms of odds ratio:
• $e^{\beta_k} \neq 1$
Two sided: $\rho_s \neq 0$
Right sided: $\rho_s > 0$
Left sided: $\rho_s < 0$
Two sided: $\pi \neq \pi_0$
Right sided: $\pi > \pi_0$
Left sided: $\pi < \pi_0$
AssumptionsAssumptionsAssumptions
• 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
Also pay attention to:
• Multicollinearity
• Outliers
Sample of pairs is a simple random sample from the population of pairs. That is, pairs are independent of one another

Note: this assumption is only important for the significance test, not for the correlation coefficient itself. The correlation coefficient itself just measures the strength of the monotonic relationship between two variables.
Sample is a simple random sample from the population. That is, observations are independent of one another
Test statisticTest statisticTest 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.
Wald test for individual $\beta_k$:
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}}$
SPSS uses the first definition

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.
$t = \dfrac{r_s \times \sqrt{N - 2}}{\sqrt{1 - r_s^2}}$
where $r_s$ is the sample Spearman correlation and $N$ is the sample size. The sample Spearman correlation $r_s$ is equal to the Pearson correlation applied to the rank scores.
$X$ = number of successes in the sample
Sampling distribution of $X^2$ and of the Wald statistic if H0 were trueSampling distribution of $t$ if H0 were trueSampling distribution of $X$ if H0 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
Sampling distribution of the Wald statistic:
• If defined as Wald $= \dfrac{b_k^2}{SE^2_{b_k}}$: approximately a chi-squared distribution with 1 degree of freedom
• If defined as Wald $= \dfrac{b_k}{SE_{b_k}}$: approximately a standard normal distribution
Sampling distribution of $X^2$, as computed in the likelihood ratio chi-squared test for individual $\beta_k$:
• chi-squared distribution with 1 degree of freedom
Approximately a $t$ distribution with $N - 2$ degrees of freedomBinomial($n$, $p$) distribution

Here $n = N$ (total sample size), and $p = \pi_0$ (population proportion according to the null hypothesis)
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$
For the Wald test:
• 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$.
Two sided:
Right sided:
Left sided:
Two sided:
• Check if $X$ observed in sample is in the rejection region or
• Find two sided $p$ value corresponding to observed $X$ and check if it is equal to or smaller than $\alpha$
Right sided:
• Check if $X$ observed in sample is in the rejection region or
• Find right sided $p$ value corresponding to observed $X$ and check if it is equal to or smaller than $\alpha$
Left sided:
• Check if $X$ observed in sample is in the rejection region or
• Find left sided $p$ value corresponding to observed $X$ and check if it is equal to or smaller than $\alpha$
Wald-type approximate $C\%$ confidence interval for $\beta_k$n.a.n.a.
$b_k \pm z^* \times SE_{b_k}$
where $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$n.a.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.
--
Example contextExample contextExample context
Can body mass index, stress level, and gender predict whether people get diagnosed with diabetes?Is there a monotonic relationship between physical health and mental health?Is the proportion smokers amongst office workers different from $\pi_0 = .2$?
SPSSSPSSSPSS
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 > Correlate > Bivariate...
• Put your two variables in the box below Variables
• Under Correlation Coefficients, select Spearman
Analyze > Nonparametric Tests > Legacy Dialogs > Binomial...
• Put your dichotomous variable in the box below Test Variable List
• Fill in the value for $\pi_0$ in the box next to Test Proportion
JamoviJamoviJamovi
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 > Correlation Matrix
• Put your two variables in the white box at the right
• Under Correlation Coefficients, select Spearman
• Under Hypothesis, select your alternative hypothesis
Frequencies > 2 Outcomes - Binomial test
• Put your dichotomous variable in the white box at the right
• Fill in the value for $\pi_0$ in the box next to Test value
• Under Hypothesis, select your alternative hypothesis
Practice questionsPractice questionsPractice questions