Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2024 Mar 13.
Published in final edited form as: J Mach Learn Res. 2022;23:305.

Tree-Values: Selective Inference for Regression Trees

Anna C Neufeld 1, Lucy L Gao 2, Daniela M Witten 3
PMCID: PMC10933572  NIHMSID: NIHMS1916889  PMID: 38481523

Abstract

We consider conducting inference on the output of the Classification and Regression Tree (CART) (Breiman et al., 1984) algorithm. A naive approach to inference that does not account for the fact that the tree was estimated from the data will not achieve standard guarantees, such as Type 1 error rate control and nominal coverage. Thus, we propose a selective inference framework for conducting inference on a fitted CART tree. In a nutshell, we condition on the fact that the tree was estimated from the data. We propose a test for the difference in the mean response between a pair of terminal nodes that controls the selective Type 1 error rate, and a confidence interval for the mean response within a single terminal node that attains the nominal selective coverage. Efficient algorithms for computing the necessary conditioning sets are provided. We apply these methods in simulation and to a dataset involving the association between portion control interventions and caloric intake.

Keywords: Regression trees, CART, selective inference, post-selection inference, hypothesis testing

1. Introduction

Regression tree algorithms recursively partition covariate space using binary splits to obtain regions that are maximally homogeneous with respect to a continuous response. The Classification and Regression Tree (CART; Breiman et al. 1984) proposal, which involves growing a large tree and then pruning it back, is by far the most popular of these algorithms.

The regions defined by the splits in a fitted CART tree induce a piecewise constant regression model where the predicted response within each region is the mean of the observations in that region. CART is popular in large part because it is highly interpretable; someone without technical expertise can easily “read” the tree to make predictions, and to understand why a certain prediction is made. However, its interpretability belies the fact that CART trees are highly unstable: a small change to the training dataset can drastically change the structure of the fitted tree. In the absence of an established notion of statistical significance associated with a given split in the tree, it is hard for a practitioner to know whether they are interpreting signal or noise. In this paper, we use the framework of selective inference to fill this gap by providing a toolkit to conduct inference on hypotheses motivated by the output of the CART algorithm.

Given a CART tree, consider testing for a difference in the mean response of the regions resulting from a binary split. A very naive approach, such as a two-sample Z-test, that does not account for the fact that the regions were themselves estimated from the data will fail to control the selective Type 1 error rate: the probability of rejecting a true null hypothesis, given that we decided to test it (Fithian et al., 2014). Similarly, a naive Z-interval for the mean response in a region will not attain nominal selective coverage: the probability that the interval covers the parameter, given that we chose to construct it.

In fact, approaches for conducting inference on the output of a regression tree are quite limited. Sample splitting involves fitting a CART tree using a subset of the observations, which will naturally lead to an inferior tree to the one resulting from all of the observations, and thus is unsatisfactory in many applied settings; see Athey and Imbens (2016). Wager and Walther (2015) develop convergence guarantees for unpruned CART trees that can be leveraged to build confidence intervals for the mean response within a region; however, they do not provide finite-sample results and cannot accommodate pruning. Loh et al. (2016) and Loh et al. (2019) develop bootstrap calibration procedures that attempt to provide confidence intervals for the regions of a regression tree. In Appendix A, we show that this bootstrap calibration approach fails to provide intervals that achieve nominal coverage for the parameters of interest in this paper.

As an alternative to performing inference on a CART tree, one could turn to the conditional inference tree (CTree) framework of Hothorn et al. (2006). This framework uses a different tree-growing algorithm than CART, and at each split tests for linear association between the split covariate and the response. As summarized in Loh (2014), the CTree framework alleviates issues with instability and variable selection bias associated with CART. Despite these advantages, CTree remains far less widely-used than CART. Furthermore, while CTree attaches a notion of statistical significance to each split in a tree, it does not directly allow for inference on the mean response within a region or the difference in mean response between two regions. Finally, while the CTree framework requires few assumptions, its inference is based on asymptotics.

In this paper, we introduce a finite-sample selective inference (Fithian et al., 2014) framework for the difference between the mean responses in two regions, and for the mean response in a single region, in a pruned or unpruned CART tree. We condition on the event that CART yields a particular set of regions, and thereby achieve selective Type 1 error rate control as well as nominal selective coverage.

The rest of this paper is organized as follows. In Section 2, we review the CART algorithm, and briefly define some key ideas in selective inference. In Section 3, we present our proposal for selective inference on the regions estimated via CART. We show that the necessary conditioning sets can be efficiently computed in Section 4. In Section 5 we compare our framework to sample splitting and CTree via simulation. In Section 6 we compare our framework to CTree on data from the Box Lunch Study. The discussion is in Section 7. Technical details are relegated to the supplementary materials.

2. Background

2.1. Notation for Regression Trees

Given p covariates X1,…,Xp measured on each of n observations x1,…,xn, let xj,(s) denote the sth order statistic of the jth covariate, and define the half-spaces

χj,s,1=z∈Rp:zj≤xj,(s), χj,s,0=z∈Rp:zj>xj,(s). (1)

The following definitions are illustrated in Figure 1.

Figure 1:

Figure 1:

The regression tree takes the form TREE={ℝp,χ1,s1,1,χ1,s1,0,χ1,s1,1∩χ2,s2,1,χ1,s1,1∩χ2,s2,0}. The regions RA=χ1,s1,1∩χ2,s2,1 and RB=χ1,s1,1∩χ2,s2,0 are siblings, and are children, and therefore descendants, of the region χ1,s1,1. The ancestors of RA and RB are Rp and χ1,s1,1. Furthermore, RA,RB, and χ1,s1,0 are terminal regions.

Definition 1 (Tree and Region) Consider a set 𝒮 such that R⊆Rp for all R∈𝒮. Then 𝒮 is a tree if and only if (i) Rp∈𝒮; (ii) every element of 𝒮∖Rp equals R∩χj,s,e for some R∈𝒮,j∈{1,…,p}, s∈{1,…,n-1},e∈{0, 1}; (iii) R∩χj,s,e∈𝒮 implies that R∩χj,s,1-e∈𝒮 for e∈{0, 1}; and (iv) for any R,R′∈𝒮,R∩R′∈∅,R,R′. If R∈𝒮 and 𝒮 is a tree, then we refer to R as a region.

We use the notation tree to refer to a particular tree. Definition 1 implies that any region R∈TREE∖Rp is of the form R=∩l=1Lχjl,sl,el, where for each l=1,…,L, we have that jl∈{1,…,p},sl∈{1,…,n-1}, and el∈{0,1}. We call L the level of the region, and use the convention that the level of Rp is 0.

Definition 2 (Siblings and Children) Suppose that R,R∩χj,s,1,R∩χj,s,0⊆TREE. Then R∩χj,s,1 and R∩χj,s,0 are siblings. Furthermore, they are the children of R.

Definition 3 (Descendant and Ancestor) If R,R′∈TREE and R⊆R′, then R is a descendant of R′, and R′ is an ancestor of R.

Definition 4 (Terminal Region) A region R∈TREE without descendants is a terminal region.

We let desc(R, tree) denote the set of descendants of region R in tree, and we let term(R, tree) denote the subset of desc(R, tree) that are terminal regions.

Given a response vector y∈Rn, let y‾R=∑i:xi∈Ryi/∑i=1n1xi∈R, where 1(A) is an indicator variable that equals 1 if the event A holds, and 0 otherwise. Then, a tree tree induces the regression model μˆ(x)=∑R∈TERMRp,TREEy‾R1(x∈R). In other words, it predicts the response within each terminal region to be the mean of the observations in that region.

2.2. A Review of the CART Algorithm (Breiman et al., 1984)

The CART algorithm (Breiman et al., 1984) greedily searches for a tree that minimizes the sum of squared errors ∑R∈TERM⁡Rp,TREE∑i:xi∈Ryi-y‾R2. It first grows a very large tree via recursive binary splits, starting with the full covariate space Rp. To split a region R, it selects the covariate xj and the split point xj,(s) to maximize the gain, defined as

GAINR⁡(y,j,s)≡∑i∈Ryi-y‾R2-∑i∈R∩χj,s,1yi-y‾R∩χj,s,12+∑i∈R∩χj,s,0yi-y‾R∩χj,s,02. (2)

Details are provided in Algorithm A1.

Once a very large tree has been grown, cost-complexity pruning is applied. We define the average per-region gain in sum-of-squared errors provided by the descendants of a region R,

g(R, TREE ,y)=∑i:xi∈Ryi-y‾R2-∑r∈TERM⁡(R,TREE)∑i:xi∈ryi-y‾r2∣TERM⁡(R, TREE )∣-1. (3)

Given a complexity parameter λ≥0, if g(R, TREE,  y)<λ for some R∈TREE, then cost-complexity pruning removes R’s descendants from tree, turning R into a terminal region. Details are in Algorithm A2, which involves the notion of a bottom-up ordering.

Definition 5 (Bottom-up ordering) Let TREE =R1,…,RK. Let π be a permutation of the integers (1,…,K). Then 𝒪=Rπ(1),…,Rπ(K) is a bottom-up ordering of the regions in tree if, for all k=1,…,K,  π(k)≤π(j) if Rk∈DESC⁡Rj, TREE).

There are other equivalent formulations for cost-complexity pruning (see Proposition 7.2 in Ripley (1996)); the formulation in Algorithm A2 is convenient for establishing the results in this paper.

To summarize, the CART algorithm first applies Algorithm A1 to the initial region Rp and the data y to obtain an unpruned tree, which we call TREE0⁡(y). It then applies Algorithm A2 to TREE0⁡(y) to obtain an optimally-pruned tree using complexity parameter λ, which we call TREEλ⁡(y).

2.

2.

2.3. A Brief Overview of Selective Inference

Here, we provide a very brief overview of selective inference; see Fithian et al. (2014) or Taylor and Tibshirani (2015) for a more detailed treatment.

Consider conducting inference on a parameter θ. Classical approaches assume that we were already interested in conducting inference on θ before looking at our data. If, instead, our interest in θ was sparked by looking at our data, then inference must be performed with care: we must account for the fact that we “selected” θ based on the data (Fithian et al., 2014). In this setting, interest focuses on a p-value p(Y) such that the test for H0:θ=θ0 based on p(Y) controls the selective Type 1 error rate, in the sense that

prH0:θ=θ0⁡{p(Y)≤α∣θ selected }≤α, for all 0≤α≤1. (4)

Also of interest are confidence intervals [L(Y),U(Y)] that achieve (1-α)-selective coverage for the parameter θ, meaning that

pr⁡{θ∈[L(Y),U(Y)]∣θ selected }≥1-α. (5)

Roughly speaking, the inferential guarantees in (4) and (5) can be achieved by defining p-values and confidence intervals that condition on the aspect of the data that led to the selection of θ. In recent years, a number of papers have taken this approach to perform selective inference on parameters selected from the data in the regression (Lee et al., 2016; Liu et al., 2018; Tian and Taylor, 2018; Tibshirani et al., 2016), clustering (Gao et al., 2020), and changepoint detection (Hyun et al., 2021; Jewell et al., 2022) settings.

In the next section, we propose p-values that satisfy (4) and confidence intervals that satisfy (5) in the setting of CART, where the parameter of interest is either the mean response within a region, or the difference between the mean responses of two sibling regions.

3. The Selective Inference Framework for CART

3.1. Inference on a Pair of Sibling Regions

Throughout this paper, we assume that Y~Nnμ,σ2In with σ>0 known.

We let X∈Rn×p denote a fixed covariate matrix. Suppose that we apply CART with complexity parameter λ to a realization y=y1,…,ynT from Y to obtain TREEλ⁡(y). Given sibling regions RA and RB in TREEλ⁡(y), we define a contrast vector νsib∈Rn such that

νsibi=1xi∈RA∑i′=1n1xi′∈RA-1xi∈RB∑i′=1n1xi′∈RB, (6)

and νsibTμ=∑i:xi∈RAμi/∑i=1n1xi∈RA-∑i:xi∈RBμi/∑i=1n1xi∈RB. Now, consider testing the null hypothesis of no difference in means between RA and RB, i.e. H0 : νsibTμ=0 versus H1:νsibTμ≠0. This null hypothesis is of interest because RA and RB appeared as siblings in TREEλ⁡(y). A test based on a p-value of the form prH0νsibTY≥νsibTy that does not account for this will not control the selective Type 1 error rate in (4).

To control the selective Type 1 error rate, we propose a p-value that conditions on the aspect of the data that led us to select νsibTμ,

prH0⁡νsibTY≥νsibTy∣RA,RB are siblings in TREEλ⁡Y. (7)

But (7) depends on a nuisance parameter, the portion of μ that is orthogonal to νsib. To remove the dependence on this nuisance parameter, we condition on its sufficient statistic 𝒫νsib⊥Y, where 𝒫ν⊥=I-ννT/∥ν∥22. The resulting p-value, or "tree-value", is defined as

psiby=prH0⁡νsibTY≥νsibTy∣RA,RB are siblings in TREEλ⁡Y,𝒫νsib⊥Y=𝒫νsib⊥y. (8)

Results similar to Theorem 6 can be found in Jewell et al. (2022); Lee et al. (2016); Liu et al. (2018), and Tibshirani et al. (2016).

Theorem 6 The test based on the p-value psib(y) in (8) controls the selective Type 1 error rate for H0:νsibTμ=0, where νsib is defined in (6), in the sense that

prH0psib(Y)≤α∣RA,RBaresiblingsinTREEλ⁡(Y)=α,forall0≤α≤1. (9)

Furthermore, psib(y)=pr⁡|ϕ|≥νsibTy∣ϕ∈Ssibλνsib, where ϕ~N0,νsib22σ2,y′(ϕ,ν)=𝒫ν⊥y+ϕν/∥ν∥22, and

Ssibλνsib=ϕ:RA,RBaresiblingsinTREEλ⁡y′ϕ,νsib. (10)

Proofs of all theoretical results are provided in the appendix. Theorem 6 says that given the set Ssibλνsib, we can compute the p-value in (8) using

