What this guide helps you decide
Ordinary least squares chooses the line that minimizes the sum of squared vertical residuals under its stated setup. The slope describes modeled change in y per unit x, while the intercept is the fitted value at x = 0 and may not be meaningful outside the observed range.
R² summarizes the fraction of observed y variation accounted for by the fitted line in the sample. A high R² does not establish causation, validate extrapolation, or prove that residual assumptions hold.
Fit, then diagnose
Calculate means, covariance-style cross-products, slope, and intercept from valid pairs. Generate fitted values and residuals for every point, then inspect nonlinearity, changing spread, influential observations, and extrapolation range.
- Pair x and y values without dropping one side independently.
- Check for constant x, which makes the slope denominator zero.
- Calculate slope, intercept, fitted values, residuals, and R².
- Inspect residual patterns and restrict predictions to a justified range.
Worked scenario: four paired observations
Fit y to x for the pairs (1,2), (2,3), (3,5), and (4,8).
- The least-squares slope is 2 and the intercept is −0.5, giving ŷ = −0.5 + 2x.
- Fitted values are 1.5, 3.5, 5.5, and 7.5; residuals alternate +0.5, −0.5, −0.5, +0.5.
- R² is approximately 0.9524 for these four observations.
Outcome: The line describes the small sample closely, but four points are not evidence of causality or safe prediction beyond x = 1 to 4.
Regression-review checklist
- Keep x/y pairs aligned and report n.
- Reject a zero-variance predictor.
- Inspect residuals, not only R².
- Label slope with y-units per x-unit.
- Avoid unsupported extrapolation and causal language.
Limits and responsible use
- A simple linear fit can be distorted by outliers, nonlinear relationships, dependence, unequal variance, and measurement error.
- The calculator does not establish causation, select variables, validate study design, or replace domain-specific statistical analysis.
Authoritative references
These links support the definitions, conventions, or safety boundaries used in this guide. CalculatorToolset wrote the explanation and example independently.
- NIST/SEMATECH e-Handbook of Statistical MethodsNational Institute of Standards and Technology
- Introductory Statistics 2eOpenStax, Rice University
Frequently asked questions
Can R² be high for a bad model?
Yes. A restricted range, trend, influential points, or nonlinear pattern can produce a high value while the model remains unsuitable for the intended use.
Why might the intercept be meaningless?
If x = 0 is outside the observed or physically possible range, the fitted intercept is an algebraic component rather than a useful real-world estimate.