How to use
This simple linear regression calculator fits the least-squares line between an independent variable X and dependent variable Y. It reports slope b, intercept a, correlation r and R², and can predict ŷ for a new X value. A fitted line describes association; it does not prove causation.
- Enter the X values in order.
- Enter the same number of Y values in matching order.
- Optionally enter a new X for prediction, then calculate.
How it is calculated
Example
Example: X=1,2,3,4,5 and Y=2,4,5,4,5 give approximately ŷ=2.2+0.6x and R²=0.6. At X=6, ŷ≈5.8.
Important notes
X must vary; if every X is identical, slope is undefined. If Y is perfectly constant, the regression line still exists but the usual r and R² interpretation is undefined, so those fields may show as unavailable.
Frequently asked questions
What is the difference between r and R²?
r gives the direction and strength of linear association; in simple regression, R² summarizes the fraction of Y variation associated with the fitted linear model.
Can I extrapolate beyond the X range?
You can compute it, but extrapolation may be much less reliable because the relationship can change outside observed data.
Does regression prove causation?
No. Regression and correlation alone do not establish causality.
Is this calculator free?
Yes. It is free to use and requires no account.