psib(y)=1-FνsibTy;0,νsib22σ2,Ssibλνsib+F-νsibTy;0,νsib22σ2,Ssibλνsib, (11)

where F⋅;0,∥ν∥2σ2,S denotes the cumulative distribution function of the N0,∥ν∥22σ2 distribution truncated to the set S. In Section 4, we provide an efficient approach for analytically characterizing the truncation set Ssibλνsib. To avoid numerical issues associated with the truncated normal distribution, we compute (11) using methods described in the supplement of Chen and Bien (2020). Note that the proof of Theorem 6, and consequently the efficient computation of psib(y) discussed in Section 4, relies on the assumption that Y~Nnμ,σ2In

We now consider inverting the test proposed in (8) to construct an equitailed confidence interval for νsibTμ that has (1-α)-selective coverage (5), in the sense that

pr⁡νsibTμ∈[L(Y),U(Y)]∣RA,RB are siblings in TREEλ⁡(Y)=1-α. (12)

Proposition 7 For any 0≤α≤1 and any realization y∈Rn, the values L(y) and U(y) that satisfy

FνsibTy;L(y),σ2νsib22,Ssibλνsib=1-α/2, FνsibTy;U(y),σ2νsib22,Ssibλνsib=α/2, (13)

are unique, and [L(Y), U(Y)] achieves (1-α)-selective coverage for νsibTμ.

3.2. Inference on a Single Region

Given a single region RA in a CART tree, we define the contrast vector νreg such that

νregi=1xi∈RA/∑i′=1n1xi′∈RA. (14)

Then, νregTμ=∑i:xi∈RAμi/∑i=1n1xi∈RA. We now consider testing the null hypothesis H0:νregTμ=c for some fixed c. Because our interest in this null hypothesis results from the fact that RA∈TREEλ⁡(y), we must condition on this event in defining the p-value. We define

pregy=prH0⁡νregTY-c≥νregTy-c∣RA∈TREEλ⁡Y,𝒫νreg⊥Y=𝒫νreg⊥y, (15)

and introduce the following theorem.

Theorem 8 The test based on the p-value preg(y) in (15) controls the selective Type 1 error rate for H0:νregTμ=c, where νreg is defined in (14). Furthermore, pregy=pr⁡|ϕ-c|≥νregTy-c∣ϕ∈Sregνreg, where ϕ~Nc,νreg22σ2 and, for y′ϕ,ν=𝒫ν⊥y+ϕν/∥ν∥22,

Sregλνreg=ϕ:RA∈TREEλ⁡y′ϕ,νreg. (16)

Theorem 2 and the resulting efficient computations in Section 4 rely on the assumption that Y~Nnμ,σ2In.

We can also define a confidence interval for νregTμ that attains nominal selective coverage.

Proposition 9 For any 0≤α≤1 and any realization y∈Rn, the values L(y) and U(y) that satisfy

FνregTy;L(y),σ2νreg22,Sregλνreg=1-α/2, FνregTy;U(y),σ2νreg22,Sregλνreg=α/2, (17)

are unique, and [L(Y),U(Y)] achieves (1-α)-selective coverage for νregTμ.

In Section 4, we propose an approach to analytically characterize the set Sregλνreg in (16).

3.3. Intuition for the Conditioning Sets Ssibλνsib and Sregλνreg

We first develop intuition for the set Ssibλνsib defined in (10). From Theorem 6,

y′ϕ,νsibi=yi+ϕ-νsibTy∑i′=1n1xi′∈RB∑i′=1n1xi′∈RA∪RB1xi∈RA-∑i′=1n1xi′∈RA∑i′=1n1xi′∈RA∪RB1xi∈RB.

Thus, y′ϕ,νsib is a perturbation of y that exaggerates the difference between the observed sample mean responses of RA and RB if |ϕ|>νsibTy, and shrinks that difference if |ϕ|< νsibTy. The set Ssibλνsib quantifies the amount that we can shift the difference in sample mean responses between RA and RB while still producing a tree containing these sibling regions. The top row of Figure 2 displays TREE0⁡y′ϕ,νsib, as a function of ϕ, in an example where Ssib0νsib=(-19.8,-1.8)∪(0.9,34.9).

Figure 2:

Figure 2:

Data with n=100 and p=2. Regions resulting from CART (λ=0) are delineated using solid lines. Here, RA=χ1,26,0∩χ2,72,1 and RB=χ1,26,0∩χ2,72,0. Top: Output of CART applied to y′ϕ,νsib, where νsib in (6) encodes the contrast between RA and RB, for various values of ϕ. The left-most panel displays y=y′νsibTy,νsib. By inspection, we see that -14.9∈Ssib0νsib and 5∈Ssib0νsib, but 0∉Ssib0νsib and 40∉Ssib0νsib. In fact, Ssib0νsib=(-19.8,-1.8)∪(0.9,34.9). Bottom: Output of CART applied to y′ϕ,νreg, where νreg in (14) encodes membership in RA. The left-most panel displays y=y′νregTy,νreg. Here, Sreg0νreg=(-∞,3.1)∪(5.8,8.8)∪(14.1,∞).

We next develop intuition for Sregλνreg, defined in (16). Note that y′ϕ,νregi=yi+ϕ-νregTy1xi∈RA, where y′ϕ,νreg is defined in Theorem 8. Thus, y′ϕ,νreg shifts the responses of the observations in RA so that their sample mean equals ϕ, and leaves the others unchanged. The set Sregλνreg quantifies the amount that we can exaggerate or shrink the sample mean response in region RA while still producing a tree that contains RA. The bottom row of Figure 2 displays y′ϕ,νreg as ϕ is varied, in an example with Sreg0νreg=(-∞,3.1)∪(5.8,8.8)∪(14.1,∞).

4. Computing the conditioning sets Ssibλνsib and Sregλνreg

4.1. Recharacterizing the conditioning sets in terms of branches

We begin by introducing the concept of a branch.

Definition 10 (Branch) A branch is an ordered sequence of triples ℬ=j1,s1,e1,…,jL,sL,eL such that jl∈{1,…,p},sl∈{1,…,n-1}, and el∈{0,1} for l=1,…,L. The branch ℬ induces a nested set of regions ℛ(ℬ)=R(0),R(1),…,R(L), where R(l)=⋂l′=1lχjl′,sl′,el′ for l=1,…,L, and R(0)=Rp.

For a branch ℬ and a vector ν, we define

Sλℬ,ν=ϕ:ℛℬ⊆TREEλ⁡y′ϕ,ν. (18)

For R∈TREE, we let BRANCH⁡(R, TREE) denote the branch such that ℛ{BRANCH⁡(R, TREE)} contains R and all of its ancestors in tree.

Lemma 11 Suppose that RA and RB are siblings in TREEλ⁡(y). Then RA and RB are siblings in TREEλ⁡y′ϕ,νsib if and only if ℛBRANCH⁡RA,TREEλ⁡(y)⊆TREEλ⁡y′ϕ,νsib. Therefore, Ssibλνsib=SλBRANCH⁡RA, TREEλ⁡(y),νsib, defined in (10) and (18).

Lemma 11 says that TREEλ⁡y′ϕ,νsib contains siblings RA and RB if and only if it contains the entire branch associated with RA in TREEλ⁡(y). However, Lemma 11 does not apply in the single region case: for νreg defined in (14) and some RA∈TREEλ⁡(y), the fact that RA∈TREEλ⁡y′ϕ,νreg does not imply that ℛBRANCH⁡RA,TREEλ⁡(y)⊆ TREEλ⁡y′ϕ,νreg. Instead, a result similar to Lemma 11 holds, involving permutations of the branch.

Definition 12 (Permutation of a branch) Let Π denote the set of all L! permutations of (1, 2,…,L). Given π∈Π and a branch ℬ=j1,s1,e1,…,jL,sL,eL, we say that π(ℬ)=jπ(1),sπ(1),eπ(1),…,jπ(L),sπ(L),eπ(L) is a permutation of the branch ℬ.

Branch ℬ and its permutation π(ℬ) induce the same region R(L), but ℛ{π(ℬ)}≠ℛ(ℬ).

Lemma 13 Let RA∈TREEλ⁡(y). Then RA∈TREEλ⁡y′ϕ,νreg if and only if there exists a π∈Π such that ℛπBRANCHRA⁡(y)⊆TREEλ⁡y′ϕ,νreg. Thus, for Sregλνreg in (16),

Sregλνreg=⋃π∈ΠSλπBRANCH⁡RA,TREEλ⁡(y),νreg. (19)

Lemmas 11 and 13 reveal that computing Ssibλνsib and Sregλνreg requires characterizing sets of the form Sλ(ℬ,ν), defined in (18). To compute Ssibλνsib we will only need to consider Sλ(ℬ,ν) where ℛ(ℬ)⊆TREEλ⁡(y). However, to compute Sregλνreg, we will need to consider Sλ{π(ℬ),ν} where ℛ(ℬ)⊆TREEλ⁡(y) but ℛ{π(ℬ)}⊈TREEλ⁡(y).

4.2. Computing Sλ(ℬ,ν) in (18)

Throughout this section, we consider a vector ν∈Rn and a branch ℬ=j1,s1,e1,…,jL,sL,eL, where ℛ(ℬ) may or may not be in TREEλ⁡(y). Recall from Definition 10 that ℬ induces the nested regions R(l)=⋂l′=1lχjl′,sl′,el′ for l=1,…,L, and R(0)=Rp. Throughout this section, our only requirement on ℬ and ν is the following condition.

Condition 1 For y′(ϕ,ν) defined in Theorem 6, ℬ and ν satisfy {y′(ϕ,ν)}i=yi+c11{xi∈R(L)}+c21[xi∈{R(L−1)∩χjL,sL,1−eL}] for i=1,…,n and for some constants c1 and c2.

To characterize Sλ(ℬ,ν) in (18), recall that the CART algorithm in Section 2.2 involves growing a very large tree TREE0⁡(y), and then pruning it. We first characterize the set

Sgrowℬ,ν=ϕ:ℛℬ⊆TREE0⁡y′ϕ,ν. (20)

