Hi everyone,
This post introduces a new STATA command called xtgmmfa, which estimates the parameters of fixed-T data model with multifactor error structure and endogenous regressors.
Panel data models with multi-factor error structures are more flexible in controlling unobservable heterogeneity when described as interactive effects. This error structure is particularly attractive as it allows common factors to correlate with explanatory variables, thereby modeling cross-sectional dependencies that can cause bias in estimators due to endogenous variables.
With large T and large N panel data, the parameters of this type of model can be estimated using CCE and DCCE approach with user-written xtdcce commands. However, in short-T panels, there are currently no convenient commands/packages available, partly because the proposed GMM estimates in this case are relatively complex.
Juodis and Sarafidis (2022) proposed a relatively simple linear GMM estimate with many more attractive features than previous non-linear GMM estimates. The supplementary documentation for this paper includes experimental data used for estimation in Table 1 and accompanying MATLAB code.
The xtgmmfa command is developed from the MATLAB code of Juodis and Sarafidis (2022): it allows changing the initial weight matrix, adds options for adjusting the standard error, adds Growth Rate (GR) statistics in the estimation of the number of factor proxies using the regularization method, allows adding observed common factors, runs on unbalanced panel data, etc. Details can be found in the helpfile (help xtgmmfa).
To install, users run the following command:
Here are some illustrative examples:
All feedback/bug reports/code improvements are greatly appreciated.
Author: Manh Hoang Ba, Eureka Uni Team, VN. https://manhb94econometrics.wordpress.com/
Support: [email protected]
References:
This post introduces a new STATA command called xtgmmfa, which estimates the parameters of fixed-T data model with multifactor error structure and endogenous regressors.
Panel data models with multi-factor error structures are more flexible in controlling unobservable heterogeneity when described as interactive effects. This error structure is particularly attractive as it allows common factors to correlate with explanatory variables, thereby modeling cross-sectional dependencies that can cause bias in estimators due to endogenous variables.
With large T and large N panel data, the parameters of this type of model can be estimated using CCE and DCCE approach with user-written xtdcce commands. However, in short-T panels, there are currently no convenient commands/packages available, partly because the proposed GMM estimates in this case are relatively complex.
Juodis and Sarafidis (2022) proposed a relatively simple linear GMM estimate with many more attractive features than previous non-linear GMM estimates. The supplementary documentation for this paper includes experimental data used for estimation in Table 1 and accompanying MATLAB code.
The xtgmmfa command is developed from the MATLAB code of Juodis and Sarafidis (2022): it allows changing the initial weight matrix, adds options for adjusting the standard error, adds Growth Rate (GR) statistics in the estimation of the number of factor proxies using the regularization method, allows adding observed common factors, runs on unbalanced panel data, etc. Details can be found in the helpfile (help xtgmmfa).
To install, users run the following command:
Code:
net install xtgmmfa, from("https://raw.githubusercontent.com/ManhHB94/xtgmmfa/main/") replace
Code:
. * Water data (Juodis and Sarafidis, 2022)
. use js22data, clear
. xtset id year
Panel variable: id (strongly balanced)
Time variable: year, 2004 to 2008
Delta: 1 unit
. * Regularization: column M_F of table 1 in Juodis and Sarafidis (2022)
. xtgmmfa l(0/1).lcons price rain temp, gmm(l.lcons l.price rain temp) unof(smi, type(1
> )) nocons wmat(1)
Fixed-T Factor-Augmented Panel Data Regression
Estimator: Asymptotically linear twostep GMM
Method: Regularization
Reference: Juodis & Sarafidis (2022)
Number of instruments = 40 Number of obs = 18000
Estimated coefficients = 20 Number of groups = 4500
Estimated Le (GR) = 1 Time periods: min = 4
Hansen chi2(20) = 28.7677 avg = 4.0
Prob > chi2 = 0.0924 max = 4
Wald chi2(20) = 564404.01
BIC = -54.4784 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
lcons | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
lcons |
L1. | .4045593 .0475516 8.51 0.000 .3113599 .4977587
|
price | -.1847354 .0350414 -5.27 0.000 -.2534153 -.1160555
rain | -.0127807 .0062068 -2.06 0.039 -.0249457 -.0006156
temp | .0500874 .009904 5.06 0.000 .030676 .0694989
------------------------------------------------------------------------------
. * Best-Subset Selection: column M1_c of table 1 in Juodis and Sarafidis (2022)
. xtgmmfa l(0/1).lcons price rain temp, gmm(l.lcons l.price rain temp) unof(smi, bss ty
> pe(1) lmax(4)) nocons wmat(1)
Fixed-T Factor-Augmented Panel Data Regression
Estimator: Asymptotically linear twostep GMM
Method: Best-Subset Selection (BSS)
Reference: Juodis & Sarafidis (2022)
Number of instruments = 40 Number of obs = 18000
Estimated coefficients = 20 Number of groups = 4500
Selected Le (BIC) = 1 Time periods: min = 4
Hansen chi2(20) = 28.7092 avg = 4.0
Prob > chi2 = 0.0936 max = 4
Wald chi2(20) = 705626.41
BIC = -54.5369 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
lcons | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
lcons |
L1. | .4136405 .0478182 8.65 0.000 .3199185 .5073625
|
price | -.1779012 .0348845 -5.10 0.000 -.2462735 -.1095289
rain | -.0125454 .0063494 -1.98 0.048 -.02499 -.0001009
temp | .0499224 .0100406 4.97 0.000 .0302433 .0696016
------------------------------------------------------------------------------
All feedback/bug reports/code improvements are greatly appreciated.
Author: Manh Hoang Ba, Eureka Uni Team, VN. https://manhb94econometrics.wordpress.com/
Support: [email protected]
References:
- Juodis, A., & Sarafidis, V. (2022). A linear estimator for factor-augmented fixed-T panels with endogenous regressors. Journal of Business & Economic Statistics, 40(1), 1-15.
- Windmeijer, F. (2005). A finite sample correction for the variance of linear efficient two-step GMM estimators. Journal of econometrics, 126(1), 25-51.

Comment