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
Using the example values (press “Load example” above to try them):
- 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 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
Predicting y from x
Using the fitted line to estimate a value for a new x.
Describing a trend
Reporting slope, intercept and R² for a relationship.
Testing the slope
Checking whether the relationship is statistically significant.
Checking residuals
Looking at the residual plot for curvature or unequal spread.
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.