Proposition 14 Recall the definition of GAINR(l)⁡y′(ϕ,ν),j,s in (2), and let Sl,j,s={ϕ :GAINR(l-1)⁡y′(ϕ,ν),j,s≤GAINR(l-1)⁡y′(ϕ,ν),jl,sl. Then, Sgrow(ℬ,ν)=⋂l=1L⋂j=1p⋂s=1n-1Sl,j,s.

Proposition 15 says that we can compute Sgrow(ℬ,ν) efficiently.

Proposition 15 The set Sl,j,s is defined by a quadratic inequality in ϕ. Furthermore, we can evaluate all of the sets Sl,j,s, for l=1,…,L,j=1,…,p,s=1,…,n-1, in O{npL+np log⁡(n)} operations. Intersecting these sets to obtain Sgrow(ℬ,ν) requires at most O{npL×log⁡(npL)} operations, and only O(npL) operations if ℬ=BRANCH⁡RA,TREEλ⁡(y) and ν is of the form νsib in (6).

Noting that Sλ(ℬ,ν)=ϕ∈Sgrow(ℬ,ν):R(L)∈TREEλ⁡y′(ϕ,ν), it remains to characterize the set of ϕ∈Sgrow(ℬ,ν) such that R(L) is not removed during pruning. Recall that g(⋅) was defined in (3).

Proposition 16 There exists a tree TREE⁡(ℬ,ν,λ) such that

Sλ(ℬ,ν)=Sgrow(ℬ,ν)∩⋂l=0L-1ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ. (21)

If ℛ(ℬ)∈TREEλ⁡(y), then TREE⁡(ℬ,ν,λ)=TREEλ⁡(y) satisfies (21). Otherwise, given the set Sgrow(ℬ,ν), computing a TREE⁡(ℬ,ν,λ) that satisfies (21) has a worst-case computational cost of On2p.

We explain how to compute a TREE⁡(ℬ,ν,λ) satisfying (21) when ℛ(ℬ)∉TREEλ⁡(y) in the supplementary materials.

Proposition 17 The set ⋂l=0L-1ϕ :gR(l), TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ in (21) is the intersection of the solution sets of L quadratic inequalities in ϕ. Given TREE⁡(ℬ,ν,λ), the coefficients of these quadratics can be obtained in O(nL) operations. After Sgrow(ℬ,ν) has been computed, intersecting it with these quadratic sets to obtain Sλ(ℬ,ν) from (21) requires O{npL×log⁡(npL)} operations in general, and only O(L) operations if ℬ=BRANCH⁡RA,TREEλ⁡(y) and ν=νsib from (6).

The results in this section have relied upon Condition 1. Indeed, this condition holds for branches ℬ and vectors ν that arise in characterizing the sets Ssibλνsib and Sregλνreg.

Proposition 18 If either (i) ℬ=BRANCH⁡RA,TREEλ⁡(y) and ν=νsib (6), where RA and RB are siblings in TREEλ⁡(y), or (ii) ℬ is a permutation of BRANCH⁡RA,TREEλ⁡(y) and ν=νreg(14), where RA∈TREEλ⁡(y), then Condition 1 holds.

Combining Lemma 11 with Propositions 14–18, we see that Ssibλνsib can be computed in O{npL+np log⁡(n)} operations. However, computing Sregλνreg is much more computationally intensive: by Lemma 13 and Propositions 14–18, it requires computing SλπBRANCH⁡RA,TREEλ⁡(y),νreg for all L! permutations π∈Π, for a total of OL!n2pLlog(pL) operations. In Section 4.3, we discuss ways to avoid these calculations.

4.3. A Computationally-Efficient Alternative to Sregλνreg

Lemma 13 suggests that carrying out inference on a single region requires computing SλπBRANCH⁡RA,TREEλ⁡(y),νreg for every π∈Π. We now present a less computationally demanding alternative.

Proposition 19 Let Q be a subset of the L! permutations in Π, i.e. Q⊆Π. Define

pregQ(y)=prH0{|νregTY−c|≥|νregTy−c|∣∪π∈Q(ℛ(π[BRANCH{RA,TREEλ(y)}])⊆TREEλ(Y)),𝒫νreg⊥Y=𝒫νreg⊥y}.

The test based on preg Q(y) controls the selective Type 1 error rate (4) for H0:νreg Tμ=c. Furthermore, preg Q(y)=pr|ϕ-c|≥νregTy-c∣ϕ∈⋃π∈QSλπBRANCH⁡RA,TREEλ⁡(y),νreg, where ϕ~Nc,νreg22σ2.

Using the notation in Proposition 19, preg(y) introduced in (15) equals pregΠ(y). If we take Q={ℐ}, where ℐ is the identity permutation, then we arrive at

pregℐ(y)=P|ϕ-c|≥νregTy-c∣ϕ∈SλBRANCH⁡RA,TREEλ⁡(y),νreg, (22)

where ϕ~Nc,νreg22σ2. The set SλBRANCH⁡RA,TREEλ⁡(y),νreg can be easily computed by Proposition 16.

Compared to (15), (22) conditions on an extra piece of information: the ancestors of RA. Thus, while (22) controls the selective Type 1 error rate, it may have lower power than (15) (Fithian et al., 2014). Similarly, inverting (22) to form a confidence interval provides correct selective coverage, but may yield intervals that are wider than those in Proposition 9. Proposition 19 is motivated by a proposal by Lee et al. (2016) to condition on both the selected model (necessary information) and the signs of the selected variables (extra information) in the lasso setting, to gain computational efficiency at the possible expense of precision and power.

In Appendix F, we show through simulation that the loss in power associated with using (22) rather than (15) is negligible. Thus, in practice, we suggest using (22) for its computational efficiency. We use (22) for the remainder of this paper.

Furthermore, we can consider computing confidence intervals of the form LSregℐ(y),USregℐ(y) rather than (17), where LSregℐ(y) and USregℐ(y) satisfy

FνregTy;LSregℐ(y),σ2νreg22,SλBRANCH⁡RA,TREEλ⁡(y),νreg=1-α2,FνregTy;USregℐ(y),σ2νreg22,SλBRANCH⁡RA,TREEλ⁡(y),νreg=α2. (23)

In Appendix F, we show that the confidence intervals resulting from (23) are not much wider than those resulting from (17). We therefore make use of confidence intervals of the form (23) in the remainder of this paper.

5. Simulation Study

5.1. Data Generating Mechanism

We simulate X∈Rn×p with n=200, p=10, Xij~i.i.d.N(0, 1), and y~Nnμ,σ2In with σ=5 and μi=b×1xi,1≤0×1+a1xi,2>0+1xi,3×xi,2>0. This μ vector defines a three-level tree, shown in Figure 3 for three values of a∈R.

Figure 3:

Figure 3:

The true mean model in Section 5, for a=0.5 (left), a=1 (center), and a=2 (right). The difference in means between the sibling nodes at level two in the tree is ab, while the difference in means between the sibling nodes at level three is b.

5.2. Methods for Comparison

All CART trees are fit using the R package rpart (Therneau and Atkinson, 2019) with λ=200, a maximum level of three, and a minimum node size of one. We compare three approaches for conducting inference. (i) Selective Z-methods: Fit a CART tree to the data. For each split, test for a difference in means between the two sibling regions using (8), and compute the corresponding confidence interval in (13). Compute the confidence interval for the mean of each region using (23). (ii) Naive Z-methods: Fit a CART tree to the data. For each split, conduct a naive Z-test for the difference in means between the two sibling regions, and compute the corresponding naive Z-interval. Compute a naive Z-interval for each region's mean. (iii) Sample splitting: Split the data into equally-sized training and test sets. Fit a CART tree to the training set. On the test set, conduct a naive Z-test for each split and compute a naive Z-interval for each split and each region. If a region has no test set observations, then we fail to reject the null hypothesis and fail to cover the parameter.

The conditional inference tree (CTree) framework of Hothorn et al. (2006) uses a different criterion than CART to perform binary splits. Within a region, it tests for linear association between each covariate and the response. The covariate with the smallest p-value for this linear association is selected as the split variable, and a Bonferroni corrected p-value that accounts for the number of covariates is reported in the final tree. Then, the split point is selected. If, after accounting for multiple testing, no variable has a p-value below a prespecified significance level α, then the recursion stops. While CTree's p-values assess linear association and thus are not directly comparable to the p-values in (i)–(iii) above, it is the most popular framework currently available for determining if a regression tree split is statistically significant. Thus, we also evaluate the performance of (iv) CTree: Fit a CTree to all of the data using the R package partykit (Hothorn and Zeileis, 2015) with α=0.05. For each split, record the p-value reported by partykit.

In Sections 5.3–5.6, we assume that σ is known. We consider the case of unknown σ in Section 5.7

5.3. Uniform p-values under a Global Null

We generate 5, 000 datasets with a=b=0, so that H0:νsibTμ=0 holds for all splits in all trees. Figure 4 displays the distributions of p-values across all splits in all fitted trees for the naive Z-test, sample splitting, and the selective Z-test. The selective Z-test and sample splitting achieve uniform p-values under the null, while the naive Z-test (which does not account for the fact that νsib was obtained by applying CART to the same data used for testing) does not. CTree is omitted from the comparison: it creates a split only if the p-value is less than α=0.05, and thus its p-values over the splits do not follow a Uniform(0, 1) distribution.

Figure 4:

Figure 4:

Quantile-quantile plots of the p-values for testing H0:νsibTμ=0, as described in Section 5.3. A naive Z-test (green), sample splitting (blue), and selective Z-test (pink) were performed; see Section 5.2. The p-values are stratified by the level of the regions in the fitted tree.

5.4. Power

We generate 500 datasets for each (a,b)∈{0.5,1,2}×{1,…,10}, and evaluate the power of selective Z-tests, sample splitting, and CTree to reject the null hypothesis H0:νsibTμ=0. As naive Z-tests do not control the Type 1 error rate (Figure 4), we do not evaluate their power. We consider two aspects of power: the probability that we detect a true split, and the probability that we reject the null hypothesis corresponding to a true split.

Given a true split in Figure 3 and an estimated split, we construct the 3×3 contingency table in Table 1, which indicates whether an observation is on the left-hand side, right-hand side, or not involved in the true split (rows) and the estimated split (columns). To quantify the agreement between the true and estimated splits, we compute the adjusted Rand index (Hubert and Arabie, 1985) associated with the 2×3 contingency table corresponding to the shaded region in Table 1. For each true split, we identify the estimated split for which the adjusted Rand index is largest; if this index exceeds 0.75 then this true split is “detected”. Given that a true split is detected, the associated null hypothesis is rejected if the corresponding p-value is below 0.05. Figure 5 displays the proportion of true splits that are detected and rejected by each method.

Table 1:

A 3×3 contingency table indicating an observation's involvement in a given true split and estimated split. The adjusted Rand index is computed using only the shaded cells

Estimated Split
In left region In right region In neither
In left region t1 t2 t3
True Split In right region u1 u2 u3
In neither v1 v2 v3

Figure 5:

Figure 5:

Proportion of true splits detected (solid lines) and rejected (dotted lines) for CART with selective Z-tests (pink), CTree (black), and CART with sample splitting (blue) across different settings of the data generating mechanism, stratified by level in tree. As CTree only makes a split if the p-value is less than 0.05, the proportion of detections equals the proportion of rejections.

As sample splitting fits a tree using only half of the data, it detects fewer true splits, and thus rejects the null hypothesis for fewer true splits, than the selective Z-test.

When a is small, the difference in means between sibling regions at level two is small. Because CTree makes a split only if there is strong evidence of association at that level, it tends to build one-level trees, and thus fails to detect many true splits; by contrast, the selective Z-test (based on CART) successfully builds more three-level trees. Thus, when a is small, the selective Z-test detects (and rejects) more true differences than CTree between regions at levels two and three.

5.5. Coverage of Confidence Intervals for νsibTμ and νregTμ

We generate 500 datasets for each (a,b)∈{0.5, 1, 2}×{0,…, 10} to evaluate the coverage of 95% confidence intervals constructed using naive Z-methods, selective Z-methods, and sample splitting. CTree is omitted from these comparisons because it does not provide confidence intervals. We say that the interval covers the truth if it contains νTμ, where ν is defined as in (6) (for a particular split) or (14) (for a particular region). Table 2 shows the proportion of each type of interval that covers the truth, aggregated across values of a and b. The selective Z-intervals attain correct coverage of 95%, while the naive Z-intervals do not.

Table 2:

Proportion of 95% confidence intervals containing the true parameter, aggregated over all trees fit to the 5,500 datasets generated with (a,b)∈{0.5, 1, 2}×{1,…,10}

Parameter νregTμ Parameter νsibTμ
Level Selective Z Naive Z Sample Splitting Selective Z Naive Z Sample Splitting
1 0.951 0.889 0.918 0.948 0.834 0.915
2 0.950 0.645 0.921 0.951 0.410 0.917
3 0.951 0.711 0.921 0.950 0.550 0.921

It may come as a surprise that sample splitting does not attain correct coverage. Recall that ν from (6) or (14) is an n-vector that contains entries for all observations in both the training set and the test set. Thus, νTμ involves the true mean among both training and test set observations in a given region or pair of regions. By contrast, sample splitting attains correct coverage for a different parameter involving the true means of only the test observations that fall within a given region or pair of regions.

5.6. Width of Confidence Intervals

Figure 6(a) illustrates that our selective Z-intervals for νregTμ can be extremely wide when b is small, particularly for regions located at deeper levels in the tree. For each tree that we build and for levels 1, 2, and 3, we compute the adjusted Rand Index (Hubert and Arabie, 1985) between the true tree (truncated at the appropriate level) and the estimated tree (truncated at the same level). Figure 6(b) shows that our selective confidence intervals can be extremely wide when this adjusted Rand Index is small, particularly at deeper levels of the tree.

Figure 6:

Figure 6:

The median width of the selective Z-intervals for parameter νregTμ for regions at levels one (solid), two (dashed), and three (dotted) of the tree. Similar results hold for parameter νsibTμ. Panel (a) breaks results down by the parameters a and b, whereas panel (b) aggregates results across values of parameters a and b, and displays them as a function of the adjusted Rand Index between the true and estimated trees.

When b is small and the adjusted Rand Index is small, the trees built by CART tend to be unstable, in the sense that small perturbations to the data affect the fitted tree. In this setting, the sample statistics νregTy fall very close to the boundary of the truncation set. See Kivaranovic and Leeb (2021) for a discussion of why wide confidence intervals can arise in these settings. The great width of our confidence intervals reflects the uncertainty about the mean response within each region due to the instability of the tree-fitting procedure.

5.7. Results with Unknown σ

Thus far, we have assumed that σ is known. In this section, we compare the following three versions of the selective Z-methods that plug different values of σ into the truncated normal CDF when computing p-values and confidence intervals:

  1.  σ : We plug in the true value of σ, as in Sections 5.3–5.6.

  2.  σˆcons : We plug in σ^cons =(n−1)−1∑i=1n(yi−y¯)2, where y‾=n-1∑i=1nyi.

  3.  σˆSSE : Let 𝒯=TERM⁡Rp,TREEλ⁡(y) be the number of terminal regions in TREEλ⁡(y). We plug in σˆSSE=(n-𝒯)-1∑i=1nyi-yˆi2, where yˆi is the predicted value for the ith observation given by TREEλ⁡(y).

It is straightforward to show that Eσˆcons2≥σ2, for any value of E[y]=μ. Thus, we expect this estimate to lead to conservative inference. On the other hand, σˆSSE2 can be made arbitrarily small by making the fitted tree arbitrarily deep, and so we expect inference based on this estimate to be anti-conservative if the fitted CART tree is large.

Figure 7 shows the distribution of p-values from testing H0:νsibTμ=0 with the three versions of the selective Z-test under the data generating mechanism described in Section 5.1, with a=b=0. In this setting, νsibTμ=0 holds for all splits in all trees. We see almost no difference between the three versions of the selective Z-test. In this global null setting, Eσˆcons2=σ2. Furthermore, the empirical bias of σˆSSE2 is small because the trees we grow are not particularly large; as in the rest of Section 5, we build trees to a maximum depth of 3 and prune with λ=200.

Figure 7:

Figure 7:

QQ plots of the p-values from testing H0:νsibTμ=0 when μ=0n using the selective Z-test with three different values plugged in to the truncated normal CDF for σ. The p-values are stratified by the level of the regions in the fitted tree.

Figure 8 displays the proportion of true splits detected and the proportion of true splits detected and rejected, as defined in Section 5.4, for the three versions of the selective Z-test when data is generated as in Section 5.4. For simplicity, we only show the setting where a=1. All three methods detect the same proportion of true splits, because they all perform inference on the same CART trees. The proportion of splits detected and rejected is very similar for σ and σˆSSE because σˆSSE is a very good estimator for σ in this setting. While σˆcons performs reasonably when b is small, it severely overestimates σ and thus has low power when b is large.

Figure 8:

Figure 8:

Proportion of true splits detected (solid lines) and rejected (dotted lines) for CART with the three versions of the selective Z-test. The results are stratified by level in tree.

Table 3 displays confidence intervals for νsibTμ and νregTμ for the three versions of the selective Z-intervals, where data is generated as in Section 5.5. As expected, σˆcons  leads to slight over-coverage and σˆSSE leads to slight under-coverage.

Table 3:

Proportion of 95% confidence intervals containing the true parameter, aggregated over all trees fit to the 5,500 datasets generated with (a,b)∈{0.5, 1, 2}×{1,…,10}

Parameter νregTμ Parameter νsibTμ
Level σ σˆcons  σˆSSE  σ σˆcons  σˆSSE 
1 0.95 0.98 0.95 0.95 0.98 0.94
2 0.95 0.97 0.94 0.95 0.97 0.94
3 0.95 0.96 0.94 0.95 0.96 0.94

In this section, we have seen that when trees are not grown overly large, plugging in σˆSSE leads to approximate selective Type 1 error control, approximately correct selective coverage, and good power. Unfortunately, providing theoretical guarantees for our procedures when using σˆSSE would be quite difficult, as the estimator is anti-conservative and depends on the output of CART. Providing theoretical guarantees for our procedures under σˆcons is more straightforward, using ideas from Gao et al. (2020), Chen and Witten (2022), and Tibshirani et al. (2018). However, as shown in Figure 8, selective Z-tests based on σˆcons can have very low power. One promising avenue of future work involves providing theoretical guarantees in the regression tree setting for estimators that are less conservative than σˆcons.

6. An Application to the Box Lunch Study

Venkatasubramaniam et al. (2017) compare CART and CTree (Hothorn et al., 2006) within the context of epidemiological studies. They conclude that CTree is preferable to CART because it provides p-values for each split, even though CART has higher predictive accuracy. Since our framework provides p-values for each split in a CART tree, we revisit their analysis of the Box Lunch Study, a clinical trial studying the impact of portion control interventions on 24-hour caloric intake. We consider identifying subgroups of study participants with baseline differences in 24-hour caloric intake on the basis of scores from an assessment that quantifies constructs such as hunger, liking, the relative reinforcement of food (rrvfood), and restraint (resteating).

We exactly reproduce the trees presented in Figures 1 and 2 of Venkatasubramaniam et al. (2017) by building a CTree using partykit and a CART tree using rpart on the Box Lunch Study data provided in the R package visTree (Venkatasubramaniam and Wolfson, 2018). We apply our selective inference framework to compute p-values (8) for each split in CART, and confidence intervals (23) for each region. In this section, we use σˆSSE, defined in Section 5.7, to estimate the error variance. The results are shown in Figure 9.

Figure 9:

Figure 9:

Left: A CART tree fit to the Box Lunch Study data. Each split has been labeled with a p-value (8), and each region has been labeled with a confidence interval (23). The shading of the nodes indicates the average response values (white indicates a very small value and dark blue a very large value). Top right: A CTree fit to the Box Lunch Study data. Bottom right: A scatterplot showing the relationship between the covariate hunger and the response.

Both CART and CTree choose hunger<1.8 as the first split. For this split, our selective Z-test reports a large p-value of 0.44, while CTree reports a p-value less than 0.001. The conflicting p-values are explained by the difference in null hypotheses. CTree finds strong evidence against the null of no linear association between hunger and caloric intake. By contrast, our selective framework for CART does not find strong evidence for a difference between mean caloric intake of participants with hunger<1.8 and those with hunger ≥1.8. We see from the bottom right of Figure 9 that while there is evidence of a linear relationship between hunger and caloric intake, there is less evidence of a difference in means across the particular split hunger=1.8. Given that the goal of Venkatasubramaniam et al. (2017) is to "identify population subgroups that are relatively homogeneous with respect to an outcome", the p-value resulting from our selective framework is more natural than the p-value output by CTree, since the former relates directly to the subgroups formed by the split, whereas the latter does not take into account the location of the split point. In general, the left-hand panel of Figure 9 shows that the subgroups of patients identified by CART are not significantly different from one another. This is an important finding that would be missed without our selective inference framework. Furthermore, unlike CTree, our framework provides confidence intervals for the mean response in each subgroup.

An alternative analysis using σˆcons, defined in Section 5.7, is provided in Appendix H, and leads to similar findings.

7. Discussion

Our framework relies on the assumption that Y~Nnμ,σ2I, with σ2 known. In Section 5.7, we showed strong empirical performance when the variance is unknown and σ2 is estimated. In this section, we briefly comment on the assumptions of spherical variance and normally distributed data.

It natural to wonder whether the assumption that Y~Nnμ,σ2I can be relaxed to the assumption that Y~Nn(μ,Σ), with Σ known. Following the work of Lee et al. (2016), the results in Section 3 extend to the setting where Y~Nn(μ,Σ) if we:

  1. Modify (8) and (15) to condition on the event In-ΣννTνTΣνY=In-ΣννTνTΣνy rather than the event 𝒫ν⊥Y=𝒫ν⊥y, where ν=νsib in the case of (8) and ν=νreg in the case of (15).

  2. Replace all instances of the perturbation y′(ϕ,ν), defined in Theorem 6, with the perturbation y″(ϕ,ν)=In-ΣννTνTΣνy+ΣννTΣνϕ.

Unfortunately, the modified perturbation y″(ϕ,ν) does not satisfy Condition 1 in Section 4.2 when Σ≠σ2In, and so many of the results of Section 4 do not extend to this non-spherical setting. Future work could explore how to efficiently compute the conditioning set in this non-spherical setting.

Furthermore, our framework assumes a normally-distributed response variable. CART is commonly used for classification, survival (Segal, 1988), and treatment effect estimation in causal inference (Athey and Imbens, 2016). While the idea of conditioning on a selection event to control the selective Type 1 error rate applies regardless of the distribution of the response, our Theorem 6 and Theorem 8, and the resulting computational results, relied on normality of Y. In the absence of this assumption, exactly characterizing the conditioning set and the distribution of the test statistic requires further investigation.

We show in Appendix G that our selective Z-tests approximately control the selective Type 1 error when the normality assumption is violated. Tian and Taylor (2017) and Tibshirani et al. (2018) establish conditions under which selective p-values for linear regression (derived under the assumption of normality) will be asymptotically uniformly distributed under non-normality. Thus suggests the possibility of developing asymptotic theory for our proposed selective Z-tests under violations of normality.

A reviewer pointed out similarities between the problem of testing significance of the first split in the tree and significance testing for a single changepoint, as in Bhattacharya (1994). Building on this connection may provide an avenue for future work.

A software implementation of the methods in this paper is available in the R package treevalues, at https://github.com/anna-neufeld/treevalues.

Acknowledgments

Daniela Witten and Anna Neufeld were supported by the National Institutes of Health (NIH R01 GM12399) and the Simons Foundation (Simons Investigator Award in Mathematical Modeling of Living Systems). Lucy Gao was supported by the Natural Sciences and Engineering Research Council of Canada (Discovery Grants).

Appendix A. Comparison to Loh et al. (2019)

Loh et al. (2016) and Loh et al. (2019) use regression trees to find subgroups of patients with similar treatment effects in clinical trials. They grow trees based on patient characteristics using a different algorithm than CART. Furthermore, they are interested in the mean treatment effect (which is a linear regression coefficient) within each terminal region of the tree, rather than the mean response within each region.

One of the goals of Loh et al. (2019) is to construct valid post-selection confidence intervals for the treatment effect within each terminal node. In this appendix, we show that their approach, when adapted to the setting of this paper, does not yield confidence intervals with nominal coverage.

The basic idea of Loh et al. (2019), instantiated to our setting, is as follows. Suppose that RA∈TREEλ⁡(y), and define the vector νreg such that νregi=1xi∈RA/∑i′=1n1xi′∈RA, as in (14). We know that the “naive” Z-interval does not achieve nominal coverage, meaning that

Pr⁡νreg⊤μ∈νreg⊤y-zα/2σ∑i=1n1xi∈RA,νreg⊤y+zα/2σ∑i=1n1xi∈RA<1-α. (24)

This is because the “multiplier” for the naive confidence interval, zα/2, is derived under the assumption that the region RA (or, equivalently, the vector νreg), is fixed, rather than a function of the data.

Loh et al. (2019) observe that there exists some α′<α such that

Pr⁡νreg⊤μ∈νreg⊤y-zα′/2σ∑i=1n1xi∈RA,νreg⊤y+zα′/2σ∑i=1n1xi∈RA=1-α. (25)

The value for α′ for a given tree will depend on the number of split covariates p, the number of data points n, the depth of the tree, and the value of λ used for tree pruning, among other considerations. If we know how the data was generated, then we can check whether some value α′ satisfies (25) as follows:

  1. Draw B different simulated datasets Xb,ybb=1B from the same distribution (call this F) as the original data. For b=1,…,B:
    1. Build a tree using the simulated data Xb,yb, using the same procedure and the same settings as in Step 1, and denote it TREEλ⁡yb.
    2. For each terminal region R∈TERM⁡TREEλ⁡yb,Rp in the tree:
      1. Construct a 1-α′ naive Z-interval for the mean response in the region using Xb,yb.
      2. Check if each interval contains μ‾R, the true mean for this region R.
  2. Compute the fraction of intervals in 1(b) that contain μ‾R.

  3. If this value is 1-α, then we have found the correct value of α′. If not, then we try a larger or smaller value of α′.

We test this procedure in a very simple simulation study. We generate data Xij~ N(0,1) and yi~N(0,1) for i=1,…,100 and j=1,…,p. In this simple setting, the true mean response for every region in every fitted tree is 0. We carry out the procedure outlined above with α=0.1. For two values of p and for CART trees with 1, 2, and 3 levels, we create 1000 datasets and 1000 trees and report the empirical coverage of the intervals obtained using this ideal method, averaged over all nodes in all trees. The results, shown in Table 4, show that this ideal procedure procedure leads to intervals that achieve nominal coverage.

Table 4:

Coverage of 90% confidence intervals computed using three methods for the simple setting where yi~N(0,1) and Xij~N(0,1) for for i=1,…,100 and j=1,…,p. Note that the “Loh (ideal)” method can never be used in practice, as it requires knowledge of the true parameter.

Loh (ideal) Loh (bootstrap) Selective CIs
p Tree depth Coverage Average α′ Coverage Average α′ Coverage
2 1 0.902 0.008 0.749 0.037 0.890
2 0.905 0.004 0.695 0.038 0.904
3 0.900 0.005 0.660 0.047 0.895
20 1 0.883 0.001 0.601 0.016 0.908
2 0.900 0.00025 0.549 0.016 0.901
3 0.904 0.00015 0.543 0.022 0.905

Unfortunately, this ideal procedure is practically infeasible, as it requires the user to know the true distribution of the data F. Thus, in practice, Loh et al. (2019) propose replacing F by Fˆ, the empirical distribution of the original data. This amounts to replacing the simulated datasets in Step 2 with bootstrapped datasets, and checking whether the naive Z-intervals in Step 1(b) contain y‾R rather than μ‾R.

We can see why this is problematic in a very simple setting where we fit a tree with depth 1. If all observations have mean 0, then a CART tree fit to a bootstrap sample of the data will nevertheless find regions RL and RR such that the sample mean value of yb within RL is negative and the sample mean value of yb within RR is positive. As yb and y contain many overlapping observations, it is likely that the sample mean value of y within RL is also negative and the sample mean value of y within RR is also positive. In other words, because of the overlap between y and yb, the within-region sample means of yb are closer to the within-region sample means of y than they are to the within-region population means. Thus, when we calibrate α′ to cover the mean values of y within various regions, we end up with under-coverage of the true population mean, as shown in Table 4.

We see in Table 4 that our selective inference framework approach enables valid inference in this setting, whereas a bootstrap procedure modeled after Loh et al. (2019) does not.

Appendix B. Proofs for Section 3

B.1. Proof of Theorem 6

Let 0≤α≤1. We start by proving the first statement in Theorem 6 :

prH0⁡psib Y≤α∣RA,RB are siblings in TREEλ⁡Y=α.

This is a special case of Proposition 3 from Fithian et al. (2014). It follows from the definition of psib(Y) in (8) that

prH0⁡psibY≤α∣RA,RB are siblings in TREEλ⁡Y,𝒫νsib⊥Y=𝒫νsib⊥y=α.

Therefore, applying the law of total expectation yields

prH0⁡psib(Y)≤α∣RA,RB siblings in TREEλ⁡(Y) =EH01psib(Y)<α∣RA,RB are siblings in TREEλ⁡(Y) =EH0EH01psib(Y)<α∣RA,RB are siblings in TREEλ⁡(Y),𝒫νsib⊥Y=𝒫νsib⊥y∣RA,RB are siblings in TREEλ⁡(Y) =EH0α∣RA,RB are siblings in TREEλ⁡(Y)=α.

The second statement of Theorem 6 follows directly from the following result.

Lemma 20 If Y~Nnμ,σ2In, then the random variable νsib TY has the following conditional distribution:

νsibTY∣RA,RB are siblings in TREEλ⁡(Y),𝒫νsib⊥Y=𝒫νsib⊥y~𝒯𝒩νsibTμ,σ2νsib22;Ssibλνsib, (26)

where Ssib λνsib  is defined in (10) and 𝒯𝒩(μ,σ,S) denotes the Nμ,σ2 distribution truncated to the set S.

Proof The following holds for any ν∈Rn.

pr⁡νTY>c∣RA,RB are siblings in TREEλ⁡(Y),𝒫ν⊥Y=𝒫ν⊥y =prνTY>c∣RA,RB are siblings in TREEλ⁡𝒫ν⊥Y+ννT∥ν∥22Y,𝒫ν⊥Y=𝒫ν⊥y =prνTY>c∣RA,RB are siblings in TREEλ⁡𝒫ν⊥y+ν∥ν∥22νTY,𝒫ν⊥Y=𝒫ν⊥y =prνTY>c∣RA,RB are siblings in TREEλ⁡𝒫ν⊥y+ν∥ν∥22νTY =prϕ>c∣ϕ∈Ssibλ(ν),

where ϕ=νTY. In the fourth line, the condition 𝒫ν⊥Y=𝒫ν⊥y can be dropped because when Y~Nnμ,σ2In,𝒫ν⊥Y is independent of ν⊤Y. Finally, since ϕ~NνTμ,σ2∥ν∥22,(26) holds. ■

B.2. Proof of Proposition 7

Theorem 6.1 from Lee et al. (2016) says that the truncated normal distribution has monotone likelihood ratio in the mean parameter. This guarantees that L(y) and U(y) in (13) are unique. Then, for L(⋅) and U(⋅) in (13), (26) in Lemma 20 guarantees that

pr⁡νTμ∈[L(Y),U(Y)]∣RA,RB are siblings in TREEλ⁡(Y),𝒫ν⊥Y=𝒫ν⊥y=1-α. (27)

Finally, we need to prove that (27) implies (1-α)-selective coverage as defined in (12). Following Proposition 3 from Fithian et al. (2014), let η be the random variable 𝒫ν⊥Y and let f(⋅) be its density. Then,

pr⁡νTμ∈[L(Y),U(Y)]∣RA,RB are siblings in TREEλ⁡(Y) =∫ prνTμ∈[L(Y),U(Y)]∣RA,RB are siblings in TREEλ⁡(Y),𝒫ν⊥Y=𝒫ν⊥yf(η)dη =∫ (1-α)f(η)dη=1-α.

B.3. Proof of Theorem 8

We omit the proof of the first statement of Theorem 8, as it is similar to the proof of the first statement of Theorem 6 in Appendix B.1.

The second statement in Theorem 8 follows directly from the following result.

Lemma 21 The random variable νregTY has the conditional distribution

νregTY∣RA∈TREEλ⁡(Y),𝒫νreg⊥Y=𝒫νreg⊥y~𝒯𝒩νregTμ,σ2νreg22;Sregλνreg, (28)

where Sreg λνreg was defined in (16).

We omit the proof of Lemma 21, as it is similar to the proof of Lemma 20.

B.4. Proof of Proposition 9

The proof largely follows the proof of Proposition 7. The fact that the truncated normal distribution has monotone likelihood ratio (Theorem 6.1 of Lee et al. 2016) ensures that L(y) and U(y) defined in (17) are unique, and (28) in Lemma 21 implies that

prνregTμ∈[L(Y),U(Y)]∣RA∈TREEλ⁡(Y),𝒫νreg⊥Y=𝒫νreg⊥y=1-α.

The rest of the argument is as in the proof of Proposition 7.

Appendix C. Proofs for Section 4.1

C.1. Proof of Lemma 11

We first state and prove the following lemma.

Lemma 22 Let RA and RB be the regions in the definition of νsib  in (6). For an arbitrary region R and for any j∈{1,…,p} and s∈{1,…,n-1}, recall that the potential children of R (the ones that CART will consider adding to the tree when applying Algorithm A1 to region R) are given by R∩χj,s,0 and R∩χj,s,1, where χj,s,0 and χj,s,l were defined in (1). If RA∪RB⊆R∩χj,s,0 or RA∪RB⊆R∩χj,s,1, then GainR⁡y′ϕ,νsib,j,s=GainR{y,j,s} for all ϕ.

Proof It follows from algebra that for GainR⁡(y,j,s) defined in (2),

GainR⁡(y,j,s)=-∑i=1n1xi∈Ry‾R2+∑i=1n1xi∈R∩χj,s,0y‾R∩χj,s,02+∑i=1n1xi∈R∩χj,s,1y‾R∩χj,s,12, (29)

where y‾R=∑i∈Ryi/∑i=1n1xi∈R. It follows from (29) that to prove Lemma 22, it suffices to show that y‾T=y′(ϕ,νsib)¯T for T∈R,R∩χj,s,0,R∩χj,s,1. Recall from Section 3.3 that y′ϕ,νsibi=yi+Δi, where

Δi=ϕ-νsibTy∑i′=1n1xi′∈RB∑i′=1n1xi′∈RA∪RB if i∈RA-ϕ-νsibTy∑i′=1n1xi′∈RA∑i′=1n1xi′∈RA∪RB if i∈RB0 otherwise. 

Without loss of generality, assume that RA∪RB⊆R∩χj,s,0. For any T∈R,R∩χj,s,0, RA∪RB⊆T. Thus,

y′(ϕ,νsib)¯T=1∑i=1n1(xi∈T){∑i∈T∖(RA∪RB)yi+∑i∈RA(yi+Δi)+∑i∈RB(yi+Δi)}=y¯T+∑i∈RAΔi+∑i∈RBΔi∑i=1n1(xi∈T)=y¯T+{∑i=1n1(xi∈RA)}(ϕ−νsibTy)∑i=1n1(xi∈RB)∑i=1n1(xi∈RA∪RB)−{∑i=1n1(xi∈RB)}(ϕ−νsibTy)∑i=1n1(xi∈RA)∑i=1n1(xi∈RA∪RB)∑i=1n1(xi∈T)=y¯T+0=y¯T.

Furthermore,

y′(ϕ,νsib)¯R∩χj,s,1=1∑i=1n1xi∈R∩χj,s,1∑i∈R∩χj,s,1yi+Δi=1∑i=1n1xi∈R∩χj,s,1∑i∈R∩χj,s,1yi+0=y‾R∩χj,s,1.

■

We will now prove Lemma 11.

It follows from Definition 10 that if ℛBRANCH⁡R,TREEλ⁡(y)⊆TREEλ⁡y′ϕ,νsib, then RA and RB are siblings in TREEλ⁡y′ϕ,νsib. This establishes the (⇐) direction.

We will prove the (⇒) direction by contradiction. Suppose that RA and RB are siblings in TREEλ⁡y′ϕ,νsib. Define BRANCH RA,TREEλ⁡(y)=j1,s1,e1,…,jL,sL,eL, and define Rl′=⋂l=1l′χjl,sl,el for l′=1,…,L. Assume that there exists l∈{0,…,L-2} such that R(l)∈TREEλ⁡y′ϕ,νsib  and R(l+1)∉TREEλ⁡y′ϕ,νsib . We assume that any ties between splits that occur at Step 2 of Algorithm A1 are broken in the same way for y and y′ϕ,νsib, and so this implies that there exists (j˜,s˜)≠jl+1,sl+1 such that (j˜,s˜)∈arg⁡maxj,sGainR(l)y′ϕ,νsib,j,s and

GainR(l)⁡y′ϕ,νsib,jl+1,sl+1<GainR(l)⁡y′ϕ,νsib,j˜,s˜. (30)

Since RA and RB are siblings in TREEλ⁡y′ϕ,νsib, it follows from Lemma 22 that GainR(l)⁡y′ϕ,νsib,j˜,s˜=GainR(l)⁡(y,j˜,s˜). Also, since RA and RB are siblings in TREEλ⁡(y), it follows from Lemma 22 that GainR(l)⁡y′ϕ,νsib,jl+1,sl+1=GainR(l)⁡y,jl+1,sl+1. Applying these facts to (30) yields

GainR(l)⁡y,jl+1,sl+1<GainR(l)⁡(y,j˜,s˜). (31)

But since R(l) and R(l+1) both appeared in TREEλ⁡(y),

jl+1,sl+1∈arg⁡maxj,s GainR(l)⁡(y,j,s).

This contradicts (31). Therefore, for any l∈{0,…,L-2}, if R(l)∈TREEλ⁡y′ϕ,νsib, then R(l+1)∈TREEλ⁡y′ϕ,νsib. Since R(0)∈TREEλ⁡y′ϕ,νsib, the proof follows by induction.

C.2. Proof of Lemma 13

Let RA∈TREEλ⁡(y) with BRANCHRA,TREEλ⁡(y)=j1,s1,e1,…,jL,sL,eL such that RA=⋂l=1Lχjl,sl,el. Since Algorithm A1 creates regions by intersecting halfspaces and set intersections are invariant to the order of intersection, it follows that RA=⋂l=1Lχjl,sl,el∈TREEλ⁡y′ϕ,νreg if and only if there exists π∈Π such that

⋂l=1l′χjπ(l),sπ(l),eπ(l)l′=1L⊆TREEλ⁡y′ϕ,νreg.

By Definitions 10 and 12,

ℛπBRANCH⁡RA,TREEλ⁡(y)=⋂l=1l′χjπ(l),sπ(l),eπ(l)l′=1L.

Thus,

Sregλ =ϕ:RA∈TREEλ⁡y′ϕ,νreg =⋃π∈Πϕ:ℛπBRANCH⁡RA,TREEλ⁡(y)⊆TREEλ⁡y′ϕ,νreg =⋃π∈ΠSλπBRANCH⁡RA,TREEλ⁡(y),νreg,

where the third equality follows from the definition of Sλ(ℬ,ν) in (18).

Appendix D. Proofs for Section 4.2

D.1. Proof of Proposition 14

Recall that ℬ=j1,s1,e1,…,jL,sL,eL and ℛ(ℬ)=R(0),…,R(L). Recall from (20) that Sgrow (ℬ,ν)=ϕ:ℛ(ℬ)⊆TREE0⁡y′(ϕ,ν), and that we define Sl,j,s={ϕ:GAINR(l-1)⁡y′(ϕ,ν),j,s≤GAINR(l-1)⁡y′(ϕ,ν),jl,sl.

For l=1,…,L,

R(l-1)∈TREE0⁡y′(ϕ,ν) and ϕ∈∩s=1n-1∩j=1pSl,j,s⟺R(l-1),R(l)⊆TREE0⁡y′(ϕ,ν), (32)

because, given that R(l-1)∈TREE0⁡y′(ϕ,ν),R(l)∈TREE0⁡y′(ϕ,ν) if and only if jl,sl∈arg⁡max(j,s):s∈{1,…,n-1},j∈{1,…,p}GAINR(l-1)⁡y′(ϕ,ν),j,s. Combining (32) with the fact that ϕ:R(0)∈TREE0⁡y′(ϕ,ν)=R yields

⋂l=1L⋂j=1p⋂s=1n-1Sl,j,s=⋂l=1Lϕ:R(l-1),R(l)⊆TREE0⁡y′(ϕ,ν)=ϕ:ℛ(ℬ)⊆TREE0⁡y′(ϕ,ν).

D.2. Proof of Proposition 15

Given a region R, let 1(R) denote the vector in Rn such that the ith element is 1xi∈R. Let 𝒫1(R)=1(R)1(R)T1(R)-11(R)T denote the orthogonal projection matrix onto the vector 1(R).

Lemma 23 For any region R, GAINR⁡(y,j,s)=yTMR,j,sy, where

MR,j,s=𝒫1R∩χj,s,1+𝒫1R∩χj,s,0-𝒫1(R). (33)

Furthermore, the matrix MR,j,s is positive semidefinite.

Proof For any region R,∑i∈Ryi-y‾R2=∑i∈Ryi2-yT𝒫1(R)y. Thus, from (2),

GAINR⁡(y,j,s) =∑i∈Ryi-y‾R2-∑i∈R∩χj,s,1yi-y‾R∩χj,s,12-∑i∈R∩χj,s,0yi-y‾R∩χj,s,02 =∑i∈Ryi2-yT𝒫1(R)y-∑i∈R∩χj,s,1yi2+yT𝒫1R∩χj,s,1y-∑i∈R∩χj,s,0yi2+yT𝒫1R∩χj,s,0y =yT𝒫1R∩χj,s,1+𝒫1R∩χj,s,0-𝒫1(R)y=yTMR,j,sy.

To see that MR,j,s is positive semidefinite, observe that, for any vector v,

vTMR,j,sv=GAINR⁡(v,j,s) =∑i∈Rvi-v‾R2-mina1,a2∑i∈R∩χj,s,1vi-a12+∑i∈R∩χj,s,0vi-a22 ≥∑i∈Rvi-v‾R2-∑i∈R∩χj,s,1vi-v‾R2+∑i∈R∩χj,s,0vi-v‾R2=0.

■

It follows from Lemma 23 that we can express each set Sl,j,s from Proposition 14 as

Sl,j,s =ϕ:GAINR(l-1)⁡y′(ϕ,ν),j,s≤GAINR(l-1)⁡y′(ϕ,ν),jl,sl =ϕ:y′(ϕ,ν)TMR(l-1),j,sy′(ϕ,ν)≤y′(ϕ,ν)TMR(l-1),jl,sly′(ϕ,ν). (34)

We now use (34) to prove the first statement of Proposition 15.

Lemma 24 Each set Sl,j,s is defined by a quadratic inequality in ϕ.

Proof The definition of y′(ϕ,ν) in (10) implies that

y′(ϕ,ν)TMR,j,sy′(ϕ,ν) =𝒫ν⊥y+νϕ∥ν∥22TMR,j,s𝒫ν⊥y+νϕ∥ν∥22 =νTMR,j,sν∥ν∥24ϕ2+2νTMR,j,s𝒫ν⊥y∥ν∥22ϕ+yTPν⊥MR,j,sPν⊥y ≡a(R,j,s)ϕ2+b(R,j,s)ϕ+c(R,j,s). (35)

Therefore, by (34),

Sl,j,s={ϕ:aR(l-1),j,s-aR(l-1),jl,slϕ2+bR(l-1),j,s-bR(l-1),jl,slϕ+cR(l-1),j,s-cR(l-1),jl,sl≤0. (36)

■

Proposition 14 indicates that to compute Sgrow(ℬ,ν) from (20), we need to compute the coefficients of the quadratic for each Sl,j,s, where l=1,…,L,j=1,…,p, and s=1,…,n-1.

Lemma 25 We can compute the coefficients a R(l-1),j,s,bR(l-1),j,s and cR(l-1),j,s, defined in Lemma 24, for l=1,…,L,j=1,…,p, and s=1,…,n-1, in O{nplog⁡(n)+npL} operations.

Proof Using the definitions in Lemmas 23 and 24 and algebra, we have that

∥ν∥24aR(l-1),j,s=νT1R(l-1)∩χj,s,12∑i=1n1i∈R(l-1)∩χj,s,1+νT1R(l-1)∩χj,s,02∑i=1n1i∈R(l-1)∩χj,s,0-νT1R(l-1)2∑i=1n1i∈R(l-1), (37)
12∥ν∥22bR(l-1),j,s=νT1R(l-1)∩χj,s,1𝒫ν⊥yT1R(l-1)∩χj,s,1∑i=1n1i∈R(l-1)∩χj,s,1+νT1R(l-1)∩χj,s,0𝒫ν⊥yT1R(l-1)∩χj,s,0∑i=1n1i∈R(l-1)∩χj,s,0-νT1R(l-1)𝒫ν⊥yT1R(l-1)∑i=1n1i∈R(l-1), (38)
cR(l-1),j,s=𝒫ν⊥yT1R(l-1)∩χj,s,12∑i=1n1i∈R(l-1)∩χj,s,1+𝒫ν⊥yT1R(l-1)∩χj,s,02∑i=1n1i∈R(l-1)∩χj,s,0-𝒫ν⊥yT1R(l-1)2∑i=1n1i∈R(l-1). (39)

We compute the scalar ∥ν∥22 and the vector 𝒫ν⊥y in O(n) operations once at the start of the algorithm. We also sort each feature in O[nlog⁡(n)] operations per feature. We will now show that for the lth level and the jth feature, we can compute aR(l-1),j,s,bR(l-1),j,s, and cR(l-1),j,s for all n-1 values of s in O(n) operations.

The index s appears in (37)–(39) only through ∑i=1n1i∈R(l-1)∩χj,s,1,∑i=1n1i∈R(l-1)∩χj,s,0, and through inner products of vectors ν and 𝒫ν⊥y with indicator vectors 1R(l-1)∩χj,s,1 and 1R(l-1)∩χj,s,0. For simplicity, we assume that covariate xj is continuous, and thus the order statistics are unique.

Let m1 be the index corresponding to the smallest value of xj. Then νT1R(l-1)∩χj,1,1=νm1 if observation m1 is in R(l-1), and is 0 otherwise. Similarly, ∑i=1n1i∈R(l-1)∩χj,1,1=1 if observation m1 is in R(l-1), and is 0 otherwise. Next, let m2 be the index corresponding to the second smallest value of xj. Then νT1R(l-1)∩χj,2,1=1R(l-1)∩χj,1,1+νm2 if observation m2 is in R(l-1), and is equal to 1R(l-1)∩χj,1,1 otherwise. We compute ∑i=1n1i∈R(l-1)∩χj,2,1 in the same manner. Each update is done in constant time. Continuing in this manner, computing the full set of n-1 quantities νT1R(l-1)∩χj,s,1 and ∑i=1n1i∈R(l-1)∩χj,s,1 for s=1,…,n-1 requires a single forward pass through the sorted values of xj, which takes O(n) operations. The same ideas can be applied to compute 𝒫ν⊥yT1R(l-1)∩χj,1,1,νT1R(l-1)∩χj,s,0, 𝒫ν⊥yT1R(l-1)∩χj,s,0, and ∑i=1n1i∈R(l-1)∩χj,s,0 using constant time updates for each value of s.

Thus, we can obtain all components of coefficients aR(l-1),j,s,bR(l-1),j,s, and cR(l-1),j,s for a fixed j and l, and for all s=1,…,n-1, in O(n) operations. These scalar components can be combined to obtain the coefficients in O(n) operations. Therefore, given the sorted features, we compute the (n-1)pL coefficients in O(npL) operations. ■

Once the coefficients on the right hand side of (36) have been computed, we can compute Sl,j,s in constant time via the quadratic equation: it is either a single interval or the union of two intervals. Finally, in general we can intersect (n-1)pL intervals in O{npL×log⁡(npL)} operations (Bourgon, 2009). The final claim of Proposition 15 involves the special case where ν=νsib  and ℬ=BRANCH⁡RA,TREEλ⁡(y).

Lemma 26 Suppose that ν=νsib from (6) and ℬ=BRANCH⁡RA,TREEλ⁡(y). (i) If l<L, then for all j and s, there exist a,b∈[-∞,∞] such that a≤νTy≤b and Sl,j,s=(a,b). (ii) If l=L, then for all j and s, there exist c,d∈R such that c≤0≤d and Sl,j,s=(-∞,c]∪[d,∞). (iii) We can intersect all (n-1)pL sets of the form Sl,j,s in O(npL) operations.

Proof This proof relies on the form of Sl,j,s given in (36). To prove (i), note that when l<L,

νsib24aR(l-1),j,s-aR(l-1),jl,sl =νsibTMR(l-1),j,sνsib-νsibTMR(l-1),jl,slνsib =νsibTMR(l-1),j,sνsib≥0.

The first equality follows directly from the definition of a(R,j,s) in (35). To see why the second equality holds, observe that RA∪RB⊆R(l-1), and without loss of generality assume that RA∪RB⊆R(l-1)∩χjl,sl,1. Recall that the ith element of νsib is non-zero if and only if i∈RA∪RB, and that the non-zero elements of νsib sum to 0. Thus, 1R(l-1)Tνsib=0 and 1R(l-1)∩χjl,sl,1Tνsib=0. Furthermore, the supports of R(l-1)∩χjl,sl,0 and νsib are non-overlapping, and so 1R(l-1)∩χjl,sl,0Tνsib=0. Thus,

MR(l-1),jl,slνsib=𝒫1R(l-1)∩χjl,sl,1+𝒫1R(l-1)∩χjl,sl,0-𝒫1R(l-1)νsib=0.

The final inequality follows because MR(l-1),j,s is positive semidefinite (Lemma 23).

Thus, when l<L,Sl,j,s is defined in (36) by a quadratic inequality with a non-negative quadratic coefficient. Thus, Sl,j,s must be a single interval of the form (a,b). Furthermore, since ℬ=BRANCH⁡RA,TREEλ⁡(y), we know that ℛ(ℬ)⊆TREE0⁡(y)=TREE0⁡y′νTy,ν. Therefore, νTy∈Sgrowℬ,νsib=∩l=1L∩j=1p∩s=1n-1Sl,j,s, and so we conclude a≤νTy≤b. This completes the proof of (i).

To prove (ii), we first prove that when l=L the quadratic equation in ϕ defined in (36) has a non-positive quadratic coefficient. To see this, note that

νsib24aR(L-1),j,s-aR(L-1),jL,sL=νsibTMR(L-1),j,sνsib-νsibTMR(L-1),jL,sLνsib =νsibT𝒫1R(L-1)∩χj,s,1+𝒫1R(L-1)∩χj,s,0νsib-νsibT𝒫1R(L-1)∩χjL,sL,1+𝒫1R(L-1)∩χjL,sL,0νsib =νsibT𝒫1R(L-1)∩χj,s,1+𝒫1R(L-1)∩χj,s,0νsib-νsibTνsib =𝒫1R(L-1)∩χj,s,1+𝒫1R(L-1)∩χj,s,0νsib22-νsib22≤0. (40)

The first equality follows from (35). The second follows from the definition of MR,j,s given in (33) and from the fact that 𝒫1R(L-1)νsib =0 because 1R(L-1)Tνsib  sums up all of the non-zero elements of νsib, which sum to 0. The third equality follows because νsib  lies in span⁡1R(L-1)∩χjL,sL,1,1R(L-1)∩χjL,sL,0; projecting it onto this span yields itself. Noting that 𝒫1R(L-1)∩χj,s,1+𝒫1R(L-1)∩χj,s,0 is itself a projection matrix, the fourth equality follows from the idempotence of projection matrices, and the inequality follows from the fact that νsib2≥Qνsib 2 for any projection matrix Q. Thus, when l=L, the quadratic that defines Sl,j,s has a non-positive quadratic coefficient.

Equality is attained in (40) if and only if νsib∈span⁡1R(L-1)∩χj,s,1,1R(L-1)∩χj,s,0. This can only happen if splitting R(L-1) on j,s yields an identical partition of the data to splitting on jL,sL. If this is the case, then SL,j,s=(-∞,0]∪[0,∞) from the definition of Sl,j,s in Proposition 14, and so (ii) is satisfied with c=d=0.

We now proceed to the setting where the inequality in (40) is strict. In this case, (36) implies that SL,j,s=(-∞,c]∪[d,∞) for c≤d and c,d∈R. To complete the proof of (ii), we must argue that c≤0 and d≥0. Recall that the quadratic in (34) has the form GAINR(L-1)⁡y′(ϕ,ν),j,s-GAINR(L-1)⁡y′(ϕ,ν),jL,sL. When ϕ=0,GAINR(L-1)⁡y′(ϕ,ν),jL,sL=0, because ϕ=0 eliminates the contrast between RA and RB, so that the split on jL,sL provides zero gain. So, when ϕ=0, the quadratic evaluates to GAINR(L-1)⁡y′(ϕ,ν),j,s, which is non-negative by Lemma 23. Thus, Sl,j,s is defined by a downward facing quadratic that is non-negative when ϕ=0, and so the set Sl,j,s has the form (-∞,c]∪[d,∞) for c≤0≤d.

To prove (iii), observe that (i) implies that ∩l=1L-1∩j=1p∩s=1n-1Sl,j,s=amax,bmin, where amax is the maximum over all of the a’s, and bmin is the minimum over all of the b’s. This can be computed in np(L-1) steps. Furthermore, (ii) implies that ∩j=1p∩s=1n-1SL,j,s=-∞,cmin∩dmax,∞, where cmin and dmax are the minimum over all of the c’s and the maximum over all the d’s, respectively. This can be computed in np steps. Thus, we can compute ∩l=1L∩j=1p∩s=1n-1Sl,j,s in O(npL) operations. ■

D.3. Proof of Proposition 16

To prove Proposition 16, we first propose a particular method of constructing an example of TREE⁡(ℬ,ν,λ). We then show that (21) holds for this particular choice for TREE⁡(ℬ,ν,λ). We conclude by evaluating the computational cost of computing such an example of TREE(ℬ,ν,λ), and by arguing that in the special case where ℛ(ℬ)∈TREEλ⁡(y), our example is equal to TREEλ⁡(y).

When Algorithm A2 is called with parameters , TREE,y,λ,𝒪, where 𝒪 is a bottom-up ordering of the K nodes in TREE, it computes a sequence of intermediate trees, TREE0,…,TREEK. We use the notation TREEk(TREE,y,λ,𝒪, for k=0,…,K, to denote the kth of these intermediate trees. The following lemma helps build up to our proposed example of TREE⁡(ℬ,ν,λ).

Lemma 27 Let ϕ1∈Sgrow (ℬ,ν) and ϕ2∈Sgrow (ℬ,ν). Then TREE0⁡y′ϕ1,ν=TREE0⁡y′ϕ2,ν. Let 𝒪 be a bottom-up ordering of the K regions in TREE0⁡y′ϕ1,ν such that the last L regions in the ordering are R(L-1),…,R(0). Then TREEK-L⁡TREE0⁡y′ϕ1,ν,y′ϕ1,ν,λ,𝒪=TREEK-L⁡TREE0⁡y′ϕ2,ν,y′ϕ2,ν,λ,𝒪.

Proof We first prove that TREE0⁡y′ϕ1,ν⊆TREE0⁡y′ϕ2,ν, where ϕ1,ϕ2∈Sgrow (ℬ,ν). The fact that ϕ1∈Sgrow (ℬ,ν) and ϕ2∈Sgrow (ℬ,ν) implies two properties:

  • Property 1: R(l)∈TREE0⁡y′ϕ1,ν and R(l)∈TREE0⁡y′ϕ2,ν for l∈{0,…,L} by the definition of Sgrow (ℬ,ν).

  • Property 2: Rsib(l)∈TREE0⁡y′ϕ1,ν and Rsib(l)∈TREE0⁡y′ϕ2,ν for l∈{1,…,L}, where Rsib(l)≡R(l-1)∩χjl,sl,1-el. This follows from Property 1 and Definition 1.

Suppose that R∈TREE0⁡y′ϕ1,ν. Then R must belong to one of these three cases, illustrated in Figure 10(a):

  • Case 1: ∃l∈{0,…L} such that R=R(l). By Property 1, R∈TREE0⁡y′ϕ2,ν.

  • Case 2: ∃l∈{1,…,L} such that R=Rsib(l). By Property 2,R∈TREE0⁡y′ϕ2,ν.

  • Case 3: R∈DESC⁡R′,TREE0⁡y′ϕ1,ν, where either R′=Rsib (l) for some l∈{1,…,L}, or else R′=R(L). By Properties 1 and 2,R′∈TREE0⁡y′ϕ2,ν. Condition 1 ensures that, for all i∈R′ and for some constants c and d,
    y′ϕ2,νi=y′ϕ1,νi if R′=Rsib(l) for some l∈{1,…,L-1},y′ϕ1,νi+c if R′=Rsib(L),y′ϕ1,νi+d if R′=R(L).
    As constant shifts preserve within-node sums of squared errors, in each of these three scenarios, DESC⁡R′,TREE0⁡y′ϕ1,ν=DESC⁡R′,TREE0⁡y′ϕ2,ν. Thus, R∈ TREE0⁡y′ϕ2,ν.

Figure 10:

Figure 10:

(a). An illustration of Case 1 (red), Case 2 (blue), and Case 3 (black) for a region R∈TREE0⁡y′ϕ1,ν in the base case of the proof of Lemma 27, where ℛ(ℬ)=R(0),…,R(3). (b.) The black regions show the possible cases for R∈TREEk-1 in the inductive step of the proof of Lemma 27.

Thus, if R∈TREE0⁡y′ϕ1,ν, then R∈TREE0⁡y′ϕ2,ν. This completes the argument that TREE0⁡y′ϕ1,ν⊆TREE0⁡y′ϕ2,ν. Swapping the roles of ϕ1 and ϕ2 in this argument, we see that TREE0⁡y′ϕ2,ν⊆TREE0⁡y′ϕ1,ν. This concludes the proof that TREE0⁡y′ϕ1,ν=TREE0⁡y′ϕ2,ν.

Because TREE0⁡y′ϕ1,ν=TREE0⁡y′ϕ2,ν, it follows that any bottom-up ordering of the regions in TREE0⁡y′ϕ1,ν is also a bottom-up ordering for the regions in TREE0⁡y′ϕ2,ν. We next prove by induction that, if we choose a bottom-up ordering 𝒪 that places the regions in ℛ(ℬ) at the end of the ordering, then

TREEk⁡TREE0⁡y′ϕ1,ν,y′ϕ1,ν,λ,𝒪=TREEk⁡TREE0⁡y′ϕ2,ν,y′ϕ2,ν,λ,𝒪, (41)

for k=0,…,K-L. It follows immediately from Algorithm A2 and the argument above that TREE0⁡TREE0⁡y′ϕ1,ν,y′ϕ1,ν,λ,𝒪=TREE0⁡TREE0⁡y′ϕ2,ν,y′ϕ2,ν,λ,𝒪. Next, suppose that for some k∈{1,…,K-L},

TREEk-1⁡TREE0⁡y′ϕ1,ν,y′ϕ1,ν,λ,𝒪=TREEk-1⁡TREE0⁡y′ϕ2,ν,y′ϕ2,ν,λ,𝒪, (42)

and denote this tree with TREEk−1 for brevity. We must prove that (41) holds. Let R be the kth region in 𝒪 and recall the assumption that the last L regions in 𝒪 are R(L-1),…,R(0). Since k≤K-L, this implies that R∉R(L-1),…,R(0). This means that either R∈DESC⁡Rsib(l),TREE0⁡y′ϕ1,ν for l∈{1,…,L} or R∈DESC⁡R(L),TREE0⁡y′ϕ1,ν, meaning that R is a black region in Figure 10(b). From Condition 1,

y′ϕ2,νi=y′ϕ1,νi if R∈DESC⁡Rsib(l),TREE0⁡y′ϕ1,ν for l∈{1,…,L-1},y′ϕ1,νi+c if R∈DESC⁡Rsib(L),TREE0⁡y′ϕ1,ν,y′ϕ1,νi+d if R∈DESC⁡R(L),TREE0⁡y′ϕ1,ν.

In any of the three cases illustrated in Figure 10, for g(⋅) defined in (3), gR,TREEk-1,y′ϕ1,ν=gR,TREEk−1,y′ϕ2,ν. Combining this with (42) and Step 2(b) of Algorithm A2 yields (41). This completes the proof by induction.

■

Since Lemma 27 guarantees that each ϕ∈Sgrow(ℬ,ν) leads to the same TREE0⁡y′(ϕ,ν), we will refer to this tree as TREE0, will let K be the number of regions in this tree, and will let 𝒪 be a bottom-up ordering of these regions that places R(L-1),…,R(0) in the last L spots. We will further denote TREEK-L⁡TREE0,y′(ϕ,ν),λ,𝒪 for any ϕ∈Sgrow(ℬ,ν) as TREEK-L, since Lemma 27 further tells us that this is the same for all ϕ∈Sgrow(ℬ,ν). In what follows, we argue that if we let TREE⁡(ℬ,ν,λ)=TREEK-L, where TREE⁡(ℬ,ν,λ) appears in the statement of Proposition 16, then (21) holds. In other words, we prove that TREEK-L, which always exists and is well-defined, is a valid example of TREE⁡(ℬ,ν,λ).

Recall from (18) that Sλ(ℬ,ν)=ϕ∈Sgrow(ℬ,ν):R(L)∈TREEλ⁡y′(ϕ,ν). Lemma 27 says that for ϕ∈Sgrow(ℬ,ν), we can rewrite TREEλ⁡y′(ϕ,ν) as TREEK⁡TREE0,y′(ϕ,ν),λ,𝒪. So we can rewrite Sλ(ℬ,ν) as

Sλℬ,ν=ϕ∈Sgrowℬ,ν:RL∈TREEK⁡TREE0,y′ϕ,ν,λ,𝒪. (43)

Furthermore, since R(L-1),…,R(0) (all of which are ancestors of R(L)) are the last L nodes in the ordering 𝒪, we see that R(L)∈TREEK⁡TREE0,y′(ϕ,ν),λ,𝒪 if and only if no pruning occurs during the last L iterations of Step 2 in Algorithm A2. This means that we can characterize (43) as

ϕ∈Sgrow(ℬ,ν):TREEK-L⁡TREE0,y′(ϕ,ν),λ,𝒪=TREEK⁡TREE0,y′(ϕ,ν),λ,𝒪. (44)

Recall that for k=K-L+1,…,K,R(K-k) is the kth region in 𝒪, and is an ancestor of R(L). We next argue that we can rewrite (44) as

⋂k=K-L+1Kϕ∈Sgrow (ℬ,ν):gR(K-k),TREEK-L,y′(ϕ,ν)≥λ. (45)

To begin, suppose that ϕ∈(45). As we are talking about a particular ϕ, for k=0,…,K we will suppress the dependence of TREEk⁡TREE0,y′(ϕ,ν),λ,𝒪 on its arguments and denote it with TREEk. The fact that ϕ∈(45) means that gR(L-1),TREEK-L,y′(ϕ,ν)≥λ, which ensures that no pruning occurs at step K-L+1, which in turn ensures that TREEK-L+1=TREEK-L. Combined with (45), this implies that gR(L-2),TREEK-L,y′(ϕ,ν)=gR(L-2),TREEK-L+1,y′(ϕ,ν)≥λ, which ensures that no pruning occurs at step K-L+2, which in turn ensures that TREEK-L+2=TREEK-L+1=TREEK-L. Proceeding in this manner, by tracing through the last L iterations of Step 2 of Algorithm A2, we see that ϕ satisfies TREEK=TREEK-L, and so ϕ∈(44).

Next suppose that ϕ∉(45). Let

k′=mink∈{K-L+1,…,K}k:gR(K-k),TREEK-L,y′(ϕ,ν)<λ.

As k′ is a minimum, we know that no pruning occurred during steps K-L+1,…,k′-1, and so TREEk′-1⁡TREE0⁡y′(ϕ,ν),y′(ϕ,ν),λ,𝒪=TREEK-L. This implies that gRK-k′,TREEK-L,y′(ϕ,ν)<λ can be rewritten as gRK-k′,TREEk′-1⁡TREE0⁡y′(ϕ,ν),y′(ϕ,ν),λ,𝒪,y′(ϕ,ν)<λ. It then follows from Algorithm A2 that pruning occurs at step k′, which means that TREEK cannot possibly equal TREEK-L. Thus, ϕ∉(44).

Thus, ϕ∈(45) if and only if ϕ∈(44).

Finally, Proposition 16 rewrites (45) with the indexing over k changed to an indexing over l, and plugging in TREE⁡(ℬ,ν,λ)=TREEK-L. Therefore, TREEK-L is a valid example of TREE⁡(ℬ,ν,λ).

To compute TreE⁡(ℬ,ν,λ), we first select an arbitrary ϕ∈Sgrow(ℬ,ν). We then apply Algorithm A1 to grow TREE0⁡y′(ϕ,ν). We create a bottom-up ordering 𝒪 of the K nodes in TREE0⁡y′(ϕ,ν) such that R(L-1),…,R(0) are at the end. Finally, we apply the first K-L iterations of Algorithm A2 with arguments TREE0⁡y′(ϕ,ν),y′(ϕ,ν),λ, and 𝒪 to obtain TREE⁡(ℬ,ν,λ). The worst case computational cost of CART (the combined Algorithm A1 and Algorithm A2) is On2p.

In the special case that ℛ(ℬ)⊆TREEλ⁡(y), we have that νTy∈Sgrow(ℬ,ν) because y=y′νTy,ν and ℛ(ℬ)⊆TREEλ⁡(y)⊆TREE0⁡(y). In this case, suppose that we carry out the process described in the previous paragraph by selecting ϕ=νTy. As ℛ(ℬ)⊆TREEλ⁡(y), it is clear from Algorithm A2 that no pruning occurs during the last L iterations of Step 2 in Algorithm A2 applied to arguments TREE0⁡(y),y,λ, and 𝒪. Therefore, the process from the previous paragraph returns the optimally pruned TREEλ⁡(y). Thus, when ℛ(ℬ)⊆TREEλ⁡(y), we can simply plug in TREEλ⁡(y), which has already been built, for TREE⁡(ℬ,ν,λ) in (21).

D.4. Proof of Proposition 17

We first show that we can express

ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ (46)

as the solution set of a quadratic inequality in ϕ for l=0,…,L-1, where g(⋅) was defined in (3). Because only the numerator of gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν) depends on ϕ, it will be useful to introduce the following concise notation:

h(R, TREE ,y)≡∑i∈Ryi-y‾R2-∑r∈TERM⁡(R,TREE)∑i∈ryi-y‾r2. (47)

We begin with the following lemma.

Lemma 28 Suppose that region R in TREE has children R∩χj,s,0 and R∩χj,s,1. Then, h(R,TREE,y)=GAINR⁡(y,j,s)+hR∩χj,s,1,TREE,y+hR∩χj,s,0,TREE,y, where GAINR⁡(y,j,s) is defined in (2).

Proof The result follows from adding and subtracting ∑i∈R∩χj,s,1yi-y‾R∩χj,s,12 and ∑i∈R∩χj,s,0yi-y‾R∩χj,s,02 in (47) and noting that TERM⁡(R,TREE)=TERM⁡R∩χj,s,1,TREE∪TERM⁡R∩χj,s,0. ■

Recall that ℬ=j1,s1,e1,…,jL,sL,eL and that ℛ(ℬ)=R(0),R(1),…,R(L). Lemma 29 follows from Lemma 28 and the fact that, due to the form of the vector ν, there are many regions R for which hR,TREE⁡(ℬ,ν,λ),y′(ϕ,ν) does not depend on ϕ.

Lemma 29 For any ϕ˜∈Sgrow (ℬ,ν), we can decompose hR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν) as

hR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν) =∑l′=l+1LhRsib l′,TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) +hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) +∑l′=lL-1GAINRl′⁡y′(ϕ,ν),jl′+1,sl′+1,

