Linear Regression Calculator
Fit a least-squares line to paired data with slope, intercept, R², standard error of the slope and a prediction.
Your inputs
Results
Regression line
y = 0.6x + 2.2
- Slope
- 0.6
- Intercept
- 2.2
- R²
- 0.6
- Standard error of the slope
- 0.282843
- Predicted y
- 5.8
- Mean of x
- 3
✓Exact calculation — rounded only for display
Notes for this result
- The prediction is outside the range of your x data (extrapolation), so treat it with caution.
What this calculator does
Simple linear regression finds the straight line that minimises squared vertical errors.
Formula and method
slope = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²; intercept = ȳ − slope × x̄; SE(slope) = √(SSE ÷ (n − 2) ÷ Sxx)
Worked example
Calculated by this tool with its default inputs:
Inputs
- X values: 1, 2, 3, 4, 5
- Y values (same count): 2, 4, 5, 4, 5
- Predict y at x =: 6
Results
- Regression line: y = 0.6x + 2.2
- Slope: 0.6
- Intercept: 2.2
- R²: 0.6
- Standard error of the slope: 0.282843
- Predicted y: 5.8
How to read the results
R² is the share of variation in y explained by the line.
Assumptions and limitations
- Predictions outside the observed x range are extrapolations.
Questions
Is a high R² enough?
No — check residuals for patterns that a straight line misses.
Methodology and verification
- Result type
- Exact mathematical calculation (rounded only for display)
- Formula version
- 1.0
- Automated verification
- 3 reference and validation test cases, checked against independently computed values. The site cannot be built if any of them fail.
- Editorial review
- Awaiting human editorial review. The explanation was drafted with AI assistance; the formula and examples are verified by the automated tests above.
Privacy
Everything you enter is calculated in this browser and is not sent to Numerith or anyone else. Inputs are added to a share link only if you choose to include them. Privacy policy