Title

predict -- Predictions after trop estimation

Syntax

predict newvar [if] [in] [, statistic]

statistic

Main
y0 counterfactual prediction Y(0); the default

y1 potential outcome Y(1)

te treatment effect (treated observations only)

residuals residuals

mu global intercept (joint method only)

alpha unit fixed effects

beta time fixed effects

xb linear prediction (alias for y0)

fitted fitted values Y_hat = Y(0) + tau * W

att treatment effect (alias for te)

counterfactual counterfactual Y(0) (alias for y0)

Description

predict creates a new variable containing predictions, residuals, or
estimated model components after trop estimation.

If no statistic is specified, the default is y0 (counterfactual
prediction). Only one statistic may be specified at a time.

Options

Main

y0 calculates the counterfactual prediction Y(0), representing the
outcome that would have been observed in the absence of treatment.
This is the default.

The computation depends on the estimation method:

Twostep (Algorithm 2):
For treated observations, Y(0) = Y_obs - tau_hat, preserving the exact
identity Y_obs - Y(0) = tau_hat. For control observations,
Y(0) = alpha_i + beta_t + L_, reconstructed from the additive model
components stored in e(alpha), e(beta), and
e(factor_matrix).

Joint (Remark 6.1):
For all observations, Y(0) = mu + alpha_i + beta_t + L_, where mu
is the global intercept stored in e(mu), with identification
constraints alpha_1 = beta_1 = 0. This is the shared-tau extension used
when a common treated block and homogeneous effects are substantively
appropriate.

y1 calculates the potential outcome Y(1) under treatment.

Twostep: For treated observations, Y(1) = Y(0) + tau_it, where
tau_it is the observation-specific treatment effect from e(tau).
For control observations, Y(1) = Y(0) + ATT, where ATT is the scalar
average treatment effect from e(att).

Joint: For all observations, Y(1) = Y(0) + ATT, using the
homogeneous scalar treatment effect from e(att).

te calculates the treatment effect for treated observations only.
Control observations receive missing values.

Twostep: Returns the observation-specific treatment effect tau_it
from e(tau), which permits heterogeneous effects across units and
time periods.

Joint: Returns the homogeneous scalar ATT from e(att) for all
treated observations. This applies the same shared tau to every treated
cell.

The same information is available without creating a new variable through
e(tau_matrix) (a T x N matrix indexed by (time, panel) with
missing values in untreated cells); see trop for
details.

residuals calculates residuals for all observations.

Twostep (with e(tau) available):
epsilon_it = Y_it - Y(0)_it - tau_it, where tau_it is the
observation-specific treatment effect. For control observations
(tau_it = 0), this simplifies to epsilon_it = Y_it - Y(0)_it.

Twostep (without e(tau)) and Joint:
epsilon_it = Y_it - Y(0)_it - ATT * D_it, where ATT is the scalar
average treatment effect and D_it is the treatment indicator.

mu extracts the global intercept mu.

Twostep: Returns missing values (.) for all observations. The
Twostep decomposition Y(0) = alpha_i + beta_t + L_it does not identify
a separate global intercept.

Joint: Returns the constant e(mu) for all observations. The
Joint decomposition Y(0) = mu + alpha_i + beta_t + L_it includes an
explicit global intercept with identification constraints
alpha_1 = beta_1 = 0.

alpha extracts unit fixed effects alpha_i from e(alpha).
Each unit receives the same value across all time periods.

beta extracts time fixed effects beta_t from e(beta). Each
time period receives the same value across all units.

xb is an alias for y0. Both produce identical results.

Remarks

Method-dependent parameterization

The trop command supports two estimation methods that differ in
their parameterization of the counterfactual outcome:

Twostep (Algorithm 2): Y(0) = alpha_i + beta_t + L_it

Joint (Remark 6.1): Y(0) = mu + alpha_i + beta_t + L_it with
alpha_1 = beta_1 = 0

Both parameterizations yield equivalent counterfactual predictions. The
difference lies in how the intercept is distributed among the parameters.

Heterogeneous versus homogeneous treatment effects

Under the Twostep method, each treated observation receives an
observation-specific treatment effect tau_it stored in e(tau). The
te option returns these heterogeneous effects directly. Under the
Joint method, a single scalar ATT is estimated and applied uniformly to
all treated observations. The joint path is therefore best viewed as
a shared-weight, homogeneous-effect extension rather than the default TROP
workflow.

Treatment effect sparsity

The te option generates non-missing values only for treated
observations (D=1). For control observations (D=0), the treatment
effect is undefined and set to missing.

Data consistency

predict verifies that the data has not changed since estimation
through a multi-level validation procedure. If the sample size, panel
structure, or dependent variable checksum has changed, an error is
reported.

Examples

Setup: Generate test panel data

. clear all

. set seed 12345

. set obs 1000

. gen id = ceil(_n/10)

. bysort id: gen t = _n

. gen y = rnormal() + 0.5*(id>80)*(t>7)

. gen d = (id > 80 & t > 7)

Run trop estimation

. trop y d, panelvar(id) timevar(t) seed(42)

Counterfactual prediction (default)

. predict y0_hat

. predict y0_hat2, y0

Potential outcome under treatment

. predict y1_hat, y1

Treatment effects (treated only)

. predict te_hat, te

Residuals

. predict resid, residuals

Fixed effects

. predict alpha_hat, alpha

. predict beta_hat, beta

Global intercept (joint method)

. trop y d, panelvar(id) timevar(t) method(joint) seed(42)

. predict mu_hat, mu

Stored results

predict after trop does not modify e() or store
results in r(). It creates a new variable in the dataset.

Methods and formulas

The TROP estimator predicts counterfactual outcomes for treated unit-time
pairs by solving a weighted nuclear-norm penalized regression (Eq. 2 of
Athey, Imbens, Qu, and Viviano, 2025):

(alpha_hat, beta_hat, L_hat) = argmin sum_ theta_s * omega_j *
(1 - W_) * (Y_ - alpha_j - beta_s - L_)^2
+ lambda_nn * ||L||_*

where theta_s = exp(-lambda_time * |t - s|) are exponential time-decay
weights and omega_j = exp(-lambda_unit * dist(j, i)) are unit
distance-based weights (Eq. 3). The treatment effect for each treated
observation (i, t) is then estimated as

tau_hat_ = Y_ - alpha_hat_i - beta_hat_t - L_hat_

Under the Twostep method (Algorithm 2), each treated observation receives
its own weight matrix and observation-specific treatment effect tau_it.
Under the Joint method (Remark 6.1), a single set of global weights is
used and a homogeneous scalar ATT is estimated. This shared-tau extension
is intended for simultaneous-adoption designs.

The triple robustness property (Theorem 5.1) states that the bias
satisfies

|Bias| <= ||Delta^u||_2 * ||Delta^t||_2 * ||B||_*

where Delta^u is unit imbalance, Delta^t is time imbalance, and B
captures regression adjustment misspecification. The estimator is
consistent if any one of the three components removes the underlying
bias.

Tuning parameters (lambda_time, lambda_unit, lambda_nn) are selected via
leave-one-out cross-validation (LOOCV) minimizing (Eq. 5)

Q(lambda) = sum_ (1 - W_) * (tau_hat_(lambda))^2

References

Athey, S., G. W. Imbens, Z. Qu, and D. Viviano. 2025.
Triply robust panel estimators.
arXiv preprint arXiv:2508.21536.

Author

Xuanyu Cai

City University of Macau

xuanyuCAI@outlook.com

Wenli Xu

City University of Macau

wlxu@cityu.edu.mo

Also see

Online: trop, trop_estat