where Rsib (l) is the sibling of R(l) in TREE⁡(ℬ,ν,λ).

Proof Repeatedly applying Lemma 28 yields

hR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν) =∑l′=l+1LhRsib l′,TREE⁡(ℬ,ν,λ),y′(ϕ,ν) +hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ,ν) +∑l′=lL-1GAINRl′⁡y′(ϕ,ν),jl′+1,sl′+1. (48)

For l′=l+1,…,L-1,hRsibl′,TREE⁡(ℬ,ν,λ),y′(ϕ,ν)=hRsibl′,TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) because Rsibl′ only contains observations where y′(ϕ,ν)i=y′(ϕ˜,ν)i. Similarly, hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)=hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) and hRsib(L),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)=hRsib(L),TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) because for i∈R(L) and i∈Rsib(L),y′(ϕ,ν)i and y′(ϕ˜,ν)i only differ by a constant shift. Plugging these two facts into (48) completes the proof. ■

We can now write (46) as

ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ =ϕ:hR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λTERM⁡R(l),TREE⁡(ℬ,ν,λ)-1 =ϕ:∑l′=lL-1GAINRl′⁡y′(ϕ,ν),jl′+1,sl′+1≥λTERM⁡R(l),TREE⁡(ℬ,ν,λ)-1- ∑l′=l+1LhRsibl′,TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν)-hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) =ϕ:∑l′=lL-1aRl′,jl′+1,sl′+1ϕ2+bRl′,jl′+1,sl′+1ϕ+cRl′,jl′+1,sl′+1≥γl, (49)

