Guides / regression analysis
Regression analysis: a complete guide
Regression estimates how an outcome changes as a predictor changes, while holding other variables constant — and that last clause is where most of its power and most of its misinterpretation live. This guide works a simple regression through by hand, explains what a coefficient means in a multiple model, and covers the diagnostic checks that decide whether the output can be trusted.
Regression analysis is a statistical method for modelling the relationship between an outcome variable and one or more predictors. It estimates how much the outcome changes for each unit change in a predictor, and in multiple regression it does so while holding the other predictors constant. The output is a set of coefficients, each with a standard error, significance test and confidence interval.
Definition
What regression does
Regression fits a line, or a plane, through your data so that the total squared distance from the observed points to the line is as small as possible. The result is an equation that predicts the outcome from the predictors.
For one predictor, the model is y = b₀ + b₁x + e. The intercept b₀ is the predicted outcome when the predictor is zero, the slope b₁ is how much the outcome changes per unit of the predictor, and e is the residual — the part of each observation the model does not explain.
Squaring makes all deviations positive and penalises large misses disproportionately, which is what produces a unique best-fit line. The distances are measured vertically because the model treats the predictor as known and the outcome as the thing being predicted — the asymmetry is deliberate, and it is why regressing y on x gives a different line from regressing x on y.
Choosing
Simple, multiple and the wider family
| Model | Outcome | Predictors |
|---|---|---|
| Simple linear | Continuous | One continuous or binary |
| Multiple linear | Continuous | Two or more |
| Logistic | Binary | Any |
| Ordinal | Ordered categories | Any |
| Poisson / negative binomial | Counts | Any |
| Multilevel / mixed | Any, with nesting | Any, plus random effects |
The family is larger than most courses cover, and choosing the wrong member is a common and consequential error. The decision is driven almost entirely by the nature of the outcome: continuous outcomes take linear regression, binary outcomes take logistic, counts take Poisson or negative binomial, and any outcome measured repeatedly on the same units needs a multilevel or mixed model regardless of its type.
If your data are clustered — pupils within schools, patients within wards, repeated measures within people — ordinary regression treats correlated observations as independent, understates the standard errors, and produces p-values that are too small. No amount of adding covariates fixes this; it needs a multilevel model.
Send your outcome, predictors and design. A named statistician confirms the model, fits it, checks the diagnostics and returns annotated output.
Get a fixed quoteWorked example
Worked example: simple regression by hand
Six students report weekly study hours (x) and achieve exam scores (y). We want the line predicting score from hours.
| Student | x | y | x−x̄ | y−ȳ | (x−x̄)(y−ȳ) | (x−x̄)² |
|---|---|---|---|---|---|---|
| 1 | 2 | 52 | −3 | −12 | 36 | 9 |
| 2 | 3 | 55 | −2 | −9 | 18 | 4 |
| 3 | 4 | 61 | −1 | −3 | 3 | 1 |
| 4 | 6 | 68 | 1 | 4 | 4 | 1 |
| 5 | 7 | 74 | 2 | 10 | 20 | 4 |
| 6 | 8 | 74 | 3 | 10 | 30 | 9 |
| Sum | 30 | 384 | 0 | 0 | 111 | 28 |
Step 1 — the means
x̄ = 30 / 6 = 5 and ȳ = 384 / 6 = 64
Step 2 — the slope
b₁ = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)² = 111 / 28 = 3.964
Step 3 — the intercept
b₀ = ȳ − b₁x̄ = 64 − (3.964 × 5) = 64 − 19.82 = 44.18
Step 4 — the equation
score = 44.18 + 3.964 × hours
So each additional weekly study hour is associated with about 3.96 more exam marks, and a student studying zero hours is predicted to score 44.18 — a figure that lies outside the observed range of the data and should be treated with caution.
Step 5 — how well does it fit?
Total sum of squares SSₜₒₜ = Σ(y−ȳ)² = 450. Regression sum of squares SSₕₑₔ = b₁ × Σ(x−x̄)(y−ȳ) = 3.964 × 111 = 440.04.
R² = 440.04 / 450 = 0.978 — the model accounts for about 98% of the variance in scores.
Real educational data almost never behave like this; the numbers here were chosen so the arithmetic stays clean. In practice an R² above about 0.9 in behavioural research usually means a variable has been regressed on a version of itself, or that the sample is too small for the figure to mean much.
Interpretation
Interpreting coefficients
| Output | What it means |
|---|---|
b (unstandardised) | Change in the outcome per one-unit change in the predictor, in original units |
β (standardised) | Change in SDs of the outcome per one SD of the predictor |
SE | How precisely the coefficient is estimated |
t and p | Whether the coefficient differs from zero |
| 95% CI | The range of plausible values for the coefficient |
One further quantity is worth knowing about even though it rarely appears in student write-ups: the semi-partial correlation, sometimes called the part correlation. Squared, it gives the proportion of variance in the outcome uniquely attributable to that predictor — the amount R² would fall by if the predictor were removed. It is often more informative than the standardised coefficient for answering “how much does this variable actually add?”, because it is expressed on the same scale as R² and is not distorted by the predictor's own variability. Most software reports it alongside the coefficients; it is simply overlooked.
When to use which
Report the unstandardised coefficient when the units are meaningful — “each additional study hour is worth 3.96 marks” is directly interpretable and is what a reader can act on. Report standardised coefficients when comparing the relative importance of predictors measured on different scales, since the raw coefficients are not comparable across units.
β depends on the variability of the predictor in your particular sample. A predictor with restricted range in your data will have a small β even if it matters a great deal in the population. Comparing βs across studies with different sampling is not valid.
Note also that a coefficient's significance answers a narrower question than most readers assume. It tests whether that predictor adds anything once the others are in the model. A predictor strongly related to the outcome on its own can appear non-significant simply because another predictor already captures the same information.
Model fit
R squared and how much it really tells you
| Statistic | What it measures | Caution |
|---|---|---|
| R² | Proportion of outcome variance explained | Always rises when predictors are added, even useless ones |
| Adjusted R² | R² penalised for the number of predictors | Use this one for multiple regression |
| F test | Whether the model beats predicting the mean | Significant does not mean useful |
| Standard error of the estimate | Typical size of a prediction error | In outcome units — often the most practical figure |
R² increases mechanically with every predictor added, including random noise, which is why adjusted R² exists and why it should be the one reported whenever there is more than one predictor. If adding a variable raises R² but lowers adjusted R², that variable is not earning its place.
In fields where outcomes are driven by many unmeasured factors — most of psychology, education and economics — an R² of .15 can represent a genuinely useful finding. What matters is whether the coefficients are precisely estimated and substantively meaningful, not whether the model explains most of the variance.
Multiple predictors
Multiple regression and the meaning of 'controlling for'
In a multiple regression, each coefficient describes the association between that predictor and the outcome with the other predictors held constant. This is the phrase that does most of the work in a discussion section, and it deserves precision.
“Holding constant” is a statistical operation, not an experimental one. The model estimates what the relationship would look like among cases that were identical on the other measured variables. It cannot hold constant anything you did not measure, and it cannot make an observational design causal.
| Claim | Justified? |
|---|---|
| “Study hours predicted scores, controlling for prior attainment” | Yes — describes the model |
| “Study hours affected scores independently of prior attainment” | Only if prior attainment is the sole confounder |
| “Increasing study hours would raise scores by 3.96 marks” | No — that is a causal claim from observational data |
A related and more subtle problem is that adding a variable can change a coefficient's sign entirely. This is not a bug: it happens when the added variable was suppressing or confounding the original relationship, and the reversed sign may be the more accurate estimate. But it also means a coefficient reported from one model cannot be quoted as though it were a property of the predictor itself. It is a property of that predictor in that model, and changing the covariates changes it. Always state which variables were in the model alongside any coefficient you report.
Multicollinearity
When predictors are strongly correlated with each other, the model struggles to separate their contributions. Coefficients become unstable, swinging in size or even sign when another variable is added, and standard errors inflate. Check the variance inflation factor; values above about 5 warrant attention and above 10 are usually taken as serious.
A model with badly collinear predictors can still predict the outcome perfectly well. What it cannot do is tell you which predictor is responsible. If your question is predictive, collinearity may not matter; if it is explanatory, it may invalidate the whole analysis.
Assumptions
Assumptions and diagnostics
| Assumption | How to check | If violated |
|---|---|---|
| Linearity | Residuals vs fitted plot | Transform, or add a quadratic term |
| Independence | Study design; Durbin-Watson for time series | Multilevel model or time-series methods |
| Homoscedasticity | Residuals vs fitted — look for a funnel | Robust standard errors, or transform the outcome |
| Normality of residuals | Q-Q plot of residuals | Usually robust with large n; else bootstrap |
| No influential outliers | Cook’s distance, leverage | Investigate; report with and without |
| No severe multicollinearity | VIF | Drop or combine predictors |
The residuals-versus-fitted plot is the single most informative diagnostic and takes seconds to produce. A healthy plot shows a formless band of points around zero. A funnel widening to the right means the variance grows with the prediction, so your standard errors and therefore your p-values are wrong. A curve means the relationship is not linear and the model is systematically wrong at both ends.
Not to the outcome variable, and not to the predictors. A skewed outcome can produce perfectly normal residuals once the predictors are accounted for, and testing the raw variable will mislead you into transforming data that did not need it.
Sample size
How many participants do you need?
Rules of thumb are widely quoted and mostly too crude to rely on, but they are useful as a floor.
| Rule | Requirement | Comment |
|---|---|---|
N ≥ 50 + 8k | For testing the overall model | k = number of predictors |
N ≥ 104 + k | For testing individual predictors | Stricter, and usually the relevant one |
| 10–20 cases per predictor | General guidance | Depends heavily on effect size |
With 4 predictors, the second rule gives a minimum of 108 participants for individual coefficients to be tested with reasonable power. A proper power analysis is better than any of these, because the requirement depends on the size of effect you want to detect, and a small expected effect can demand several times the rule-of-thumb figure.
With too few cases per predictor the model fits the noise in your particular sample. R² looks impressive, the coefficients look meaningful, and none of it replicates. If you have 30 cases and 8 predictors, the model is describing your sample, not the population.
Our power analysis calculator gives the sample needed to detect the effect you care about at your chosen power and significance level.
Use the calculatorPitfalls
Seven mistakes that cost marks
1. Claiming causation from observational data
Regression describes association. “Predicted” is a statistical term, not a causal one, and readers will take it literally if you are not careful.
2. Interpreting the intercept when zero is impossible
If no participant has a predictor value of zero, the intercept is an extrapolation. Centre the predictors to make it meaningful.
3. Reporting R² rather than adjusted R² in multiple regression
R² rises with every predictor added, including irrelevant ones.
4. Not plotting the residuals
One plot checks three assumptions. Omitting it is the most common reason a violated assumption goes undetected.
5. Ignoring clustering in the data
Pupils within schools or repeated measures within people need a multilevel model. Ordinary regression will give p-values that are too small.
6. Too many predictors for the sample
The model will fit noise and will not replicate. Check the sample size rules before fitting.
7. Extrapolating beyond the observed range
A model fitted on 2 to 8 study hours says nothing reliable about 20 hours.
Reporting
Reporting regression in APA style
| Element | How to write it |
|---|---|
| Overall model | F(2, 107) = 18.44, p < .001, R² = .26, adjusted R² = .24 |
| A predictor | b = 3.96, SE = 0.42, β = .48, t(107) = 9.43, p < .001, 95% CI [3.13, 4.79] |
| Non-significant predictor | b = 0.21, SE = 0.38, β = .04, t(107) = 0.55, p = .583 |
“The model significantly predicted exam performance, F(2, 107) = 18.44, p < .001, adjusted R² = .24. Weekly study hours was a significant predictor (b = 3.96, 95% CI [3.13, 4.79], β = .48, p < .001), indicating that each additional hour was associated with approximately four additional marks with prior attainment held constant. Residual plots showed no evidence of heteroscedasticity or non-linearity.”
Send your dataset and research question. A named statistician fits the model, runs the diagnostics, and returns APA tables with the coefficients interpreted in plain language.
See SPSS data analysisAnswers
Frequently asked questions
What is the difference between correlation and regression?
Correlation measures the strength and direction of association between two variables in a single symmetric number. Regression fits an equation predicting one variable from others, giving a slope in real units, allowing several predictors at once, and letting you hold other variables constant.
What does R squared mean in regression?
The proportion of variance in the outcome explained by the model. An R squared of .26 means the predictors account for 26% of the variation. It rises whenever predictors are added, even useless ones, so adjusted R squared should be reported whenever there is more than one predictor.
What does 'controlling for' actually mean?
That the coefficient describes the association between a predictor and the outcome among cases identical on the other measured variables. It is a statistical adjustment, not an experimental one: it cannot control for variables you did not measure, and it does not make an observational design causal.
How do I know if my regression assumptions are met?
Plot the residuals against the fitted values first — that single chart diagnoses linearity, homoscedasticity and outliers. Add a Q-Q plot of the residuals for normality, VIF for multicollinearity, and Cook's distance for influential cases.
How many participants do I need for regression?
A common rule is N greater than or equal to 104 plus the number of predictors for testing individual coefficients, so roughly 108 for four predictors. These are floors rather than targets; a proper power analysis based on the effect size you expect is considerably more reliable.
What is multicollinearity and does it matter?
It occurs when predictors are strongly correlated with each other, making it hard for the model to separate their contributions. Coefficients become unstable and standard errors inflate. Check VIF, where above 5 warrants attention. It damages interpretation of individual predictors but not overall prediction.
Can regression prove that one variable causes another?
No. Regression estimates association, however many covariates are included. Causal claims require design features such as randomisation or a credible identification strategy. Use wording such as 'was associated with' or 'predicted' rather than 'caused' or 'increased'.
Should I report standardised or unstandardised coefficients?
Unstandardised when the units are meaningful, since they can be interpreted directly. Standardised when comparing the relative contribution of predictors measured on different scales. Standardised coefficients depend on the variability in your sample, so they are not comparable across studies.
Send the data. Get a fixed quote.
Attach your dataset or just describe the project. A named statistician replies with a price and a deadline, usually within one working day.