*! version 1.0.0 08 Mar 2024
help xtteifeci

Title

xtteifeci -- implemention of estimation and inference of treatment effects through a factor-based approach.

Syntax

xtteifeci depvar [indepvars],
treatvar(treatvarname)
[options]

Model
r(#) number of factors

iterate(#) maximum number of iterations

tolerance(float) tolerance criterion for convergence

trend({0|1)} indicator of nonstationary trend

bootstrap(#) number of bootstrap samples

seed(int) seed used by the random number generator

Optimization
rmethod({bn|abc}) method for calculating the number of factors

rmax(#) maximum number of factors

Reporting
citype({eq|sy)} type of reported confidence interval

frame(framename) create a Stata frame storing generated variables.

nofigure do not display figures.

savegraph(prefix, [asis replace]) save all produced graphs to the current path.

xtset panelvar timevar must be used to declare a strongly panel dataset in the usual long form; see [XT] xtset.

depvar and indepvars must be numeric variables, and abbreviations are not allowed.

Description

xtteifeci is designed for estimation and inference of treatment effects and provide nonparamametric confidence
intervals for panel data models with interactive fixed effects as proposed by Li et al. (2024),
which augments the works of Gobillon and Magnac (2016), Xu (2017), and Bai and Ng (2021).
xtteifeci supports statistical inference through reporting confidence intervals and p-values,
applicable to models with diverse specifications, including those with or without covariates and/or nonstationary trends. For a detailed guidence to the usage of xtteifeci, see Yan et al. (2024).

Required Settings

To implement a factor-based approach, the outome variable depvar and the treatment variable treatvarname must be inputted to xtteifeci.
Appending covariates indepvars to model is dispensable but conducive to the prediction of counterfactual outcome and the estimation of treatment effects.
If treatvarname signifies staggered treatments, i.e., multiple units undergo intervention at various periods,
xtteifeci automatically identifies the number of periods without treatment across all units as the height of "wide block" and recognizes the number of control units as the width of "tall block".

treatvar(treatvarname) specifies a dummy variable indicating whether a unit is treated in a particular period.

Options

Model

r(#) specifies the number of factors that used for factor-based estimation of treatment effects,
where # is an int that falls within the range [1, min(T_0, G_0)], T_0 is the number of periods without treatment across all units, and G_0 is the number of control units.
If r(#) is not specified,
xtteifeci automatically determines the number of factors by the options rmethod({bn|abc}) and rmax(#).

iterate(#) specifies the maximum number of iterations allowed in factor-based estimation.
For the model with covariates, xtteifeci terminates iterations when the coefficient estimation reaches # loops to prevent an infinite loop in case the estimator does not converge.
# is set to a large positive int, which defaults to 1000.

tolerance(tol) specifies the tolerance criterion in interactive fixed effect estimation.
For the model with covariates, xtteifeci terminates iterations when the L2 norm difference of the estimator between two consecutive iterations is less than the specified threshold tol.
tol is set to a small positive float, which defaults to 0.0001.

trend({0|1}) specifies an indicator of nonstationary trend.
trend(0) and trend(1) correspond to stationary and nonstationary trend, respectively.
For the model with nonstationary trend, xtteifeci implement modified asymptotic principal component analysis or continuously-updated estimatation,
which can be viewed as a generalisation of asymptotic principal component analysis or interactive fixed effect estimation, respectively.
If neither trend(0) nor citype(1) is specified, the default is trend(0).

bootstrap(#) specifies the number of bootstrap samples for factor-based estimation of treatment effects.
xtteifeci employs a residual-based resampling scheme to generate # bootstrap samples for constructing confidence intervals of treatment effects.
# is set to a large positive int, which defaults to 500.

seed(int) specifies the seed used by the random number generator for reproducible results, which defaults to 1.

Optimization

If r(#) is not specified, xtteifeci determines the number of factors for model using BN method (proposed by Bai and Ng (2002)) or ABC method (proposed by Alessi et al. (2010)),
corresponding to the option rmethod(bn) or rmethod(abc), respectively.

rmethod({bn|abc}) specifies the method to determine the number of factors for the model of factor-based approach,
with rmethod(bn) for BN method (proposed by Bai and Ng (2002)) or rmethod(abc) for ABC method (proposed by Alessi et al. (2010)).
If neither rmethod(bn) nor rmethod(abc) is specified, the default is set to rmethod(bn).

rmax(#) specifies the maximum number of factors limited in ABC method or BN method, which defaults to 8.

Reporting

citype({eq|sy}) specifies the type of reported confidence interval of predicted outcomes and treatment effects.
citype(eq) corresponds to the equal tailed confidence interval, and citype(sy) corresponds to the symmetric confidence interval.
If neither citype(eq) nor citype(sy) is specified, the default is set to citype(eq).

frame(framename) creates a Stata frame storing generated variables including counterfactual predictions, treatment effects,
90%, 95%, 99% confidence intervals of predicted outcomes and treatment effects,
and p-values of treatment effects.
The frame named framename is replaced if it already exists, or created if not.

nofigure do not display figures. The default is to display all figures for estimation results.

savegraph(prefix, [asis replace]) automatically and iteratively calls the graph save to save all produced graphs to the current path,
where prefix specifies the prefix added to _graphname to form a file name,
that is, the graph named graphname is stored as prefix_graphname.gph.
asis and replace are options passed to graph save; for details, see [G-2] graph save.
Note that this option only applies when nofigure is not specified.

Example 1: estimating the impact of political integration of Hong Kong with mainland China in 1997q3 (Hsiao et al., 2012)

. use growth2, clear

. xtset region time

* Visualize the configuration of the treatment variable "pi" for political integration in panel data (panelview has been installed from SSC)

. panelview gdp pi, i(region) t(time) type(treat)

* Implement factor-based estimation upon the condition of no missing values in "pi"

. xtteifeci gdp if !missing(pi), treatvar(pi)

* Implement factor-based estimation with the reporting of symmetric confidence intervals

. xtteifeci gdp if !missing(pi), treatvar(pi) citype(sy)

Example 2: estimating the impact of economic integration between Hong Kong and mainland China in 2004q1 (Hsiao et al., 2012)

. use growth2, clear

. xtset region time

* Visualize the configuration of the treatment variable "ei" for economic integration in panel data (panelview has been installed from SSC)

. panelview gdp ei, i(region) t(time) type(treat)

* Implement factor-based estimation and create a Stata frame "growth_ei" storing generated variables

. xtteifeci gdp, treatvar(ei) frame(growth_ei)

* Change to the generated Stata frame "growth_ei"

. frame change growth_ei

* Change back to the default Stata frame

. frame change default

Example 3: estimating the effect of California's tobacco control program (Abadie, Diamond, and Hainmueller 2010)

. use smoking2, clear

. xtset state year

* Visualize the configuration of the treatment variable "ctcp" for California's tobacco control program (CTCP) in panel data (panelview has been installed from SSC)

. panelview cigsale ctcp, i(region) t(time) type(treat)

* Implement factor-based estimation for the model with covariates, a nonstationary trend and the number of factors calculated by ABC method

. xtteifeci cigsale lnincome eduattain poverty, treatvar(ctcp) rmethod(abc) trend(1)

* List the names and values of the macros, scalars and matrix stored in e()

. ereturn list

Stored results

rcm stores the following in e():

Scalars

e(N) number of observations on which coefficient estimation was performed

e(df_r) number of degrees of freedom used with t statistics of coefficient estimation

e(r) number of factors

e(T) number of periods

e(T0) number of periods without treatment across all units

e(T1) number of periods with treatment across at least one unit

e(G) number of units

e(G0) number of control units

e(G1) number of treated units

e(mse) mean squared error of the model fitted

e(rmse) root mean squared error of the model fitted

e(r2) R-squared of the model fitted

Macros

e(panelvar) name of panel variable

e(timevar) name of time variable

e(varlist) names of dependent variable and independent variables

e(depvar) names of dependent variable

e(indepvars) names of independent variables

e(trend) indicator of nonstationary trend

e(cmd) xtteifeci

e(cmdline) command as typed

e(seed) seed used by the random number generator for reproducible results

e(frame) name of Stata frame storing generated variables

e(graph) names of all produced graphs

e(properties) b V

Matrices

e(b) coefficient vector of the model fitted

e(V) variance-covariance matrix of the coefficient estimators of the model fitted

e(Ftall) common factors matrix estimated from "tall block"

e(Ltall) factor loadings matrix estimated from "tall block"

e(Fwide) common factors matrix estimated from "wide block"

e(Lwide) factor loadings matrix estimated from "wide block"

Reference

Bai, Jushan and Serena Ng. 2002. Determining the number of factors in approximate factor models. Econometrica 70(1): 191-221.

Bai, Jushan. 2003. Inferential theory for factor models of large dimensions. Econometrica 71(1): 135-171.

Bai, Jushan. 2009. Panel data models with interactive fixed effects. Econometrica 77(4): 1229-1279.

Alessi, Lucia, Matteo Barigozzi and Marco Capasso. 2010. Improved penalization for determining the number of factors in approximate factor models.
Statistics & Probability Letters 80(23-24): 1806-1813.

Gobillon, Laurent, and Thierry Magnac. 2016. Regional policy evaluation: Interactive fixed effects and synthetic controls.
Review of Economics and Statistics 98(3): 535–551.

Xu, Yiqing. 2017. Generalized synthetic control method: Causal inference with interactive fixed effects models. Political Analysis 25(1): 57–76.

Bai, Jushan, and Serena Ng. 2021. Matrix completion, counterfactuals, and factor analysis of missing data. Journal of the American Statistical Association 116(536): 1746-1763.

Li, Xingyu, Yan Shen, and Qiankun Zhou. 2024. Confidence Intervals of Treatment Effects in Panel Data Models with Interactive Fixed Effects. Journal of Econometrics 240(1): 105684.

Yan, Guanpeng, Li, Xingyu, Yan Shen, and Qiankun Zhou. 2024.
xtteifeci: A command for estimation and inference of treatment effects through a factor-based approach. Working Paper.

Author

Guanpeng Yan, Shandong University of Finance and Economics

guanpengyan@yeah.net

Xingyu Li, Peking University

x.y@pku.edu.cn

Yan Shen, Peking University

yshen@phbs.pku.edu.cn

Qiankun Zhou (corresponding author), Louisiana State University

qzhou@lsu.edu