where the functions a(⋅),b(⋅), and c(⋅) were defined in (35) in Appendix D.2, and where

γl≡λTERM⁡R(l),TREE⁡(ℬ,ν,λ)-1-∑l′=l+1LhRsibl′,TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν)-hR(L),TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν)

is a constant that does not depend on ϕ. The first equality simply applies the definitions of h(⋅) and g(⋅). The second equality follows from Lemma 29 and moving terms that do not depend on ϕ to the right-hand-side. The third equality follows from plugging in notation from Appendix D.2 and defining the constant γl for convenience. Thus, (46) is quadratic inequality in ϕ. We now just need to argue that its coefficients can be obtained efficiently.

We need to compute the coefficients in (49) for l=0,…,L-1. The quantities aRl′,jl′,sl′+1,bRl′,jl′+1,sl′+1, and cRl′,jl′+1,sl′+1 for l′=0,…,L-1 were already computed while computing Sgrow(ℬ,ν). To get the coefficients for the left hand side of (49) for each l=0,…,L-1, we simply need to compute L partial sums of these quantities, which takes O(L) operations. As we are assuming that we have access to TrEE⁡(ℬ,ν,λ), computing hR,TREE⁡(ℬ,ν,λ),y′(ϕ˜,ν) requires O(n) operations. Therefore, computing γ0 takes O(nL) operations. By storing partial sums during the computation of γ0, we can subsequently obtain γl for l=1,…,L-1 in constant time.

