Math & Statistics
Linear Regression Calculator
Fit an ordinary least-squares line through three entered x-y pairs, report slope and intercept, calculate Pearson correlation, and evaluate the fitted line at x = 5. The guidance focuses on residuals, extrapolation, and the limits of a three-point fit.
Decision view
Observed points, least-squares line, and prediction
| X3 | Regression slope | Regression intercept | Correlation coefficient | Predicted Y at X = 5 |
|---|
How to use Linear Regression Calculator
- Enter three coordinate pairs whose x and y values refer to the same cases and use consistent measurement definitions.
- Read the slope as fitted y change per one x unit and the intercept as the fitted y value at x = 0, whether or not zero is meaningful in the observed domain.
- Compare fitted values with the three observed y values and treat the prediction at x = 5 as extrapolation whenever 5 lies outside the entered x range.
Calculator guide
Understanding Linear Regression Calculator
Simple linear regression fits the straight line that minimizes the sum of squared vertical residuals. This page uses exactly three coordinate pairs, making it useful for checking the mechanics of slope, intercept, correlation, and a line-based prediction—not for validating a production forecasting model.
Calculation method
How the calculation works
Model diagnostic
Audit the fitted line before using its prediction
Even a perfectly calculated coefficient can be unsuitable for the intended decision.
Use this page to understand or verify a compact calculation; use a full statistical workflow for inference and forecasting.
Worked situations
Practical examples
- The default points (1,3), (2,5), and (4,9) lie exactly on y = 2x + 1, so slope is 2, intercept is 1, and correlation is 1.
- The displayed prediction at x = 5 is then 11, one x unit beyond the largest default observation.
- Changing the third y value from 9 to 7 tilts the fitted line and creates residuals, so no single pair alone determines the least-squares result.
Better inputs
Useful tips
- Plot the points and inspect residual direction; a high correlation can coexist with curvature or one influential point.
- Keep predictions near the observed x range unless a defensible model supports extrapolation.
- With real datasets, report uncertainty, residual diagnostics, observation count, missing-data rules, and any transformations.
Before relying on the result
Limitations and common mistakes
- Only three observations are fitted, leaving almost no information for diagnosing variance, nonlinearity, influential cases, or generalization.
- The page does not calculate residual standard error, R-squared, confidence intervals, prediction intervals, p-values, or weighted regression.
- A fitted association does not establish causality and may reflect confounding, reverse direction, selection, or shared time trends.
Reference
Key terms
- Slope
- Fitted change in y associated with a one-unit increase in x.
- Intercept
- Fitted y value when x equals zero.
- Residual
- Observed y minus the y value predicted by the fitted line.
- Least squares
- Criterion that chooses coefficients minimizing the sum of squared vertical residuals.
Important note
Calculated directly from the entered values using the displayed formula and rounding settings.
Frequently asked questions
What equation does the calculator fit?
It fits y = intercept + slope times x by ordinary least squares across the three entered pairs.
What happens if all x values are identical?
Slope is undefined because x has no variation. Use distinct x values or a model appropriate to the data structure.
Is correlation of 1 proof the model will predict perfectly?
No. It indicates exact positive linear alignment in these entered observations, not guaranteed accuracy for new cases.
Why can the intercept be unrealistic?
It is the line's value at x = 0, which may lie outside the observed or physically possible range.