Regression Calculator
Fit a simple linear regression line y = a + bx.
How simple linear regression works
Simple linear regression fits a straight line y = a + bx through paired data by the method of least squares, minimising the sum of squared vertical distances from the points to the line.
The slope b is the change in y for a one-unit change in x. The intercept a is the value of y when x is zero. R² is the proportion of the variation in y explained by x.
This is a simple linear regression with one predictor. It does not fit multivariate models, non-linear relationships, or extrapolate reliably beyond the range of your data.
The formulas
b = Σ((x−x̄)(y−ȳ)) ÷ Σ((x−x̄)²) · a = ȳ − b·x̄ · R² = r²
The slope is the covariance of x and y divided by the variance of x. The intercept places the line through the means. R² is the square of the Pearson correlation and ranges from 0 to 1.
Worked example
X = 1,2,3 and Y = 3,5,7
The points lie on y = 1 + 2x, so the slope is 2, the intercept is 1, r = 1 and R² = 1 — a perfect fit.
Frequently asked questions
What does R² tell me?
R² is the proportion of variance in y explained by x. R² = 0.9 means 90% of the variation is explained by the model; the rest is due to other factors or noise.
Can I use this for non-linear data?
The model always fits a straight line. If the relationship is curved, a straight line may fit poorly even with a moderate R² — consider transforming the variables or a different model.
Can I predict outside my data range?
Extrapolation beyond the observed range of x assumes the relationship continues unchanged, which is often unsafe. Interpret such predictions with caution.
Related research methods
- Regression Analysis
- Correlation Analysis
When to use this tool
Use simple linear regression when you want to model and predict a continuous outcome from one or more predictors.
Assumptions
- Approximate linearity.
- Independent observations.
- Approximately constant variance (homoscedasticity).
- Approximate normality of residuals for inference.
Limitations
- A fitted model within the observed range may not generalise outside it.
- Correlation and regression do not establish causation.
- Small samples give unstable slopes.
How to interpret the result
The slope is the expected change in the outcome for a one-unit change in the predictor; R² is the proportion of variance explained.
How to report the result
Report the regression equation, the slope and intercept, standard errors, R², and sample size.
Next steps in your analysis
Related tools
Related guides
- How to Choose the Right Statistical TestA practical framework for picking the right statistical test: start from your research question, data type and study design, then check the assumptions.
- Correlation vs RegressionThe difference between measuring a linear association (correlation) and modelling a relationship to make predictions (regression), and how R² connects them.
Built by PanelRoster
PanelRoster is an enterprise operations management platform for organizations coordinating distributed teams, assignments, workflows, quality assurance and operational execution.
Explore PanelRoster