R package to implement aggregation trees, a nonparametric approach to discovering heterogeneous subgroups in a selection-on-observables framework.

aggTrees allows researchers to assess whether there exists relevant heterogeneity in treatment effects by generating a sequence of optimal groupings, one for each level of granularity. For each grouping, we obtain point estimation and inference about the group average treatment effects. Please reference the use as Di Francesco (2022).

To get started, please check the online short tutorial.


The package can be downloaded from CRAN:


Alternatively, the current development version of the package can be installed using the devtools package:

devtools::install_github("riccardo-df/aggTrees") # run install.packages("devtools") if needed.


  • Athey, S., & Imbens, G. W. (2016). Recursive Partitioning for Heterogeneous Causal Effects. Proceedings of the National Academy of Sciences, 113(27). [paper]

  • Athey, S., Tibshirani, J., & Wager, S. (2019). Generalized Random Forests. Annals of Statistics, 47(2). [paper]

  • Chernozhukov, V., Demirer, M., Duflo, E., & Fernandez-Val, I. (2017). Generic Machine Learning Inference on Heterogeneous Treatment Effects in Randomized Experiments. National Bureau of Economic Research. [paper]

  • Cotterman, R., & Peracchi, F. (1992). Classification and aggregation: An application to industrial classification in cps data. Journal of Applied Econometrics, 7(1). [paper]

  • Di Francesco, R. (2022). Aggregation Trees. CEIS Research Paper, 546. [paper]

  • Holm, S. (1979). A Simple Sequentially Rejective Multiple Test Procedure. Scandinavian Journal of Statistics, 6(2). [paper]

  • Semenova, V., & Chernozhukov, V. (2021). Debiased Machine Learning of Conditional Average Treatment Effects and Other Causal Functions. The Econometrics Journal, 24(2). [paper]