Why Tree-Growth Controls Need to Be Distinguished
A tree can keep dividing its data into smaller groups until it describes fine detail in the training sample. Controls on depth and node size limit that growth, but they do not all impose the same restriction. Maximum depth limits how many successive splits can occur along a path. Minimum split size determines whether a node is large enough for the algorithm to consider splitting it. Minimum terminal-node size rules out candidate splits that would create a child with too few observations.
These are local restrictions on tree growth, not instructions that specify the final tree. A node can satisfy a size threshold and still remain terminal because no suitable improving split is available. Conversely, a node that is too small to split may still be a valid child of a larger node. The distinction is important when interpreting a fitted tree and when choosing controls in R.
What Each Control Restricts
Let \(n_t\) be the number of observations in node \(t\), let \(d_t\) be its depth, let \(s\) be the minimum split size, let \(b\) be the minimum terminal-node size, and let \(D\) be the maximum depth. For an unweighted data set with no missing predictor values, the controls have the following interpretation.
Minimum split-size control: A node is large enough for a split attempt only when \(n_t \geq s\).
Minimum terminal-node-size control: A proposed split of node \(t\) into children \(t_L\) and \(t_R\) is allowed by this size control only when \(n_{t_L} \geq b\) and \(n_{t_R} \geq b\).
These conditions are necessary size and depth checks, not a guarantee that a split will appear. A candidate must also be available from the predictors and satisfy the model's other split-improvement and implementation rules. If a node fails the minimum split-size check, the algorithm does not try splitting it, even if one can imagine a division with large enough children. If the node passes that check, the candidate divisions still have to satisfy the minimum terminal-node size.
| Control | Question it answers | What it does not guarantee |
|---|---|---|
| Maximum depth | How many split levels can occur on a root-to-leaf path? | That a node above the limit will split, or that every branch reaches the limit. |
| Minimum split size | Is this node large enough for the algorithm to attempt a split? | That an admissible or improving candidate exists. |
| Minimum terminal-node size | Would each child of this candidate split contain enough observations? | That the parent is eligible to split or that the candidate is useful. |
How the Controls Combine
For a proposed split at node \(t\), all three controls must permit it. In the stated unweighted setting, the size and depth conditions can be summarized as follows.
The first two conditions concern the parent node: its depth and its size. The last two concern the children that the proposed split would create. Even if all four inequalities hold, the split may not be selected if it does not satisfy the model's other requirements.
The interaction follows from restricting the set of candidate splits. A split that violates any one condition is removed from consideration. A node may therefore be large enough under \(s\), but have no candidate with both children large enough under \(b\). Or it may pass both size checks but be at the maximum permitted depth. This is why the controls should be checked separately rather than treated as interchangeable ways to specify a desired leaf size.
Worked Examples
Worked Example: Reading a Maximum-Depth Limit
A hypothetical regression tree has 80 observations at its root. Suppose its available improving splits include a root split into groups of 48 and 32. At the next level, the 48-observation node can split into groups of 30 and 18, and the 32-observation node can split into groups of 20 and 12. All four candidate splits described are assumed to satisfy the node-size controls. What terminal-node sizes result if the maximum depth is 1, and what sizes result if it is 2? Assume there are no other restrictions.
Method. Start at depth 0. The root split creates two nodes at depth 1. With a maximum depth of 1, those nodes cannot be split because their depth is not less than the limit. The resulting terminal sizes are therefore 48 and 32. They sum to \(48+32=80\), matching the root size.
With a maximum depth of 2, nodes at depth 1 may be split because \(1<2\). The stated splits create nodes at depth 2 with sizes 30, 18, 20, and 12. Those nodes cannot be split further under this depth limit. The terminal sizes are 30, 18, 20, and 12; their total is \(30+18+20+12=80\).
Check and trap avoided. The arithmetic preserves all 80 observations in both trees. The depth limit permits splitting up to that depth; it does not require every available split to be taken. In this example, the split choices were explicitly stated to make the resulting sizes determinate.
Worked Example: Minimum Split Size Does Not Decide Every Branch
A hypothetical root node contains 50 observations and has an improving split into groups of 30 and 20. Set the minimum split size to 25 and the minimum terminal-node size to 8. The 30-observation child has an available improving split into groups of 15 and 15. Assume these are the only improving splits, the maximum depth does not bind, and all other requirements are met. Determine which nodes can be split and the terminal sizes.
Root split. The root has 50 observations, so \(50 \geq 25\). Its children have sizes 30 and 20, and both are at least 8. The root split is permitted by both size controls.
Check the 30-observation node. It meets the split-size requirement because \(30 \geq 25\). Its proposed children have sizes 15 and 15, so each meets the terminal-node requirement because \(15 \geq 8\). Under the assumptions in the question, this split is made.
Check the 20-observation node. It does not meet the split-size requirement because \(20<25\). It cannot be split under these settings. It is a terminal node, as are the two 15-observation children. The terminal sizes are 15, 15, and 20, and \(15+15+20=50\).
Check and trap avoided. It would be wrong to conclude that both root children must remain terminal just because the 20-observation node is too small to split. The 30-observation node meets the split threshold, and its 15/15 split also meets the child-size threshold. If no improving split had been specified for that node, its final status would not follow from the size controls alone.
Worked Example: Minimum Split Size and Minimum Terminal Size Are Different Tests
A hypothetical node contains 24 observations. Set \(s=20\) and \(b=9\). Two candidate splits are available: one creates children of sizes 8 and 16, and the other creates children of sizes 10 and 14. Both candidates are assumed to improve the fit, and no depth limit or other restriction applies. Which candidates pass the controls?
Check the parent. The parent meets the minimum split-size requirement because \(24 \geq 20\). The algorithm may consider candidate splits for this node.
Check the first candidate. Its child sizes are 8 and 16. Although both sizes add to 24, the first child fails the minimum terminal-node requirement because \(8<9\). This candidate is excluded.
Check the second candidate. Its child sizes are 10 and 14. Both satisfy the requirement: \(10 \geq 9\) and \(14 \geq 9\). This candidate passes the depth and size controls and, given the stated assumptions, may be selected.
Check and trap avoided. The parent passes \(s\), but that does not make every candidate split valid. The child sizes must be checked separately. The second candidate also conserves the parent count: \(10+14=24\).
Setting the Controls in R
In rpart, the corresponding control arguments are maxdepth, minsplit, and minbucket. For example, the following code sets a maximum depth of 3, a minimum split size of 25, and a minimum terminal-node size of 8 for a regression tree.
ctrl <- rpart::rpart.control(maxdepth = 3, minsplit = 25, minbucket = 8, cp = 0)
fit <- rpart::rpart(response ~ ., data = train, method = "anova", control = ctrl)
Here, method = "anova" specifies a regression tree. Setting cp = 0 removes a positive complexity-parameter threshold as an additional restriction, which helps isolate the effects of the controls in an instructional example. In practical modeling, other control settings and the data can still affect the fitted tree. The code does not promise a particular number of leaves: that depends on the available predictors, candidate splits, and their fit improvement.
The controls are applied jointly. For example, a node at depth 3 cannot be split when maxdepth = 3, even if it contains hundreds of observations. A node at depth 1 with 19 observations cannot be split when minsplit = 25, even if a hypothetical division would create two sufficiently large children under some smaller minimum bucket. And a node with at least 25 observations may still have no eligible candidate if every proposed split creates a child with fewer than 8 observations.
If minbucket is not supplied, rpart chooses a default based on minsplit. When a specific minimum leaf size matters, set both arguments explicitly rather than relying on the default. Also note that the simple counts used in the examples describe unweighted observations. With case weights or missing predictor values, the fitting procedure's handling of observations can affect how a model's node counts should be interpreted; inspect the fitted model and the data-processing setup.
Common Exam Traps and Practical Interpretation
- Calling minsplit a minimum leaf size. It governs whether a node is large enough for a split attempt. The minimum terminal-node size is the control that restricts the sizes of the children.
- Assuming a qualifying node must split. Meeting the split-size threshold only makes the node eligible for consideration. A suitable candidate and any other required conditions must still be present.
- Assuming minbucket acts on the parent size. It is checked on the children created by a candidate split. A parent can be large enough to attempt a split while a proposed child is too small.
- Treating maximum depth as a target. It is an upper bound. Some branches can stop earlier because of size constraints, lack of a suitable split, or other model rules.
- Reporting a unique tree from thresholds alone. The controls restrict what the algorithm can do; without the data and candidate splits, they do not identify exact terminal-node sizes.
These controls are useful for limiting overly detailed trees and for making the permitted tree structure explicit. However, settings that force larger leaves or shallower paths can also prevent the model from representing real structure in the data. Their effect should be assessed in the context of the modeling objective and subsequent validation, rather than assumed to improve predictive performance simply because the tree is smaller.
Check Your Understanding
For each problem, apply the stated controls to the proposed splits. Assume all splits described as improving satisfy the model's other requirements.
- A root node with 64 observations splits into 40 and 24. With maximum depth 1, what are the terminal-node sizes? (Answer: 40 and 24.)
- A node has 28 observations, minsplit is 30, and an imagined split would produce 14 and 14. Can the algorithm attempt this split under the minimum split-size rule? (Answer: No; \(28<30\).)
- A node with 36 observations meets minsplit, and minbucket is 10. A candidate split produces 9 and 27. Does it pass the minimum terminal-node-size rule? (Answer: No; the child with 9 observations is below 10.)
- A root node of 45 observations splits into 27 and 18. With minsplit 20 and minbucket 6, the 27-observation node has an improving split into 13 and 14, while the 18-observation node has no proposed split. What are the terminal sizes, assuming depth does not bind? (Answer: 13, 14, and 18; the 27-node split passes both size checks, while the 18-node fails minsplit.)
- A node at depth 2 has 100 observations. The maximum depth is 2, minsplit is 20, and a candidate would divide it into 50 and 50. Can it be split under these controls? Explain which condition decides. (Answer: No. The depth condition fails because \(2\not<2\), despite the parent and child sizes meeting their thresholds.)