Why an Extreme Response Can Change a Split
A regression tree predicts a constant value within each node. Under squared-error splitting, that value is the node’s arithmetic mean, and the split criterion is the reduction in the total squared deviations from the relevant node means. An unusually large or small response can therefore affect both the predicted means and the scores assigned to candidate splits.
The effect can be substantial because squared deviations grow quadratically: a response ten units from a node mean contributes one hundred squared units of error. But an extreme response does not guarantee that the tree will isolate it. Its effect depends on where it falls among the predictor values, which candidate thresholds are available, and how the other responses are grouped.
The calculations below assume equal weight for each observation and use squared-error impurity. They compare splits available within a specified node; there are no additional penalties or minimum-leaf restrictions in the examples. The score is a property of the responses and the proposed partition, not a test of whether an observation is erroneous.
Why the Mean and the Split Score Are Sensitive
The mean is sensitive to extreme values because every response contributes directly to its sum. Squared-error impurity is sensitive for an additional reason: after the mean moves, the deviations of the other observations change too. For efficient calculations, let \(T\) denote the sum of the responses in a node. Expanding the squared deviations gives an equivalent formula.
The last equality uses \(\bar{y}=T/n\). It is useful computationally, but it also makes a common arithmetic risk visible: the sum of individual squares, \(\sum y_i^2\), is not the square of the sum, \(T^2\).
For a split into left and right children, write their sizes as \(n_L,n_R\), their response sums as \(T_L,T_R\), and their means as \(\bar{y}_L,\bar{y}_R\). Since \(n=n_L+n_R\) and \(T=T_L+T_R\), substituting the SSE formula for the parent and children yields the following reduction.
To justify the last expression, begin with the sum-of-squares form. The parent term is \(T^2/n\), while the child terms are \(T_L^2/n_L\) and \(T_R^2/n_R\). Thus \(\Delta=T_L^2/n_L+T_R^2/n_R-(T_L+T_R)^2/n\). Replacing the sums by \(T_L=n_L\bar{y}_L\) and \(T_R=n_R\bar{y}_R\), and simplifying using \(n=n_L+n_R\), gives the stated factor times the squared difference in child means. The expression is nonnegative; it is zero when the two child means are equal.
Worked Example: Compare Every Threshold When One Response Is Extreme
Within a node, five observations have predictor values \(x=1,2,3,4,5\) and responses \(2,2,3,3,12\), respectively. Find the parent SSE and the reduction for every possible threshold between consecutive predictor values. Which threshold gives the largest reduction?
Method. Compute the parent SSE once, then calculate each pair of child SSEs. This avoids comparing child errors without subtracting them from the parent error.
The total response is \(T=2+2+3+3+12=22\), and the sum of squared responses is \(4+4+9+9+144=170\). Therefore, $$ \bar{y}=\frac{22}{5}=4.4, \qquad \operatorname{SSE}_{\text{parent}}=170-\frac{22^2}{5} =170-96.8=73.2. $$
For the threshold after \(x=1\), the left child contains only \(2\), so its SSE is \(0\). The right child has responses \(2,3,3,12\), with sum \(20\) and squared-response sum \(166\). Its SSE is \(166-20^2/4=66\). The reduction is \(73.2-66=7.2\).
For the threshold after \(x=2\), the left child \(2,2\) has SSE \(0\). The right child \(3,3,12\) has sum \(18\) and squared-response sum \(162\), so its SSE is \(162-18^2/3=162-108=54\). The reduction is \(73.2-54=19.2\).
For the threshold after \(x=3\), the left child \(2,2,3\) has sum \(7\) and squared-response sum \(17\). Its SSE is \(17-7^2/3=2/3\). The right child \(3,12\) has squared-response sum \(3^2+12^2=153\), not \(225\). Its SSE is \(153-15^2/2=153-112.5=40.5\). The reduction is \(73.2-(2/3+40.5)=961/30\), approximately \(32.0333\).
For the threshold after \(x=4\), the left child \(2,2,3,3\) has sum \(10\) and squared-response sum \(26\), giving SSE \(26-10^2/4=1\). The right child \(12\) has SSE \(0\). The reduction is \(73.2-1=72.2\).
The four reductions are \(7.2\), \(19.2\), approximately \(32.0333\), and \(72.2\). The largest is \(72.2\), attained by splitting after \(x=4\), which isolates the response \(12\). This example avoids the common mistake of using \(15^2=225\) as the sum of squares for the child \(3,12\); that child’s sum of squares is \(3^2+12^2=153\).
What the Outlier Does to the Node Mean
The preceding split comparison shows one possible consequence: a threshold that separates an extreme response may produce a large reduction. The mean itself also moves, changing the errors assigned to all observations in the node. The next calculation separates these two effects by comparing the same four typical responses with and without one extreme response.
Worked Example: Measure the Change in a Node’s Mean and SSE
A node initially contains responses \(4,5,5,6\). A fifth observation with response \(20\) is added. Calculate the mean and SSE before and after it is added, and explain the change.
Method. Use the arithmetic mean as the node prediction and compute squared deviations from that mean. The sum-of-squares formula provides an independent check.
Before the fifth observation is added, the mean is \((4+5+5+6)/4=20/4=5\). The SSE is \((4-5)^2+(5-5)^2+(5-5)^2+(6-5)^2=1+0+0+1=2\).
After adding \(20\), the response sum is \(40\), so the new mean is \(40/5=8\). The squared deviations are \((4-8)^2=16\), \((5-8)^2=9\), \((5-8)^2=9\), \((6-8)^2=4\), and \((20-8)^2=144\). Their sum is \(16+9+9+4+144=182\).
Check using sums of squares: the individual squared responses sum to \(16+25+25+36+400=502\), while \(T^2/n=40^2/5=320\). Hence the SSE is \(502-320=182\), agreeing with the direct calculation. The outlier not only contributes a large squared deviation; by moving the mean from \(5\) to \(8\), it also increases the deviations of the four typical observations.
Compare the Best Split With and Without an Outlier
A useful way to interpret a split score is to compare it with what happens when the extreme response is replaced by a typical value, while keeping the predictor order fixed. This comparison does not mean an observation should be removed. It shows how strongly the score depends on that response.
Worked Example: A Split That Changes When the Response Is Typical
Six observations have predictor values \(x=1,2,3,4,5,6\). Their responses are \(1,1,2,2,3,15\). Compute the reduction for each threshold. Then replace \(15\) by \(3\) and compare the best threshold in the modified data.
Method. Calculate the parent SSE for each response set, then evaluate all five thresholds. The comparison isolates the impact of the extreme response on the candidate split rankings.
With response \(15\), the sum is \(24\), the squared-response sum is \(244\), and the parent SSE is \(244-24^2/6=244-96=148\). The candidate calculations are:
- After \(x=1\): the right-child sum is \(23\), its squared-response sum is \(243\), and its SSE is \(243-23^2/5=137.2\). The reduction is \(148-137.2=10.8\).
- After \(x=2\): the right child \(2,2,3,15\) has SSE \(242-22^2/4=121\). The reduction is \(148-121=27\).
- After \(x=3\): the left child \(1,1,2\) has SSE \(6-4^2/3=2/3\). The right child \(2,3,15\) has SSE \(238-20^2/3=314/3\). The total child SSE is \(316/3\), so the reduction is \(148-316/3=128/3\), approximately \(42.6667\).
- After \(x=4\): the left child \(1,1,2,2\) has SSE \(10-6^2/4=1\). The right child \(3,15\) has SSE \(234-18^2/2=72\). The reduction is \(148-(1+72)=75\).
- After \(x=5\): the left child \(1,1,2,2,3\) has SSE \(19-9^2/5=14/5=2.8\), and the right child \(15\) has SSE \(0\). The reduction is \(148-2.8=145.2\).
The largest reduction is \(145.2\), from the threshold after \(x=5\), which isolates the response \(15\).
Now replace \(15\) by \(3\). The responses are \(1,1,2,2,3,3\). Their sum is \(12\), their squared-response sum is \(28\), and the parent SSE is \(28-12^2/6=4\). The reductions after \(x=1,2,3,4,5\) are, respectively, \(1.2,3,8/3,3,1.2\). For example, after \(x=2\), the right child \(2,2,3,3\) has SSE \(26-10^2/4=1\), so the reduction is \(4-1=3\). After \(x=4\), the left child has SSE \(1\) and the right child \(3,3\) has SSE \(0\), also giving reduction \(3\).
Without the extreme response, the best reduction is tied between thresholds after \(x=2\) and \(x=4\). With it, the split isolating the final observation is decisively preferred. The calculation shows that an extreme response can change both the scale of the split scores and their ranking.
What an Outlier Does—and Does Not—Tell You
These examples support several practical conclusions about squared-error splits:
- The contribution grows quadratically. A deviation twice as large contributes four times as much squared error, all else equal.
- The parent mean moves. An extreme response changes the prediction used to calculate the parent SSE, as well as the child means available after a split.
- Isolation can be attractive. If a permissible threshold places an extreme response in a child by itself, that child has zero SSE and the other child may have much smaller error than the unsplit parent.
- Isolation is not guaranteed. A threshold may be unable to separate the observation, for example when several observations share the same predictor value. A different grouping may yield a greater reduction.
- An extreme predictor value is not automatically an extreme response. Under this criterion, response values determine the squared errors. Predictor values determine which partitions can be proposed. An observation far out on a predictor scale can have an ordinary response and need not have a direct effect on SSE until a split groups it with particular responses.
A large reduction is not evidence by itself that the outlying value is a recording error or should be excluded. In a hypothetical insurance modeling application, an unusually large claim could be a valid outcome, a data-entry problem, or a result of a special exposure. The tree calculation alone cannot distinguish these explanations. The data should be checked in context, and any decision to correct or exclude a value should be justified separately.
Common Calculation Traps
- Squaring the sum instead of summing squares. For responses \(3,12\), the sum is \(15\), but the squared-response sum is \(3^2+12^2=153\), not \(15^2=225\). The SSE is \(153-15^2/2=40.5\).
- Using child SSE alone as the split score. A split’s reduction is parent SSE minus both child SSEs. The child SSEs must be added before subtracting.
- Assuming that a large response must be isolated. Only available thresholds can be considered, and the winning partition is the one with the greatest reduction among them.
- Forgetting that the node mean changes. Do not calculate an outlier’s effect only as its squared distance from the old mean; recompute the mean and all deviations for the new node.
Check Your Understanding
For each problem, use equal observation weights and squared-error impurity. Assume all stated thresholds are allowed.
- A node has responses \(2,4,4,10\). Find its mean and SSE using the sum-of-squares formula. (Answer: mean \(5\); SSE \(36\).)
- A node has responses \(1,1,3,9\). A proposed split places \(1,1\) in the left child and \(3,9\) in the right child. Find the parent SSE, both child SSEs, and the reduction. (Answer: parent SSE \(43\); child SSEs \(0\) and \(18\); reduction \(25\).)
- Responses in predictor order are \(0,0,2,2,10\). Compare the split after the second observation with the split after the fourth observation. Which has the larger reduction? (Answer: after the second, reduction \(392/15\), approximately \(26.1333\); after the fourth, reduction \(64.8\); the split after the fourth is larger.)
- A split creates children of sizes \(3\) and \(2\), with means \(2\) and \(8\). Use the mean-difference formula to find the reduction. (Answer: \(43.2\).)
- Responses in predictor order are \(2,3,3,4,18\). Calculate the parent SSE and the reduction from splitting after the fourth observation. (Answer: parent SSE \(182\); reduction \(180\).)