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
One sample $z$ test for the mean
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 quantitative of interval or ratio level
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
$\mu = \mu_0$
$\mu$ is the unknown population mean; $\mu_0$ is the population mean 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: $\mu \neq \mu_0$
Right sided: $\mu > \mu_0$
Left sided: $\mu < \mu_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
Often ignored additional assumption:
  • 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.
  • Scores are normally distributed in the population
  • Population standard deviation $\sigma$ is known
  • 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.
$z = \dfrac{\bar{y} - \mu_0}{\sigma / \sqrt{N}}$
$\bar{y}$ is the sample mean, $\mu_0$ is the population mean according to H0, $\sigma$ is the population standard deviation, $N$ is the sample size.

The denominator $\sigma / \sqrt{N}$ is the standard deviation of the sampling distribution of $\bar{y}$. The $z$ value indicates how many of these standard deviations $\bar{y}$ is removed from $\mu_0$
Sampling distribution of $X^2$ and of the Wald statistic if H0 were trueSampling distribution of $t$ if H0 were trueSampling distribution of $z$ 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 freedomStandard normal
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: Right sided: Left sided:
Wald-type approximate $C\%$ confidence interval for $\beta_k$n.a.$C\%$ confidence interval for $\mu$
$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)
-$\bar{y} \pm z^* \times \dfrac{\sigma}{\sqrt{N}}$
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)

The confidence interval for $\mu$ can also be used as significance test.
Goodness of fit measure $R^2_L$n.a.Effect size
$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.
-Cohen's $d$:
Standardized difference between the sample mean and $\mu_0$: $$d = \frac{\bar{y} - \mu_0}{\sigma}$$ Indicates how many standard deviations $\sigma$ the sample mean $\bar{y}$ is removed from $\mu_0$
n.a.n.a.Visual representation
--
One sample z test
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 average mental health score of office workers different from $\mu_0$ = 50? Assume that the standard deviation of the mental health scores in the population is $\sigma$ = 3.
SPSSSPSSn.a.
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
-
JamoviJamovin.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 > Correlation Matrix
  • Put your two variables in the white box at the right
  • Under Correlation Coefficients, select Spearman
  • Under Hypothesis, select your alternative hypothesis
-
Practice questionsPractice questionsPractice questions