*! version 1.0.0 26jan2026

Title

ate_pct -- ATE in percentage points under subgroup heterogeneity (post-estimation)

Syntax

ate_pct groupvars [if]
, [truew groupsize(numlist)]

where groupvars is a varlist of G mutually exclusive subgroup indicator variables
(0/1 dummies) whose coefficients are estimated in the preceding model and therefore
appear in e(b) and e(V).

If groupsize(numlist) is not specified, ate_pct uses groupvars and
the estimation sample e(sample) to compute subgroup sizes and construct
empirical weights.

The if qualifier is for advanced users only. It can further restrict the sample used to compute subgroup weights/shares; coefficients and the variance–covariance matrix are always taken from the preceding estimation command (i.e., from e(b) and e(V) on e(sample)).

Description

ate_pct is a post-estimation command for computing average treatment effect (ATE) in percentage points under treatment-effect heterogeneity across observable subgroups.

The command extracts the coefficients on the subgroup indicator variables from e(b) and treats them as subgroup-specific average
log-point treatment effects, denoted by tau_g for g = 1, ..., G, together with
their covariance matrix from e(V).

If subgroup sizes are not supplied, ate_pct counts observations in each subgroup using e(sample) to obtain subgroup sizes N_g.
Using either the computed or supplied subgroup
sizes, the command constructs subgroup weights
w_g = N_g / (sum_h N_h) and, unless truew is specified, estimates the
associated weight covariance matrix.

The command reports the following ATE-in-percentage-points functionals:

(1) taubar: weighted average of subgroup-specific log-point effects,
taubar = sum_g (w_g·tau_g) .

(2) rho_a: conventional approximation,
rho_a = exp(taubar) - 1.

(3) rho_b: subgroup-aggregated percentage-point effect, rho_b = sum_g [ w_g·exp(tau_g) ] -1 .

Standard errors are computed using delta-method formulas that account for estimation
uncertainty in subgroup effects and, when applicable, in subgroup weights.

ate_pct requires the preceding command to have stored e(b), e(V),
and e(sample).

Options

groupsize(numlist) supplies subgroup sizes N_g, one per variable in
groupvars and in the same order. All values must be positive.

truew treats subgroup weights as fixed/known and sets the weight-variance component to zero (i.e., Sigma_w = 0).
This option is appropriate when subgroup weights are known or when inference is conditional on weights (for example, when equal weights are assigned to all subgroups).

Returned results

ate_pct returns the following in r():

Scalars:

r(N) estimation sample size from the preceding command

r(N_T) sample size used by ate_pct to compute subgroup weights/shares.
(N_T = sum_g N_g)

r(p_T) target-sample share,
p_T = N_T / N, when weights are estimated

Matrices:

r(b) 1x3 vector with columns taubar rho_a rho_b

r(V) 3x3 variance matrix corresponding to r(b). Off-diagonal covariances are ignored and set to 0.

r(tau) Gx1 vector of subgroup average log-point effects tau_g

r(w) Gx1 vector of subgroup weights w_g

r(Sigma_tau) GxG covariance matrix of tau

r(Sigma_w) GxG covariance matrix of w (zero if truew)

r(delta) stacked vector (tau \ w)

r(Sigma_delta) block-diagonal covariance matrix of (tau,w)

Examples

Suppose variables gr1, gr2, gr3 are indicators for three sub-treatment groups and we are interested in the ATE in percentage points of these three sub-treatment groups.

1. After a semi-log regression with subgroup-specific treatment effects:

. use "ate_pct_example",clear

. regress lny gr1 gr2 gr3 x, robust

. ate_pct gr1 gr2 gr3

2. Treat subgroup weights as fixed/known:

. ate_pct gr1 gr2 gr3, truew

3. Equal subgroup weights (requires truew), and focuses on subgroups 1 and 2:

. ate_pct gr1 gr2, groupsize(1 1) truew

4. Provide subgroup sizes externally. The command below is exactly the same as ate_pct gr1 gr2 gr3 as 15, 24, 37 are the sample sizes for the three treatment groups.

. ate_pct gr1 gr2 gr3, groupsize(15 24 37)

Remarks

Requirements.
The variables in groupvars must be a subset of the coefficient names in e(b).
When subgroup sizes are computed from the data, subgroup indicators must be 0/1 and
mutually exclusive within the estimation sample.

Reference

Zeng, Y. Estimation and inference on average treatment effects in percentage points under heterogeneity. Working paper.

Author and support

Ying Zeng

School of Economics and Wang Yanan Institute for Studies in Economics (WISE),
Xiamen University

Email: zengying17@gmail.com

The latest version of the code and related materials are available at:
https://github.com/zengying17/ate_pct-stata