Calculator Inputs
Use auto-fit to estimate coefficients from X and Y values, or switch to manual mode and test residuals against your own intercept and slope.
Example Data Table
This sample works well with auto-fit mode and helps you test the page quickly.
| Observation | X | Actual Y |
|---|---|---|
| 1 | 1 | 2.4 |
| 2 | 2 | 4.1 |
| 3 | 3 | 5.8 |
| 4 | 4 | 8.5 |
| 5 | 5 | 10.2 |
| 6 | 6 | 12.4 |
Formula Used
Predicted value: ŷ = β₀ + β₁x
Residual: e = y − ŷ
Auto-fit slope: β₁ = Σ[(x − x̄)(y − ȳ)] / Σ[(x − x̄)²]
Auto-fit intercept: β₀ = ȳ − β₁x̄
Sum of squared errors: SSE = Σe²
Mean squared error: MSE = SSE / n
Root mean squared error: RMSE = √MSE
Mean absolute error: MAE = Σ|e| / n
Coefficient of determination: R² = 1 − (SSE / SST)
Leverage for simple regression: hᵢ = 1/n + ((xᵢ − x̄)² / Sxx)
Standardized residual: rᵢ = eᵢ / (s√(1 − hᵢ)), where s = √(SSE / (n − 2))
Residuals near zero suggest the model matches observations well. Large positive or negative residuals can reveal outliers, bias, missing variables, or changing variance.
How to Use This Calculator
- Choose Auto-fit to estimate the line from your data, or choose Manual to test custom coefficients.
- Enter matched X values and actual Y values using commas, spaces, semicolons, or line breaks.
- Set the decimal precision and residual flag threshold that suits your review workflow.
- Click Calculate Residuals to display the summary, diagnostics table, and plots above the form.
- Inspect flagged standardized residuals to find unusual observations quickly.
- Use the export buttons to download the computed table as CSV or PDF.
FAQs
1. What does a residual mean?
A residual is the difference between the actual value and the predicted value. Positive residuals mean underprediction, while negative residuals mean overprediction.
2. Why are residuals important in data science?
Residuals show how well a model fits the data. They help detect bias, outliers, nonlinearity, and changing error variance before deployment.
3. What is the difference between auto-fit and manual mode?
Auto-fit estimates the intercept and slope from your data. Manual mode uses your supplied coefficients to evaluate how that chosen equation performs.
4. What is a standardized residual?
A standardized residual scales the raw residual by estimated error and leverage. It makes unusual points easier to compare across observations.
5. What threshold should flag a residual?
A common starting point is an absolute standardized residual of 2. Larger thresholds are stricter, while smaller thresholds catch more possible issues.
6. Can I use this for model diagnostics?
Yes. The summary metrics, leverage values, standardized residuals, and plots provide a compact diagnostic view for simple linear regression workflows.
7. Why is R² missing sometimes?
R² may be undefined when actual Y values do not vary. Without total variation, the calculator cannot compare explained and unexplained variance meaningfully.
8. Can I export the calculated results?
Yes. The calculator includes CSV and PDF export buttons after calculation, so you can save computed diagnostics for analysis, reporting, or review.