Calculator Input
Formula Used
Least trimmed squares fits the line yi = β0 + β1xi + εi while reducing outlier impact.
Residual: ri = yi − (β0 + β1xi)
Ordered squared residuals: r²(1) ≤ r²(2) ≤ ... ≤ r²(n)
LTS objective: minimize Σ from i = 1 to h of r²(i)
Retained subset size: h = max( ceil((n + 3) / 2), floor(n × (1 − trim%)) )
Refit step: after selecting the h smallest residuals, OLS is refit on that retained subset.
This implementation targets simple linear regression. It also reports the ordinary least squares line on all observations so you can compare sensitivity to outliers.
How to Use This Calculator
- Enter one x,y pair on each line in the dataset box.
- Choose a trim percentage that reflects expected contamination.
- Set concentration steps for refinement and add an optional prediction x value.
- Press the calculate button to view the robust line, graph, diagnostics, and exports.
Example Data Table
This sample illustrates one strong outlier near x = 8. A robust trimmed method should down-weight its influence relative to OLS.
| Observation | X | Y | Comment |
|---|---|---|---|
| 1 | 1 | 2.2 | Regular point |
| 2 | 2 | 4.3 | Regular point |
| 3 | 3 | 5.9 | Regular point |
| 4 | 4 | 8.1 | Regular point |
| 5 | 5 | 10.4 | Regular point |
| 6 | 6 | 12.2 | Regular point |
| 7 | 7 | 13.8 | Regular point |
| 8 | 8 | 31.0 | Likely outlier |
| 9 | 9 | 18.2 | Regular point |
| 10 | 10 | 20.1 | Regular point |
Frequently Asked Questions
1) What does least trimmed squares do?
It fits a regression line using only the smallest squared residuals. Large-residual observations are temporarily excluded, so extreme outliers affect the line far less.
2) How is this different from ordinary least squares?
OLS uses every squared residual, so one extreme point can pull the line strongly. LTS keeps only the best-fitting subset and is therefore much more resistant.
3) What is the retained subset h?
h is the number of observations kept inside the trimmed objective. Larger h uses more data, while smaller h increases resistance to contamination.
4) How should I choose the trim percentage?
Start near 10% to 20% when you expect a few unusual points. Increase trimming only when contamination looks substantial, because heavy trimming also discards information.
5) Why do LTS and OLS predictions differ?
The LTS line resists outliers, while OLS follows all points. When unusual observations exist, slope and intercept can diverge, producing different predictions.
6) Can this page handle multiple predictors?
No. This version is built for a single predictor x and one response y. It is ideal for robust simple linear regression analysis.
7) What does the robust scale value mean?
It summarizes the typical size of retained residuals using a robust median-based measure. Smaller values indicate tighter agreement around the resistant line.
8) When should I avoid trimming too much?
Avoid heavy trimming when the data are already clean or when the sample is small. Over-trimming can remove genuine structure and make estimates less stable.