Generalized Random Forests - Local Moment Equations
Summary
Generalized random forests (Athey, Tibshirani & Wager 2019, Annals of Statistics) extend Breiman’s forests from conditional-mean estimation to any parameter identified by a local moment condition . Two ideas make this work. (1) Forests as adaptive kernels: instead of averaging per-tree estimates (which does not remove the bias of noisy moment solutions), the forest produces weights — how often training point shares a leaf with — and solves a single -weighted estimating equation. (2) Gradient-based splitting: each node computes influence-function pseudo-outcomes and runs an ordinary CART split on them, maximizing heterogeneity in at CART-like cost. Instances: regression forests (exactly recovered), quantile forests, causal forests / conditional average partial effects (with DML-style local centering), and instrumental forests. Implemented in the
grfpackage.
Overview
The local-moment framing unifies problems the vault treats separately: (regression), (Quantile Regression), the least-squares normal equations for on (CATE), and the IV moments (Instrumental Variables). Classical local estimation (local likelihood / local GMM) solves with kernel weights and suffers the curse of dimensionality beyond two or three covariates. GRF keeps the estimating equation and replaces the kernel with data-adaptive forest weights targeted at heterogeneity in .
Why not average trees as in Honest Trees and Causal Forests? “Noisy solutions to moment equations … are generally biased, and averaging would do nothing to alleviate the bias.” For regression the two views coincide; for ratio-type estimators (IV, partial effects in small leaves) the weighting view is materially more stable.
Main Content
Forest weights and the GRF estimator (eqs. 2–3) ^def-grf-weights
Grow trees; let be the set of training examples in the same leaf as in tree . Define
so . The GRF estimate is
With this gives — exactly Breiman’s regression forest.
Proposition 1 — the splitting criterion
For a parent node split into children , let solve the estimating equation within child and define
Under the Section 3 assumptions, if has radius and , then the target error satisfies , where does not depend on the split. Hence: choose splits that maximize heterogeneity in the child estimates. (The Athey–Imbens causal-tree rule is a special case.)
Optimizing exactly would mean re-solving the moment equation in every candidate child. GRF linearizes instead.
Gradient tree (Algorithm 2; eqs. 4, 6–9) ^alg-gradient-tree
At each parent node :
- Solve once in the parent: , and compute (any consistent estimate of ).
- Labeling step: pseudo-outcomes , where picks the -coordinate. ( is observation ‘s influence on .)
- Regression step: run a standard CART split on the , maximizing
- Recurse on the children (relabeling within each).
Proposition 2: if is consistent, . For least squares, and step 3 is exactly Breiman’s split. All candidate splits along a feature are evaluated in a single pass via cumulative sums, as in gradient boosting.
Generalized random forest with honesty and subsampling (Algorithm 1) ^alg-grf
For : draw a subsample of size without replacement; split it into halves ; grow a gradient tree on ; find the -examples sharing a leaf with , ; add to the weight of each . Output solving the weighted moment equation with weights .
Specification 1 (theory): trees are symmetric, make balanced splits (each child gets a fraction of the parent), split on each feature with probability (implemented by trying variables per split), and the forest is honest with , .
Application 1 — quantile forests (§5)
With the pseudo-outcomes reduce to : split so as to separate observations above the parent’s -th quantile from those below. For several quantiles at once, label each point by the parent-quantile interval it falls in and use a multiclass split. Meinshausen’s (2006) quantile regression forest uses the same weighting idea but ordinary CART splits on , so it detects mean shifts only. In Fig. 2 (, , 39 noise covariates) both methods track a mean shift at , but under a pure scale shift Meinshausen’s method “breaks down completely” while GRF recovers the 0.1/0.9 quantile jump. This is the nonparametric counterpart of conditional quantile treatment effects in Quantile Regression.
Application 2 — conditional average partial effects and causal forests (§6)
Model with , exogeneity (unconfoundedness when ), and . Then and
a forest-weighted regression of on . Pseudo-outcomes: with . Continuous treatments (spend, price, dose) are covered as-is.
Local centering (§6.1.1) ^def-local-centering
Before growing the forest, replace by and , where are leave-one-out (out-of-bag) forest estimates of and . On any region where is constant, — Robinson’s (1988) partialling-out moment — so the estimator is “robust to confounding effects even when the weights are not sharply concentrated around .”
Local centering is Neyman Orthogonality applied inside the forest: the residual-on-residual moment is insensitive to first-order errors in , exactly as in Regularization Bias and the Partially Linear Model. Leave-one-out prediction is used because it is cheap for forests; -fold cross-fitting is the option “precisely covered by theory.”
Application 3 — instrumental forests (§7)
Structural model with possibly correlated with ; binary instrument with and . Then , identified by the moments and , with curvature matrix
Without a constant-effect assumption is a conditional LATE. The gradient labeling step gives , and the authors recommend centering by three leave-one-out regression forests by default. The paper’s empirical illustration (§7.2) is Angrist & Evans’ (1998) same-sex-siblings instrument for the effect of a third child on mothers’ labor-force participation: married mothers (1980 census), overall LATE ; the forest (, minimum leaf size 800, trees) suggests the effect “is driven by mothers whose husbands have a lower income.”
Examples
Table 1 of the paper — value of orthogonalization (MSE ; ; 60 replications; WA-1/WA-2 are Wager–Athey Procedures 1/2; C. GRF = GRF with local centering):
| confounding | heterogeneity | WA-1 | WA-2 | GRF | C. GRF | ||
|---|---|---|---|---|---|---|---|
| no | yes | 10 | 800 | 1.37 | 6.48 | 0.85 | 0.87 |
| yes | no | 10 | 800 | 0.81 | 0.16 | 1.12 | 0.27 |
| yes | yes | 10 | 800 | 4.51 | 7.67 | 1.92 | 0.91 |
| yes | yes | 20 | 1600 | 3.54 | 8.61 | 1.55 | 0.57 |
WA-1 (effect-variance splits) handles heterogeneity but not confounding; WA-2 (propensity trees) the reverse — and the practitioner was “forced to choose.” Centered GRF is near-best in both pure settings and clearly best when both are present.
Usage sketch.
library(grf)
Y.hat <- predict(regression_forest(X, Y))$predictions # out-of-bag = leave-one-out
W.hat <- predict(regression_forest(X, W))$predictions
cf <- causal_forest(X, Y, W, Y.hat = Y.hat, W.hat = W.hat) # local centering
ivf <- instrumental_forest(X, Y, W, Z) # conditional LATE
qf <- quantile_forest(X, Y, quantiles = c(0.1, 0.5, 0.9))
average_treatment_effect(cf) # AIPW average of the CATE fitConnections
- Honest Trees and Causal Forests — Procedure 1 is “almost equivalent to a generalized random forest without centering”; the differences are exact-vs-gradient splitting and tree-averaging-vs-weighting.
- Asymptotic Normality and Inference for Forests — consistency (Thm 3), the pseudo-forest coupling (Lemma 4), the CLT (Thm 5) and bootstrap-of-little-bags intervals (Thm 6).
- Neyman Orthogonality, Regularization Bias and the Partially Linear Model, R-Learner and Orthogonal CATE Estimation — local centering is the R-learner idea with forest-kernel localization; Nie & Wager describe GRF as using Robinson’s decomposition for “local parametric modeling.”
- GMM Estimation and Instruments for Price Endogeneity, Method of Simulated Moments — GRF is local (forest-weighted) method-of-moments; any just-identified moment model with computable and can be plugged in.
- Instrumental Variables, Local Average Treatment Effects — heterogeneous IV.
- Quantile Regression — quantile forests as the nonparametric version.
- Metalearners for CATE, Nonparametric Causal Inference — alternative CATE estimators (metalearners; BART).
See Also
- DML Estimators for ATE and the Interactive Model — for averaging a fitted into an ATE with valid inference, use the AIPW score with the forest’s nuisance estimates.
- Common Support and Overlap — local centering does not remove the need for overlap; must be invertible (Assumption 2).
- Shape (Saturation) Effects — conditional average partial effects of a continuous spend variable are local slopes of a response curve; GRF estimates them without a parametric saturation form.