Linear Regression: How to Run It Online and Report It in APA7
Linear regression fits a straight-line (or plane) model that predicts a continuous outcome from one or more predictors.
What is Linear Regression?
Linear regression fits a straight-line (or plane) model that predicts a continuous outcome from one or more predictors.
When to use it
Use it when the outcome is continuous and you want to predict it, estimate each predictor's unique effect, or control for confounders.
Example question: Do study hours and sleep hours predict exam score?
Preparing your data
One row per participant, one numeric column for the outcome and one column per predictor. Categorical predictors should be coded (for example 0 = control, 1 = treatment).
Example dataset (simulated; first rows of 100): id, study_hours, sleep_hours (predictors), exam_score (outcome, 0 to 100).
| id | study_hours | sleep_hours | exam_score |
|---|---|---|---|
| 1.0 | 14.7 | 5.4 | 79.0 |
| 2.0 | 12.1 | 9.0 | 70.0 |
| 3.0 | 8.9 | 6.0 | 79.0 |
| 4.0 | 15.8 | 5.1 | 83.0 |
| 5.0 | 14.8 | 7.3 | 78.0 |
| 6.0 | 7.8 | 7.3 | 59.0 |
Download the full example CSV to practise. If the tool asks for a different layout, follow the instructions on its page.
How to run it on StatFas
- Open the Linear Regression tool. You do not need an account to run an analysis.
- Enter your data or upload your file, laid out as described in Preparing your data.
- Select your variables. Select the continuous outcome and one or more predictors.
- Choose any options the tool offers (for example the confidence level, a post hoc test or the error bar type) and run the analysis.
- Read the results on the page. Check the assumptions first, then the test statistic, the p-value and the effect size.
- To save your results, log in or create a free account. Every analysis stays free; the account is only needed to download.
Assumptions and checks
- Linearity: the outcome changes in a straight-line way with each predictor (check residual plots).
- Independence of errors: one row per person; no clustering or repeated measures.
- Homoscedasticity: residuals have similar spread across predicted values.
- Normally distributed residuals (important mainly for small samples).
- No severe multicollinearity (variance inflation factors below about 5 to 10) and no overly influential outliers.
Key numbers to look at
- R2 and adjusted R2: variance explained.
- Overall F test with its degrees of freedom.
- Unstandardised b (change in outcome per unit change in predictor), standardised β, 95% CI and p.
- VIF for multicollinearity and residual diagnostics.
Effect size
R2 ≈ .02 small, .13 medium, .26 large (Cohen, 1988). For single predictors report b or β with its confidence interval.
Benchmarks such as small, medium and large are conventions (Cohen, 1988), not rules. Interpret size in the context of your field.
Reporting Linear Regression in APA7 style
Template
Put all coefficients in a table with columns b, SE, β, 95% CI and p.
Worked example (simulated data)
The numbers below were computed from the example CSV above, so you can reproduce them. They illustrate the format and are not real findings.
| Predictor | b | SE | β | 95% CI | p |
|---|---|---|---|---|---|
| Intercept | 48.46 | 4.79 | — | [38.95, 57.97] | < .001 |
| study hours | 1.67 | 0.19 | .66 | [1.29, 2.05] | < .001 |
| sleep hours | 0.45 | 0.59 | .06 | [−0.73, 1.62] | .454 |
APA7 reminders: italicise statistical symbols (M, SD, t, F, p, r), report exact p-values to two or three decimals (use p < .001 for very small values), omit the leading zero for values that cannot exceed 1 (.45, not 0.45), and put degrees of freedom in parentheses. See the APA7 cheat sheet.
Common mistakes
- Reading β as a causal effect.
- Not checking the residuals.
- Dropping predictors one by one until everything is significant (this inflates false positives).
Related analyses and alternatives
- Logistic Regression: If the outcome is yes/no.
- Moderation: If the effect of one predictor depends on another.
- Pearson Correlation: For a single pair of variables.
Not sure which analysis you need? Use the test chooser.
Frequently asked questions
What is the difference between b and β?
b is in the original units of the variables. β is standardised, so coefficients can be compared across predictors measured on different scales.
How big a sample do I need?
As a starting point, 10–20 cases per predictor, but a power analysis based on the expected effect size is better.
References
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). https://doi.org/10.1037/0000165-000
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
This guide is for learning and for preparing results for your own reports. You remain responsible for choosing an appropriate analysis, checking its assumptions and interpreting the results. Follow the formatting rules of your journal or institution where they differ from APA7.