← See Stata 19's new features
Highlights
Treatment-effects heterogeneity at different levels
Individualized average treatment effects (IATEs)
Group average treatment effects (GATEs)
Sorted group average treatment effects (GATESs)
Flexible specification
Conditional treatment effects fit using generalized random forest or parametric regression
Outcome model and treatment model fit using lasso, generalized random forest, or parametric regression
Robust estimation
Two Neyman orthogonal estimators to guard against machine learning mistakes (partialing-out and AIPW)
Cross-fitting to avoid overfitting for the outcome and treatment-assignment models
Evaluate treatment-assignment policy
Compare average outcomes of policies (estat policyeval)
Compute the ATE in a subsample (estat ate)
Treatment-effects visualization
Histogram of predicted IATEs (categraph histogram)
Plot estimates of GATEs or GATESs (categraph gateplot)
Plot the IATE function (categraph iateplot)
Inference for treatment-effects heterogeneity
Predict the IATE function with confidence intervals (predict)
Test whether treatment effects are heterogeneous (estat heterogeneity)
Test whether the GATEs or GATESs are equal across groups (estat gatetest)
Classification analysis of groups with largest and smallest effects (estat classification)
Linear approximation of the IATE function (estat projection)
Nonparametric series approximation of the IATE function (estat series)
See more causal inference features
With the new cate command, go beyond estimating overall treatment effects in your analysis of causal effects to estimating individualized and group-specific ones. Compare different interventions and policies. Explore treatment-effects heterogeneity.
Treatment effects estimate the causal effects of a treatment on an outcome. The effect may be heterogeneous. For example, a labor economist may want to know the effect of a job training program on earnings for those who participate in the program; an online shopping company may want to know the effect of a price discount on purchasing behavior for customers with different demographic characteristics, such as age and income; a medical team may want to measure the effect of smoking on stress levels for individuals in different age groups.
Average treatment effects conditional on a set of variables (CATEs) help us understand heterogeneous treatment effects. Whereas average treatment effects (ATEs) average over the entire population, CATEs average over subgroups. Therefore, CATEs allow us to explore treatment-effects heterogeneity and, by construction, are useful to evaluate how different treatment-assignment policies affect different groups in the population.
cate helps us answer questions such as the following:
-> Individualized average treatment effects
-> Estimating treatment effects over prespecified groups
We want to estimate the effect of 401(k) eligibility (e401k) on net financial assets (asset) to answer the following questions:
The data are from a sample of households in the 1990 Survey of Income and Program Participation (SIPP). They contain information on the head of the household: income level category (incomecat), age (age), years of education (educ), whether they receive a pension benefit (pension), marital status (married), whether they participate in an IRA (ira), whether they own a home (ownhome), and whether there are two earners in the same household (twoearn).
We want to study the effect of being eligible for a 401(k) on assets (assets) given a person's incomecat, age, educ, pension, married, ira, ownhome, and twoearn. With teffects, for instance, we can get an average effect. With cate, we can get an effect for each individual, an individualized average treatment effect (IATE).
First, we open the assets3 dataset. To save some typing later, we define a global macro, catecovars, that stores the names of the variables on which we will condition.
. use https://www.stata-press.com/data/r18/assets3 (Excerpt from Chernozhukov and Hansen (2004)) . global catecovars age educ i.(incomecat pension married twoearn ira ownhome)
We are ready to fit the model using cate. We specify po following the command name to use the partialing-out estimator. We specify the outcome variable asset and the global macro $catecovars that contains the predictors in the first set of parentheses and the treatment-assignment variable e401k in the second set of parentheses. We also specify the rseed() option to make the results reproducible.
. cate po (assets $catecovars) (e401k), rseed(12345671) Cross-fit fold 1 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 2 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 3 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 4 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 5 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 6 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 7 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 8 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 9 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Cross-fit fold 10 of 10 ... Performing lasso for outcome assets ... Performing lasso for treatment e401k ... Performing random forest for IATE ... Estimating AIPW scores ... Estimating ATE ... Conditional average treatment effects Number of observations = 9,913 Estimator: Partialing out Number of folds in cross-fit = 10 Outcome model: Linear lasso Number of outcome controls = 17 Treatment model: Logit lasso Number of treatment controls = 17 CATE model: Random forest Number of CATE variables = 17
Robust | ||
assets | Coefficient std. err. z P>|z| [95% conf. interval] | |
ATE | ||
e401k | ||
(Eligible | ||
vs | ||
Not eligi..) | 7937.182 1153.017 6.88 0.000 5677.309 10197.05 | |
POmean | ||
e401k | ||
Not eligible | 14016.38 833.4423 16.82 0.000 12382.87 15649.9 | |
The iteration log shows the cross-fitting process of fitting the outcome model to assets and the treatment model to e401k. By default, lasso for the linear model is used for the outcome assets, and lasso for the logit model is used for the treatment e401k.
The output shows that random forest is used to estimate the IATE function once the cross-fitting is finished. Then the AIPW scores implied by the partial linear model are computed, and the ATE is estimated as an average of the AIPW scores. The ATE reported in the table indicates that if everyone in the population were eligible for a 401(k), the net financial assets would be, on average, $7,937 higher than if no one were eligible for 401(k).
In addition to the ATE, cate estimates IATEs, which we can use to predict treatment effects for each observation. First, we use categraph histogram to draw a histogram of the predicted IATEs and see their distribution.
. categraph histogram
The graph shows that treatment effects are mostly positive but have a fat right tail. Thus, the ATE may underestimate the effect of 401(k) eligibility on assets for some groups.
Although the histogram above allows us to visually inspect the distribution of treatment effects, we should not use it as evidence to support treatment-effects heterogeneity. To test whether the treatment effects are heterogeneous, use estat heterogeneity.
. estat heterogeneity Treatment-effects heterogeneity test H0: Treatment effects are homogeneous chi2(1) = 4.11 Prob > chi2 = 0.0427
We can further explore heterogeneity. We might want to see how the IATE function changes across levels of a variable of interest while fixing all other covariates at specified values, such as their means. For example, we can allow educ to vary while holding the other variables fixed.
We use categraph iateplot to visually examine the change in the IATE function across educ levels. By default, the continuous variables such as age are fixed at their sample means, and the factor variables are fixed at their base levels.
. categraph iateplot educ Note: IATE estimated at fixed values of covariates other than educ.
Variable | Statistic Value Type | |
age | mean 41.05891 continuous | |
incomecat | base 0 factor | |
ira | base 0 factor | |
married | base 0 factor | |
ownhome | base 0 factor | |
pension | base 0 factor | |
twoearn | base 0 factor | |
In addition to the IATE function, categraph iateplot plots the 95% pointwise confidence intervals for the predictions. Below 10 years of education, the effects seem constant. The graph shows that the treatment effects are larger for people with 12 to 15 years of education while holding other variables fixed. After 15 years of education, there is more variability, and the confidence intervals are wider, making it difficult to determine whether the effect changes at these high education levels.
Above, we learned that the treatment effects of 401(k) eligibility on financial assets are heterogeneous. To characterize the heterogeneous effects, we want to know how the average treatment effects vary across prespecified groups, such as income categories.
We first look at the minimum, maximum, and median income in each income category.
. table incomecat, stat(min income) stat(max income) stat(median income) nototal
Minimum value Maximum value Median | ||
Income category | ||
0 | 0 17196 12240 | |
1 | 17214 26523 21735 | |
2 | 26526 37275 31482 | |
3 | 37296 53841 44379 | |
4 | 53844 242124 69612 | |
We see that levels 0 and 1 refer to low-income groups, levels 2 and 3 refer to middle-level income groups, and level 4 refers to high- income groups.
We have already estimated the IATE function; we now estimate group average treatment effects (GATEs), which are summaries of the IATE function for each level of a group variable. Thus, there is no need to reestimate the IATE function; we can use the existing IATE function. With cate, we specify the reestimate option to reestimate effects without reestimating the IATE function. This option will save computation time. We specify the group(incomecat) option to estimate GATEs for the income categories.
. cate, group(incomecat) reestimate Estimating GATE ... Conditional average treatment effects Number of observations = 9,913 Estimator: Partialing out Number of folds in cross-fit = 10 Outcome model: Linear lasso Number of outcome controls = 17 Treatment model: Logit lasso Number of treatment controls = 17 CATE model: Random forest Number of CATE variables = 17
Robust | ||
assets | Coefficient std. err. z P>|z| [95% conf. interval] | |
GATE | ||
incomecat | ||
0 | 4087.014 987.7124 4.14 0.000 2151.133 6022.895 | |
1 | 1399.398 1663.193 0.84 0.400 -1860.4 4659.196 | |
2 | 5154.329 1349.842 3.82 0.000 2508.688 7799.97 | |
3 | 8532.238 2287.664 3.73 0.000 4048.499 13015.98 | |
4 | 20510.94 4723.741 4.34 0.000 11252.58 29769.3 | |
ATE | ||
e401k | ||
(Eligible | ||
vs | ||
Not eligi..) | 7937.182 1153.017 6.88 0.000 5677.309 10197.05 | |
POmean | ||
e401k | ||
Not eligible | 14016.38 833.4423 16.82 0.000 12382.87 15649.9 | |
The results show both ATE and GATEs. For example, the GATE for the high-income group (level 4) is $20,511. For the highest income group, being eligible for 401(k) is expected to increase their net financial assets by $20,511 compared with the net financial assets if not eligible for 401(k). In contrast, the GATE estimate for the lowest income group (level 0) is only $4,087. In other words, people who earn more benefit more from working in a company with a 401(k) plan. The ATE estimate indicates that treatment effects for the population are expected to be $7,937. Thus, using the ATE alone does not fully characterize treatment effects among different income categories.
We can use categraph gateplot to visualize the GATE estimates to see if there is any trend.
. categraph gateplot
The graph confirms an upward trend. To further test if there is treatment-effects heterogeneity among the income groups, we use estat gatetest.
. estat gatetest Group treatment-effects heterogeneity test H0: Group average treatment effects are homogeneous ( 1) [GATE]0bn.incomecat - [GATE]1.incomecat = 0 ( 2) [GATE]0bn.incomecat - [GATE]2.incomecat = 0 ( 3) [GATE]0bn.incomecat - [GATE]3.incomecat = 0 ( 4) [GATE]0bn.incomecat - [GATE]4.incomecat = 0 chi2(4) = 18.44 Prob > chi2 = 0.0010
The test formally confirms what we see on the graph. We have strong evidence to suggest that the effects are not homogeneous.
Read more about CATE in [CAUSAL] cate in the Stata Causal Inference and Treatment-Effects Estimation Reference Manual.
Learn more about Stata's causal inference features.
View all the new features in Stata 19, and, in particular, new in causal inference.