Compute residuals, sum of squared errors (SSE), R², and regression coefficients from your (x, y) data. Visualize the least‑squares line, data points, and detailed residual diagnostics.
Residuals are the backbone of regression diagnostics. A residual is the difference between an observed value and the value predicted by a regression model: eᵢ = yᵢ − ŷᵢ. By analyzing residuals, you can detect non‑linearity, outliers, heteroscedasticity, and assess overall model fit. The sum of squared residuals (SSE) is minimized in ordinary least squares (OLS) regression — the foundation of linear modeling.
Least‑squares line: ŷ = b₀ + b₁·x
b₁ = Σ[(xᵢ − x̄)(yᵢ − ȳ)] / Σ(xᵢ − x̄)² , b₀ = ȳ − b₁·x̄
SSE = Σ(yᵢ − ŷᵢ)² , R² = 1 − SSE/SST
1. Data Parsing: Your input points (x, y) are extracted. Minimum 2 distinct x‑values required.
2. Regression Coefficients: Using the least‑squares criterion, we compute slope (b₁) and intercept (b₀).
3. Predicted Values & Residuals: For each point, compute ŷ = b₀ + b₁·x, then residual = y − ŷ.
4. Goodness-of-Fit: SSE = Σ(residual²). Total sum of squares SST = Σ(yᵢ − ȳ)². R² = 1 − SSE/SST.
5. Standard Error of Estimate: √(SSE / (n−2)), which estimates the typical size of residuals.
6. Interactive Plot: Canvas draws points, regression line, and gray dashed lines indicating residual magnitudes.
A marketing analyst collects data on weekly ad spend (x, $1000) and sales (y, $1000). Points: (1, 2.3), (2, 3.9), (3, 5.5), (4, 7.2), (5, 8.9). Using our calculator, the regression line is ŷ = 1.66·x + 0.68, R² = 0.996, indicating excellent fit. Residuals are tiny: [-0.04, 0.06, -0.08, 0.02, 0.04] — random. The analyst confidently forecasts future sales. The interactive graph shows how close predictions are to actual observations.