We develop the case of two-stage least squares estimation (2SLS) in the general framework of Athey et al. (Generalized Random Forests, Annals of Statistics, Vol. 47, 2019) and provide a software implementation for R and C++. We use the method to revisit the classic application of instrumental variables in Angrist and Evans (Children and Their Parents' Labor Supply: Evidence from Exogenous Variation in Family Size, American Economic Review, Vol. 88, 1998). The two-stage least squares random forest allows one to investigate local heterogenous effects that cannot be investigated using ordinary 2SLS.
machine learning generalized random forests fertility instrumental variable estimation