Why Compare Outlier Treatments?
A flagged value can affect an analysis even when it is plausible and has been checked. Retaining it, capping it, or excluding its observation changes the data used by a summary or model. The resulting estimates may differ enough to alter a practical conclusion. Sensitivity analysis makes that dependence visible: repeat the same analysis under defensible treatments and compare the results.
The purpose is not to find the treatment that produces the most convenient estimate. A flag is a reason to investigate a value, not proof that the value is wrong. Context and data quality determine which treatments are reasonable to consider. If the value is verified and relevant to the target population, retaining it may be the primary analysis; capping and exclusion can still help show how much the result depends on it.
The three treatments have different meanings. Retention uses the recorded value unchanged. Capping replaces the value with a stated boundary, such as a defensible upper cap. Exclusion removes the observation from the analysis, so the sample size and potentially the composition of the analyzed data change. These are not interchangeable data edits: each changes what the analysis represents.
A fair comparison starts with one analysis question and one set of flagged observations. Do not quietly change the outcome, predictor set, inclusion rules, or flag definition between runs. Record the estimate, the sample size, and the conclusion under each treatment. If a treatment is not defensible for the data, do not include it merely to complete a three-column table.
What Changes When a Value Is Capped or Excluded?
For a numeric outcome \(y_1,\ldots,y_n\), the sample mean is the sum of the included values divided by the number of included observations. Suppose one flagged value is \(y_j\), and a proposed cap replaces it with \(c\). The original and capped means are:
Subtracting the first expression from the second gives a useful direct comparison:
This identity holds because capping changes one value by \(c-y_j\) while leaving the denominator \(n\) unchanged. It does not describe exclusion: exclusion removes both \(y_j\) and one observation from the denominator. If \(T=\sum_{i=1}^{n}y_i\), the mean after excluding observation \(j\) is \((T-y_j)/(n-1)\), provided \(n>1\).
For a model, the same idea applies at the level of the chosen model estimate. A regression coefficient may change because a treatment changes an outcome, a predictor, or which rows are included. Unlike the mean identity above, there is generally no one-value shortcut that gives the new coefficient; refit the model to the treated data.
Worked Example: Comparing Three Means
A hypothetical service team records five resolution times, in hours: 12, 14, 15, 16, and 43. The last value is flagged for review. Compare the mean under retention, capping at 20 hours, and exclusion. The operational question is whether the average is below 18 hours.
Method. Calculate the mean for each treatment, changing only the handling of the flagged observation. This comparison avoids treating a flag as automatic justification for deletion.
Retain. The sum is \(12+14+15+16+43=100\), and there are 5 observations. Thus the mean is \(100/5=20\) hours.
Cap at 20. Replace 43 with 20. The new sum is \(12+14+15+16+20=77\), with 5 observations, so the mean is \(77/5=15.4\) hours. The change from the retained mean is \((20-43)/5=-23/5=-4.6\) hours, which checks the direct-change formula.
Exclude. Remove 43. The remaining sum is \(12+14+15+16=57\), and the sample size is 4. The mean is \(57/4=14.25\) hours.
Check and interpret. The results are 20, 15.4, and 14.25 hours. Under retention, the mean is not below 18; under capping and exclusion, it is. Therefore, the conclusion about the 18-hour threshold depends on treatment. The calculations are internally consistent: capping retains five observations, while exclusion uses four.
Common mistake avoided: Excluding 43 and still dividing the remaining sum by 5 would give 11.4 hours, but that is not the mean of the four retained observations. Exclusion changes the numerator and denominator.
Repeat the Model, Not the Question
In a simple linear regression of a quantitative response \(Y\) on a quantitative predictor \(X\), the fitted slope is the estimated change in the mean response associated with a one-unit increase in the predictor under the model. The ordinary least squares slope is the sample covariance of \(X\) and \(Y\), using divisor \(n\), divided by the sample variance of \(X\), also using divisor \(n\). Equivalently, it is \(S_{XY}/S_{XX}\), where \(S_{XY}=\sum_i(x_i-\bar{x})(y_i-\bar{y})\) and \(S_{XX}=\sum_i(x_i-\bar{x})^2\). This formula requires \(S_{XX}>0\); if all predictor values are identical, the slope cannot be estimated.
A treatment that changes a response can change \(S_{XY}\), and therefore the slope. Excluding a row can also change \(\bar{x}\), \(\bar{y}\), \(S_{XY}\), and \(S_{XX}\). Consequently, compare refitted models on their own treated data, and state the sample size for each. In a practical interpretation, distinguish whether the direction of association changes from whether its estimated magnitude changes.
Worked Example: Sensitivity of a Regression Slope
A hypothetical analyst studies the association between a monthly activity score \(X\) and a response \(Y\). The four observed pairs are \((1,2),(2,3),(3,4),(4,20)\); the final response is flagged. Compare the ordinary least squares slope when retaining the response, capping it at 8, and excluding its row.
Method. Refit the simple regression under each treatment using \(S_{XY}/S_{XX}\). This avoids assuming that changing one response leaves the fitted slope unchanged.
Retain. The predictor mean is \(\bar{x}=(1+2+3+4)/4=2.5\), and \(S_{XX}=(-1.5)^2+(-0.5)^2+(0.5)^2+(1.5)^2=5\). The response mean is \(\bar{y}=(2+3+4+20)/4=7.25\). Thus \(S_{XY}=(-1.5)(-5.25)+(-0.5)(-4.25)+(0.5)(-3.25)+(1.5)(12.75)=7.875+2.125-1.625+19.125=27.5\). The slope is \(27.5/5=5.5\).
Cap at 8. The responses are now 2, 3, 4, and 8, so \(\bar{y}=17/4=4.25\). The predictor values and \(S_{XX}=5\) are unchanged. Then \(S_{XY}=(-1.5)(-2.25)+(-0.5)(-1.25)+(0.5)(-0.25)+(1.5)(3.75)=3.375+0.625-0.125+5.625=9.5\). The capped-data slope is \(9.5/5=1.9\).
Exclude the flagged row. The remaining points are \((1,2),(2,3),(3,4)\). Their means are \(\bar{x}=2\) and \(\bar{y}=3\). Therefore \(S_{XX}=(-1)^2+0^2+1^2=2\), and \(S_{XY}=(-1)(-1)+0(0)+1(1)=2\). The slope is \(2/2=1\).
Check and interpret. All three slopes are positive, so the direction is stable in this example, but the magnitude changes from 5.5 to 1.9 or 1. The retained slope is especially influenced by the flagged response. This is not evidence that one treatment is automatically correct; it shows that the estimated strength of association is treatment-sensitive.
Common mistake avoided: Dividing a changed covariance by the original \(S_{XX}\) after exclusion would be wrong in general. Here the predictor values happen to leave \(S_{XX}=2\) for the three-point fit, but it must still be recalculated from the included rows.
Interpret the Difference, Not Just the Numbers
Sensitivity is a property of the conclusion relative to a specified treatment set. It is useful to ask whether estimates keep the same sign, remain in a similar range, or cross a decision threshold that matters in context. A small numerical change may be important near a threshold, while a larger change may not alter the operational decision. Always explain the comparison in the units and context of the outcome.
Exclusion deserves particular care. If extreme observations are more likely in a subgroup or under certain conditions, removing them can change which cases the analysis represents. The excluded-data result may describe a selected subset rather than the intended population. This is why sensitivity analysis should accompany, not replace, a defensible primary treatment and a clear description of the target population.
Likewise, capping changes the meaning of the recorded variable: all values above the cap are represented at the boundary. A cap should have a stated rationale, such as a known measurement ceiling or a pre-specified analytic rule. Choosing a cap solely because it produces a preferred conclusion is not a defensible analysis.
Name the outcome or model estimate, the target population, and the substantive comparison or decision threshold.
State which observations are flagged and what retention, capping, or exclusion means for this analysis. Do not equate a flag with an error.
Hold the question and other analytical choices fixed, apply each stated treatment, and recalculate the estimate. For exclusion, recalculate using the rows that remain.
Show estimates, sample sizes, and whether the substantive conclusion changes. Explain which treatment is primary and why it is defensible.
A useful report does not merely say that results are “robust” or “not robust.” It specifies what remained stable and what changed. For example: “The estimated association remained positive under all three treatments, while its magnitude decreased substantially when the flagged response was capped or excluded.” That statement separates directional stability from magnitude sensitivity.
Do not interpret treatment comparisons as a formal test of whether an observation is an outlier, nor as evidence that the data-generating process follows a particular distribution. They are conditional comparisons: given the stated data and analysis, how do results change under these alternative handling choices? Further modeling or validation may be needed to answer different questions.
Check Your Understanding
For each problem, compare the treatments and interpret what remains stable. Treat all scenarios as hypothetical.
- A processing time sample is 5, 7, 8, 10, and 40 minutes. The final value is flagged. Find the mean under retention, capping at 16, and exclusion. (Answer: Retain \(14\); cap \(9.2\); exclude \(7.5\) minutes.)
- A simple regression uses \((1,1),(2,2),(3,3),(4,11)\), with the last response flagged. Find the slope under retention, capping the final response at 5, and excluding that row. (Answer: Retain \(3.1\); cap \(1.3\); exclude \(1.0\).)
- Hypothetical Group A values are 20, 22, 24, 26, and 80; Group B values are 25, 27, 29, 31, and 33. Compare the difference in group means, defined as A minus B, when retaining 80, capping it at 40, and excluding it. Does the sign remain stable? (Answer: Retain \(+5.4\); cap \(-2.6\); exclude \(-6.0\); the sign changes.)
- A hypothetical report finds a mean of 31 units after retaining a flagged value, 27 units after capping, and 25 units after exclusion. The decision rule classifies a process as above target only when the mean exceeds 28 units. Which treatments lead to an above-target conclusion, and what should the report say about sensitivity? (Answer: Retention alone is above target; the conclusion depends on treatment, so report the three estimates and justify the primary treatment rather than selecting one for convenience.)