We have now seen that we can obtain the coefficients needed to express (46) as a quadratic function of ϕ for l=0,…,L-1 in O(nL) total operations. Once we have these quantities, we can compute each set of the form (46) in constant time using the quadratic equation.

It remains to compute

Sλ(ℬ,ν)=Sgrow (ℬ,ν)⋂ ⋂l=0L-1ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ. (50)

Recall from Proposition 14 that Sgrow(ℬ,ν) is the intersection of O(npL) quadratic sets. Thus, in the worst case, Sgrow(ℬ,ν) has O(npL) disjoint components, and so this final intersection involves O(npL) components. Thus, we can compute Sλ(ℬ,ν) in O{npL×log⁡(npL)} operations (Bourgon, 2009).

The following lemma explains why, similar to Proposition 15, computation time can be reduced in the special case where ν=νsib  and ℬ=BRANCH⁡RA,TREEλ⁡(y).

Lemma 30 When ℬ=BRANCH⁡RA, TREEλ⁡(y), the set ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′ϕ,νsib ≥λ has the form -∞,al∪bl,∞, where al≤0≤ bl. Therefore, we can compute ⋂l=0L-1ϕ:gR(l),TREE⁡(ℬ,ν,λ),y′(ϕ,ν)≥λ as

⋂l=0L-1-∞,al∪bl,∞=-∞,min0≤l≤L-1al∪max0≤l≤L-1bl,∞

