Regression

Use this calculator

Linear regression estimates a straight-line relationship between paired x and y observations. Its fitted slope describes the average change in predicted y for one unit of x; the intercept is the predicted y at x=0. R² summarizes variation explained within the fitted sample.

A line fitted to paired observations

\widehat{y} = mx + b
R^{2} = 1 - \frac{\sum_{i}\left( y_{i} - {\widehat{y}}_{i} \right)^{2}}{\sum_{i}\left( y_{i} - \bar{y} \right)^{2}}

ŷ is fitted y; m is slope; b intercept; yᵢ observed value; ȳ observed mean; R² coefficient of determination. This is the model form matched to the implemented simple linear regression.

Supply matched X and Y values

Choose Linear. Enter X values and Y values as two numeric lists in corresponding order; each xᵢ pairs with the yᵢ at the same position. Calculate after checking equal list lengths and enough variation in X.

Interpret the fitted equation and R²

The main output is a regression equation of the form y = mx ± b, with R² as a separate detail. This calculator produces linear least-squares results; plotting, residual charts and forecast intervals shown in the illustrations are educational examples rather than live output controls.

Pairing is the first data-quality check

Treat (1,2), (2,4), (3,6) as three records, not two independent lists. Sorting only X without rearranging corresponding Y would change the analysis.

Illustration: y values near the relation y≈2x

Treat (1,2), (2,4), (3,6) as three records, not two independent lists. Sorting only X without rearranging corresponding Y would change the analysis.

Slope, intercept and units

If x is hours and y is cost, the slope has cost/hour units. The intercept is meaningful only when x=0 is within a sensible context.

Residual eᵢ = yᵢ−ŷᵢ can be positive or negative

If x is hours and y is cost, the slope has cost/hour units. The intercept is meaningful only when x=0 is within a sensible context.

R² and residuals

R² compares squared residual error against a mean-only baseline. A high in-sample R² does not by itself establish causation or reliable prediction outside the observed x-range.

Slope, intercept and R² summarize a least-squares fit

R² compares squared residual error against a mean-only baseline. A high in-sample R² does not by itself establish causation or reliable prediction outside the observed x-range.

Outliers and extrapolation

Inspect residual patterns and unusual points before using a straight line for decisions. Predictions beyond the measured domain are extrapolations and have different uncertainty.

Quick answers

Must X and Y lists match?

Yes; each X value corresponds to one Y value.

What does the main equation show?

The fitted slope and intercept of the straight line.

Is R² a probability of correctness?

No; it measures explained sample variation under the model.