What Is Regression Equation?
Simple linear regression fits a straight line y = b₀ + b₁x that minimises the sum of squared vertical distances to the points. The slope b₁ says how much y changes per unit of x and the intercept b₀ is the predicted y at x = 0.
Beyond the equation, the calculator reports the correlation r, R² and adjusted R², the standard error of the slope with its t test, the ANOVA F statistic and a 95 % prediction interval for a new observation. It warns you when a prediction is an extrapolation outside the range of your data.
Below you will find the formulas, a variables table, a worked example and answers to common questions such as correlation versus regression and how to interpret the slope.
How to Use the Regression Equation Calculator
- Paste the x values and the y values, in matching order.
- Optionally enter an x value to predict y.
- Read the equation, then R² and the slope p-value to judge how well and how reliably the line fits.
- Check the residual plot for curvature, funnel shapes or outliers before trusting the result.
Regression Equation Formula
Slope
Intercept
Correlation and R²
Standard error of the slope and t test
Prediction interval
Regression Equation Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| b₁ | Slope | Change in y per unit of x |
| b₀ | Intercept | Predicted y when x = 0 |
| r | Correlation coefficient | −1 to 1 |
| R² | Share of variation explained | r² for simple regression |
| x̄, ȳ | Means of x and y | The line passes through (x̄, ȳ) |
Regression Equation Worked Example
With the example values loaded in the calculator above, the steps are:
- Means: x̄ = 4.5, ȳ = 9.075. Sxx = Σ(x − x̄)² = 42, Sxy = Σ(x − x̄)(y − ȳ) = 83.1, Syy = 165.195.
- Slope b₁ = Sxy ÷ Sxx = 83.1 ÷ 42 = 1.97857.
- Intercept b₀ = ȳ − b₁x̄ = 9.075 − 1.97857 × 4.5 = 0.171429.
- Equation: ŷ = 1.97857x + 0.171429.
- r = Sxy ÷ √(Sxx·Syy) = 0.99765, so R² = 0.9953.
- SSE = 0.775714; s = √(SSE ÷ (n − 2)) = 0.35956; SE(slope) = s ÷ √Sxx = 0.055482; t = 35.66.
Result: Regression equation = ŷ = 1.97857x + 0.171429; Slope b₁ = 1.97857; Correlation r = 0.99765; Prediction at x = 10 = 19.9571.
How to Read the Regression Equation
The fitted line is ŷ = 1.9786x + 0.1714, so each extra unit of x adds about 1.98 to the predicted y. R² = 0.9953, so the line explains nearly all of the variation, and the slope's t statistic of 35.66 is overwhelmingly significant.
The prediction at x = 10 is 19.96, with a 95% prediction interval of 18.76 to 21.15. Note that the data run only from x = 1 to x = 8, so x = 10 is an extrapolation: the interval assumes the straight line keeps going, which the data cannot confirm. The intercept, 0.17, is likewise a prediction outside the observed range, at x = 0.
How to interpret the output
| Output | Meaning | What to look for |
|---|---|---|
| Slope b₁ | Average change in y per unit of x | Sign and size in context; CI excluding 0 supports a real relationship |
| Intercept b₀ | Predicted y at x = 0 | Meaningful only if x = 0 is plausible |
| r | Strength and direction of the linear relationship | |r| above 0.7 is strong |
| R² | Share of variance in y explained by x | Higher is better, but context matters |
| p-value for slope | Evidence the true slope is not 0 | Below 0.05 is conventionally significant |
| Standard error s | Typical residual size in y units | Compare with the spread of y |
Assumptions and diagnostics
- Linearity: the relationship is roughly straight. A curved pattern in the residual plot means a different model is needed.
- Independence: observations do not influence each other (be careful with time series).
- Constant variance: residuals have about the same spread across x. A funnel shape violates this.
- Normal residuals: matters mainly for the p-values and intervals with small samples.
- No influential outliers: a single extreme point can tilt the line. Check the scatter plot.
Prediction and extrapolation
Two intervals are reported. The confidence interval for the mean response says where the average y at that x probably lies. The prediction interval is wider and says where a single new observation will probably fall. Predictions are most reliable near the mean of x and inside the range of your data. Predicting far outside it, extrapolation, assumes the straight-line relationship continues, which is often false.
Correlation is not causation
A strong fit shows that x and y move together, not that x causes y. A hidden third variable may drive both, or the direction may be reversed. Only a well-designed experiment or a careful causal analysis can establish cause.
Where Regression Equation Is Used
Line of best fit
Find the regression equation from paired data.
Prediction
Predict y at a new x within the data range.
Significance
Test the slope and read R² and adjusted R².
Checking working
Use the calculation table to follow the sums.
Common Regression Equation Mistakes to Avoid
- Always plot the data first.
- Do not extrapolate far beyond your data.
- A high R² does not prove the model is right; check the residuals.
- For several predictors use multiple regression in a statistics package.
Regression Equation Terms and Definitions
- Residual
- Observed y minus the fitted ŷ.
- Least squares
- Choosing the line that minimises the sum of squared residuals.
- Prediction interval
- Range likely to contain a single future observation.
Regression Equation FAQs
How do you find the regression equation?
Compute the slope as Sxy/Sxx and the intercept as ȳ − b₁x̄. The calculator shows each step.
What does R² mean?
The proportion of the variation in y explained by the linear relationship with x. R² = 0.8 means 80% is explained.
What is the difference between r and R²?
r is the correlation, between −1 and 1, and shows direction. R² is its square, between 0 and 1, the share of variance explained.
What is a residual plot used for?
To check whether a straight line is appropriate. A random cloud around zero is good; curves or funnels signal problems.
What is the difference between a confidence interval and a prediction interval?
The confidence interval is for the average y at a given x. The prediction interval is for one new observation and is always wider.
Can I use this for non-linear data?
Not directly. Try the curve fitting calculator for polynomial, exponential, power and logarithmic models, or the non-linear regression calculator.
How many data points do I need?
At least 3 are required, but 20 or more give much more reliable results.
What do the slope and intercept mean?
The slope is the predicted change in y for each one-unit increase in x. The intercept is the predicted y when x = 0, which may not be meaningful if x = 0 is outside your data.
What does R² tell me?
R² is the share of the variation in y explained by the line, from 0 to 1. A high R² does not prove x causes y, and it says nothing about whether a line is the right shape.
How is the least squares line found?
The slope is b1 = Sxy ÷ Sxx and the intercept is b0 = mean of y − b1 × mean of x. This choice minimises the sum of squared vertical distances from the points to the line.
Can I predict outside my data range?
You can compute it, but extrapolating is risky because the relationship may not continue. Prefer predictions inside the range of your x values.