in O(L) operations. Furthermore, we can compute (50) in constant time.

Proof As ℛ(ℬ)⊆TREEλ⁡(y), we can let ϕ˜∈Sgrow(ℬ,ν) from Lemma 29 be νTy such that y′(ϕ˜,ν)=y. We can then apply Lemma 22 to note that

∑l′=lL-1GAINRl′⁡y′ϕ,νsib,jl′+1,sl′+1=∑l′=lL-2GAINRl′⁡y,jl′+1,sl′+1+GAINR(L-1)⁡y′ϕ,νsib,jL,sL.

Thus, when ν=νsib  and ℬ=BRANCH⁡RA,TREEλ⁡(y), we can rewrite (49) with all of the terms corresponding to GAINRl′⁡y′ϕ,νsib,jl′+1,sl′+1 for l′=l+1,…,L-2 moved into the constant on the right-hand-side. This lets us rewrite (49) as {ϕ:GainR(L-1)⁡y′ϕ,νsib,jL,sL≥γ˜l, where γ˜l is an updated constant that does not depend on ϕ.

To prove that ϕ:GainR(L-1)⁡jL,sL,y′ϕ,νsib≥γ˜l has the form -∞,al∪bl,∞ for al≤0≤bl, first recall from Lemma 23 that GainR(L-1)⁡jL,sL,y′ϕ,νsib is a quadratic function of ϕ. It then suffices to show that this quadratic has a non-negative second derivative and achieves its minimum when ϕ=0. The second derivative of this quadratic is aR(L-1),jL,sL=νsib2-4νsibTMR(L-1),jL,sLνsib, which is non-negative by Lemma 23. From Lemma 23, GainR(L-1)⁡jL,sL,y′ϕ,νsib is non-negative. It equals 0 when ϕ=0, because when ϕ=0 then y‾R(L-1)∩χjL,sL,1=y‾R(L-1)∩χjL,sL,0.

Intersecting L sets of the form -∞,al∪bl,∞ for al≤0≤bl only takes O(L) operations, because we simply need to identify the minimum al and maximum bl. Finally, Lemma 26 ensures that Sgrowℬ,νsib has at most two disjoint intervals, and so the final intersection with Sgrowℬ,νsib  takes only O(1) operations. ■

D.5. Proof of Proposition 18

Let ℬ=BRANCH⁡RA,TREEλ⁡(y), let ℛ(ℬ)=R(0),…,R(L), and let ν=νsib  (6). Applying the expression given for y′ϕ,νsibi in Section 3.3 (which follows from algebra), we immediately see that Condition 1 holds with RA=R(L) and RB=R(L-1)∩χjL,sL,1-eL.

Let ℬ=πBRANCH⁡RA,TREEλ⁡(y) and let ν=νreg (14). Note that πBRANCH⁡RA,TREEλ⁡(y) induces the same region R(L) as the unpermuted BRANCH⁡RA,TREEλ⁡(y). Regardless of the permutation, the induced R(L) is equal to RA. Applying the expression for y′ϕ,νregi given in Section 3.3, Condition 1 holds with constant c2=0.

Appendix E. Proofs for Section 4.3

E.1. Proof of Proposition 19

As stated in Proposition 19, let

preg Q(y)=prH0νreg TY-c≥νreg Ty-c∣⋃π∈QℛπBRANCH⁡RA,TREEλ⁡(y)⊆TREEλ⁡(Y),𝒫νreg ⊥Y=𝒫νreg ⊥y.

First, we will show that the test based on pregQ(y) controls the selective Type 1 error rate, defined in (4); this is a special case of Proposition 3 from Fithian et al. (2014).

Define ℰ1=Y:RA∈TREEλ⁡(Y),ℰ2=Y:𝒫νreg⊥Y=𝒫νreg⊥y, and ℰ3=Y:⋃π∈QℛπBRANCH⁡RA,TREEλ⁡(y)⊆TREEλ⁡(Y). Recall that the test of H0:νregTμ=c based on pregQ(y) controls the selective Type 1 error rate if, for all α∈[0,1],prH0⁡pregQ(Y)≤α∣ℰ1≤α. By construction,

prH0preg Q(Y)≤α∣ℰ2∩ℰ3=E1prH0νreg TY-c≥νreg Ty-c∣ℰ2∩ℰ3≤α∣ℰ2∩ℰ3=α.

Let ψRAQ=1prH0νregTY-c≥νregTy-c∣ℰ2∩ℰ3≤α. An argument similar to that of Lemma 13 indicates that ℰ3⊆ℰ1. The law of total expectation then yields

EψRAQ∣ℰ1=EEψRAQ∣ℰ1∩ℰ2∩ℰ3∣ℰ1=EEψRAQ∣ℰ2∩ℰ3∣ℰ1=Eα∣ℰ1=α.

Thus, the test based on pregQ(y) controls the selective Type 1 error rate. We omit the proof that pregQ(y) can be computed as

pregQ(y)=prH0|ϕ-c|≥νregTy-c∣ϕ∈⋃π∈QSλπBRANCH⁡RA,TREEλ⁡(y),νreg

for ϕ~Nc,νreg22σ2, as the proof is similar to the proof of Theorem 6.

Appendix F. Effect of Using the Computationally Efficient Alternative in Section 4.3

In this section, we investigate the effect of using pregℐ(y) from (22) rather than preg(y) from (15) on power. We also investigate the effect of using (23) rather than (17) on the width of confidence intervals for νregTμ.

We generate data as described in Section 5.1, but for simplicity we restrict our attention to the case where a=1 (corresponding to the center panel of Figure 3).

For each tree that we build, we consider (a) testing H0:νregTμ=0 and (b) constructing a confidence interval for νregTμ, for each region appearing at the third level of the tree. For each test, we compare the test that uses the full conditioning set (i.e. that uses preg (y) from (15)) to the test that uses the identity permutation only (i.e. that uses preg ℐ(y) from (22)). For each interval, we compare the method that uses the full conditioning set (i.e. (17)) to the method that uses the identity permutation only (i.e. (23)). The results are displayed in Figure 11.

Figure 11:

Figure 11:

Simulation results comparing inference based on the full conditioning set to inference based on the identity permutation only (see Section 4.3). The left panel shows power curves. The center panel zooms in on one section of the left panel. The right panel shows median widths of confidence intervals.

The left panel of Figure 11 shows that the power loss resulting from using (22) instead of (15) is negligible. In fact, we need to zoom in on the left panel, as shown in the center panel, to see any separation between the power curves. We see in the center panel that power is lower when (22) is used, though we emphasize that the differences in power are extremely small.

We see in the right panel of Figure 11 that the computationally efficient conditioning set has a more noticeable impact on the median width of our confidence intervals. As expected, the confidence intervals are narrower when we use the full conditioning set (i.e. (17)). However, this difference is most noticeable when b is small. When b is small, in which case the confidence intervals are wide even when the full conditioning set is used. Thus, the amount of precision lost overall by constructing confidence intervals using the identity permutation only (i.e. (23)) is not of practical importance.

Based on these results, we recommend using the identity permutation in practice, because it is the most computationally efficient choice and does not meaningfully reduce power or precision compared to the full conditioning set.

Appendix G. Robustness to Non-Normality

In this section, we explore the performance of the selective Z-test under a global null when the normality assumption on Y is violated. For four choices of cumulative distribution function F, we generate Yi~ i.i.d. F such that all observations have the same expected value. We set n=200,p=10, and we grow trees to a maximum depth of 3. We plug in (n-1)-1∑i=1nyi-y‾2 as an estimate of σ2, as it does not make sense to assume known variance for distributions with a mean-variance relationship. Figure 12 displays quantile-quantile plots of the p-values for testing H0:νsibTμ=0, using the test in (8).

Figure 12:

Figure 12:

Quantile-quantile plots of the p-values for testing H0:νsibTμ=0 under a global null. A naive Z-test (green), sample splitting (blue), and selective Z-test (pink) were performed; see Section 5.2.

Figure 12 shows that despite the fact that our proposed selective inference framework was derived under a normality assumption, it yields approximately uniformly distributed p-values for Poisson(10), Bernoulli(0.5), and Gamma(1,10) data. We suspect that this is because 𝒫ν⊥Y is approximately independent of νTY for these distributions (see the proof of Theorem 6 in Appendix B). In the case of Bernoulli(0.1) data, which represents a particularly extreme violation of the normality assumption, the p-values from our selective Z-test are not uniformly distributed. As mentioned in Section 7, future work could involve characterizing conditions for F under which our selective Z-tests will approximately control the selective Type 1 error.

Appendix H. Alternate Box Lunch Study Analysis

Figure 13 is the same as the left panel of Figure 9, but the selective Z-inference is carried out with σˆcons , from Section 5.7, rather than σˆSSE. The takeaways presented in Section 6 do not change.

Figure 13:

Figure 13:

A CART tree fit to the Box Lunch Study data. Each split has been labeled with a p-value (8), and each region has been labeled with a confidence interval (23). Inference is carried out by plugging in σˆcons , from Section 5.7, as an estimate of σ.

Contributor Information

Anna C. Neufeld, Department of Statistics, University of Washington, Seattle, WA 98195, USA

Lucy L. Gao, Department of Statistics, University of British Columbia, Vancouver, British Columbia, V6T 1Z4, Canada

Daniela M. Witten, Departments of Statistics and Biostatistics, University of Washington, Seattle, WA 98195, USA

References

  1. Athey Susan and Imbens Guido. Recursive partitioning for heterogeneous causal effects. Proceedings of the National Academy of Sciences, 113(27):7353–7360, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
  2. Bhattacharya PK. Some aspects of change-point analysis. Lecture Notes-Monograph Series, pages 28–56, 1994. [Google Scholar]
  3. Bourgon Richard. Overview of the intervals package, 2009. R Vignette, URL https://cran.r-project.org/web/packages/intervals/vignettes/intervals_overview.pdf.
  4. Breiman Leo, Friedman Jerome, Stone Charles J, and Olshen Richard A. Classification and regression trees. CRC Press, 1984. [Google Scholar]
  5. Chen Shuxiao and Bien Jacob. Valid inference corrected for outlier removal. Journal of Computational and Graphical Statistics, 29(2):323–334, 2020. [Google Scholar]
  6. Chen Yiqun T and Witten Daniela M. Selective inference for k-means clustering. arXiv preprint arXiv:2203.15267, 2022. [Google Scholar]
  7. Fithian William, Sun Dennis, and Taylor Jonathan. Optimal inference after model selection. arXiv preprint arXiv:1410.2597, 2014. [Google Scholar]
  8. Gao Lucy L, Bien Jacob, and Witten Daniela. Selective inference for hierarchical clustering. arXiv preprint arXiv:2012.02936, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
  9. Hothorn Torsten and Zeileis Achim. partykit: A modular toolkit for recursive partytioning in R. The Journal of Machine Learning Research, 16(1):3905–3909, 2015. [Google Scholar]
  10. Hothorn Torsten, Hornik Kurt, and Zeileis Achim. Unbiased recursive partitioning: A conditional inference framework. Journal of Computational and Graphical Statistics, 15 (3):651–674, 2006. [Google Scholar]
  11. Hubert Lawrence and Arabie Phipps. Comparing partitions. Journal of Classification, 2 (1):193–218, 1985. [Google Scholar]
  12. Hyun Sangwon, Lin Kevin Z, G'Sell Max, and Tibshirani Ryan J. Post-selection inference for changepoint detection algorithms with application to copy number variation data. Biometrics, pages 1–13, 2021. [DOI] [PubMed] [Google Scholar]
  13. Jewell Sean, Fearnhead Paul, and Witten Daniela. Testing for a change in mean after changepoint detection. Journal of the Royal Statistical Society, Series B, 2022. [DOI] [PMC free article] [PubMed] [Google Scholar]
  14. Kivaranovic Danijel and Leeb Hannes. On the length of post-model-selection confidence intervals conditional on polyhedral constraints. Journal of the American Statistical Association, 116(534):845–857, 2021. [Google Scholar]
  15. Lee Jason D, Sun Dennis L, Sun Yuekai, Taylor Jonathan E, et al. Exact post-selection inference, with application to the lasso. The Annals of Statistics, 44(3):907–927, 2016. [Google Scholar]
  16. Liu Keli, Markovic Jelena, and Tibshirani Robert. More powerful post-selection inference, with application to the lasso. arXiv preprint arXiv:1801.09037, 2018. [Google Scholar]
  17. Loh Wei-Yin. Fifty years of classification and regression trees. International Statistical Review, 82(3):329–348, 2014. [DOI] [PMC free article] [PubMed] [Google Scholar]
  18. Loh Wei-Yin, Fu Haoda, Man Michael, Champion Victoria, and Yu Menggang. Identification of subgroups with differential treatment effects for longitudinal and multiresponse variables. Statistics in Medicine, 35(26):4837–4855, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
  19. Loh Wei-Yin, Man Michael, and Wang Shuaicheng. Subgroups from regression trees with adjustment for prognostic effects and postselection inference. Statistics in Medicine, 38 (4):545–557, 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
  20. Ripley Brian D. Pattern recognition and neural networks. Cambridge University Press, 1996. [Google Scholar]
  21. Segal Mark Robert. Regression trees for censored data. Biometrics, 44(1):35–47, 1988. [Google Scholar]
  22. Taylor Jonathan and Tibshirani Robert J. Statistical learning and selective inference. Proceedings of the National Academy of Sciences, 112(25):7629–7634, 2015. [DOI] [PMC free article] [PubMed] [Google Scholar]
  23. Therneau Terry and Atkinson Beth. rpart: Recursive Partitioning and Regression Trees, 2019. R package version 4.1–15, available on CRAN. [Google Scholar]
  24. Tian Xiaoying and Taylor Jonathan. Asymptotics of selective inference. Scandinavian Journal of Statistics, 44(2):480–499, 2017. [Google Scholar]
  25. Tian Xiaoying and Taylor Jonathan. Selective inference with a randomized response. The Annals of Statistics, 46(2):679–710, 2018. [Google Scholar]
  26. Tibshirani Ryan J, Taylor Jonathan, Lockhart Richard, and Tibshirani Robert. Exact post-selection inference for sequential regression procedures. Journal of the American Statistical Association, 111(514):600–620, 2016. [Google Scholar]
  27. Tibshirani Ryan J, Rinaldo Alessandro, Tibshirani Rob, and Wasserman Larry. Uniform asymptotic inference and the bootstrap after model selection. The Annals of Statistics, 46(3):1255–1287, 2018. [Google Scholar]
  28. Venkatasubramaniam Ashwini and Wolfson Julian. visTree: Visualization of Subgroups for Decision Trees, 2018. R package version 0.8.1, available on CRAN. [Google Scholar]
  29. Venkatasubramaniam Ashwini, Wolfson Julian, Mitchell Nathan, Barnes Timothy, JaKa Meghan, and French Simone. Decision trees in epidemiological research. Emerging Themes in Epidemiology, 14(1):11, 2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
  30. Wager Stefan and Walther Guenther. Adaptive concentration of regression trees, with application to random forests. arXiv preprint arXiv:1503.06388, 2015. [Google Scholar]

RESOURCES