Stata Command: xtregtwo

Stata Command: xtregtwo.ado

The output displayed below shows fixed effect estimates of the standard Fama-French three-factor regression with novel standard errors that are robust against clustering by firms, clustering by months, and serial correlation in unobserved macroeconomic effects. It is implemented by the Stata command xtregtwo, which executes estimation of linear panel regression models with standard errors robust to two-way clustering and untruncated serial correlation in common time effects.

Installation:

. ssc install xtregtwo

Usage:

. use "fama_french.dta"

. xtset i t

. xtregtwo return mkt smb hml, fe

Help:

. help xtregtwo

Reference: Chiang, H.D., B.E. Hansen, and Y. Sasaki (2022) Standard Errors for Two-Way Clustering with Serially Correlated Time Effects. arXiv:2201.11304. Paper.


Title
xtregtwo -- Executes estimation of panel regression with standard errors robust to two-way clustering and serial correlation in time effects.

Syntax xtregtwo depvar [indepvars] [if] [in] [, noconstant fe]

Description
xtregtwo executes estimation of linear panel regression models with standard errors robust to two-way clustering and untruncated serial correlation in common time effects. The method is based on Chiang, Hansen, and Sasaki (2022). The command reports the ordinary least squares estimates, robust standard errors, z values, p values, and confidence intervals. The command runs the fixed-effect estimation by within-transformation if the fe option is used.

Options
noconstant suppress constant term
fe fixed effects by within-transformation

Example
Load the asset pricing data:
. use "fama_french.dta"
Set i and t variables in the panel:
. xtset i t
Estimation:
. xtregtwo return mkt smb hml, fe

Stored results
xtregtwo stores the following in e():
Scalars e(NT) observations e(N) cross sectional units e(T) time periods e(M) time window for HAC estimation
Macros e(cmd) xtregtwo e(properties) b V
Matrices e(b) coefficient vector e(V) variance-covariance matrix of the estimators
Functions e(sample) marks estimation sample
Reference
Chiang, H.D., B.E. Hansen, and Y. Sasaki 2022. Standard Errors for Two-Way Clustering with Serially Correlated Time Effects. Working Paper. Link to Paper.
Authors
Harold D. Chiang, University of Wisconsin, Madison, WI.
Bruce E. Hansen, University of Wisconsin, Madison, WI.
Yuya Sasaki, Vanderbilt University, Nashville, TN.