Math & Statistics
Regression Step-by-Step Calculator
Derive a five-point least-squares line one centered product at a time, exposing x and y deviations, cross-products, squared x deviations, coefficient substitution, and normal-equation reconciliation.
CENTERED-PRODUCT WORKBENCH
Each observation contributes signed covariance and positive x leverage
A quadrant panel shows centered points while contribution bars expose which rows create the fitted slope.
DERIVATION WORKSHEET
The five rows that build Sxy and Sxx
Nothing is hidden behind a coefficient function: every centered term is displayed before summation.
| i | x | y | x-xbar | y-ybar | Product | x deviation squared |
|---|
WORKSHEET SETUP
Preserve enough precision through the centered columns
- Enter the five x-y pairs without pre-rounding their means.
- Compute the centroid before any product column.
- Retain signed centered deviations.
- Sum cross-products before dividing by Sxx.
- Check both normal-equation residual sums after fitting.
CONTRIBUTION LOGIC
Farther x values can dominate the slope calculation
Rows with large horizontal deviations contribute strongly to Sxx and can have high leverage. Their influence is not necessarily an error, but it deserves inspection.
The two normal equations force residuals to sum to zero and be orthogonal to x when an intercept is included.
CENTERED-SUM PROOF
Derive the line from deviations around the centroid
Centering isolates co-movement from absolute levels. Sxy accumulates signed co-deviation; Sxx measures horizontal spread. Their ratio is the slope.
Detailed calculation process and general formulas
xbar = sum(x_i)/n; ybar = sum(y_i)/nSxy = sum[(x_i-xbar)(y_i-ybar)]Sxx = sum[(x_i-xbar)^2]b1 = Sxy/Sxxb0 = ybar - b1 xbarSymbols, meanings, and units
- xbar, ybar
- sample centroid coordinatesx and y units
- Sxy
- centered cross-deviation sumx times y units
- Sxx
- centered x square sumx units squared
- b1
- slope from centered sumsy per x
- b0
- intercept placing line through centroidy units
DERIVATION CHECKS
Three identities close the worksheet
A correct coefficient pair should satisfy centroid and residual identities.
Centroid identity
The fitted line passes through xbar, ybar.
Residual balance
-Signed residuals sum to approximately zero.
Orthogonality
-x-weighted residuals sum to approximately zero.
Decision takeaway: Keep the centered contribution table whenever a fitted slope must be explained or audited.
Applied decisions
Step-by-step regression use cases
Training worksheet
A learner derives each contribution before checking software output.
What the result clarifies: The slope is visibly a ratio of co-movement to x spread.
Audit of a small calibration
Five standard points produce a surprising slope.
What the result clarifies: The bar contributions reveal which x values dominate Sxy.
Worked current scenario
Substitution, intermediate values, and reconciliation
Method references
Sources for this calculator's specific method
Scope and limitations
The centered-sum derivation verifies ordinary least-squares arithmetic for the entered five points. It does not certify linearity, independence, constant variance, representative sampling, or causal interpretation.
Regression Step-by-Step Calculator | Centered-Sum Derivation FAQ
Why can cross-products be negative?
A point can deviate above the y mean while lying below the x mean, or vice versa.
Why is Sxx never negative?
It is a sum of squared horizontal deviations.
What if all x values are equal?
Sxx is zero and a unique slope cannot be estimated.