Regression (OLS)

This page offers all the basic information you need about 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 regression analysis with other statistical methods, go to Statkat's or practice with 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. Regression analysis requires the following variable types:

Variable types required for 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 quantitative of interval or ratio level

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

Regression analysis tests the following null hypothesis (H0):

$F$ test for the complete regression model: $t$ test for individual regression coefficient $\beta_k$: in the regression equation $ \mu_y = \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 $\mu_y$ represents the population mean of the dependent variable $ y$ given the scores on the independent variables.
Alternative hypothesis

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

$F$ test for the complete regression model: $t$ 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).

Regression analysis makes the following assumptions:

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

Regression analysis is based on the following test statistic:

$F$ test for the complete regression model: $t$ test for individual $\beta_k$: Note 1: mean square model is also known as mean square regression, and mean square error is also known as mean square residual.
Note 2: if there is only one independent variable in the model ($K = 1$), the $F$ test for the complete regression model is equivalent to the two sided $t$ test for $\beta_1.$
Sample standard deviation of the residuals $s$

$\begin{aligned} s &= \sqrt{\dfrac{\sum (y_j - \hat{y}_j)^2}{N - K - 1}}\\ &= \sqrt{\dfrac{\mbox{sum of squares error}}{\mbox{degrees of freedom error}}}\\ &= \sqrt{\mbox{mean square error}} \end{aligned} $
Sampling distribution

Sampling distribution of $F$ and of $t$ if H0 were true:

Sampling distribution of $F$: Sampling distribution of $t$:
Significant?

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

$F$ test: $t$ Test two sided: $t$ Test right sided: $t$ Test left sided:
$C\%$ confidence interval for $\beta_k$ and for $\mu_y$, $C\%$ prediction interval for $y_{new}$

Confidence interval for $\beta_k$: Confidence interval for $\mu_y$, the population mean of $y$ given the values on the independent variables: Prediction interval for $y_{new}$, the score on $y$ of a future respondent: In all formulas, the critical value $t^*$ is the value under the $t_{N - K - 1}$ distribution with the area $C / 100$ between $-t^*$ and $t^*$ (e.g. $t^*$ = 2.086 for a 95% confidence interval when df = 20).
Effect size

Complete model: Per independent variable:
Visual representation

Regression equations with:
ANOVA table

This is how the entries of the ANOVA table are computed:

ANOVA table regression analysis
Example context

Regression analysis could for instance be used to answer the question:

Can mental health be predicted from fysical health, economic class, and gender?
SPSS

How to perform a regression analysis in SPSS:

Analyze > Regression > Linear...
Jamovi

How to perform a regression analysis in jamovi:

Regression > Linear Regression