Linear Regression Calculator
Fit a least-squares straight line to paired observations and find its slope and intercept.
Result for the values shown.
Calculations run in your browser.
What to enter
| Input | Meaning and units |
|---|---|
| X observations | Use paired lists of equal length, with at least two observations. Separate numbers with commas or line breaks. |
| Y observations | Use paired lists of equal length, with at least two observations. Separate numbers with commas or line breaks. |
Understanding your result
These are descriptive results for the observations you entered, not proof of causation, significance or a particular population distribution.
Common mistakes
- Misaligning the paired lists, or treating association as causation.
Check your calculation
- Try a small hand-checkable list; confirm the stated quartile/rank/denominator convention before comparing with another application.
Calculation checks, sources and review limits
What straight line best fits these paired x and y observations?
Fit a least-squares straight line to paired observations and find its slope and intercept.
Common uses
- Fit a least-squares straight line to paired observations and find its slope and intercept.
How it works
OLS slope=sum((x-xbar)(y-ybar))/sum((x-xbar)^2); intercept=ybar-slope*xbar. Lists accept commas, semicolons, spaces or line breaks as separators; use a dot for decimals. At most 10,000 observations are supported. Calculations use floating-point arithmetic; displayed numeric results have up to 12 significant digits.
Worked example
Enter X observations: 1, 2, 3; Y observations: 3, 5, 7. The result is Slope: 2; Intercept: 1.
FAQ
What straight line best fits these paired x and y observations?
OLS slope=sum((x-xbar)(y-ybar))/sum((x-xbar)^2); intercept=ybar-slope*xbar. Lists accept commas, semicolons, spaces or line breaks as separators; use a dot for decimals. At most 10,000 observations are supported. Calculations use floating-point arithmetic; displayed numeric results have up to 12 significant digits.
What assumptions and limits apply?
Reject constant x; descriptive fit only, no causal claim or automatically valid inference.