Description
xtwals computes the WALS estimates of fixed-effects and random-effects panel-data models with either i.i.d. or AR(1) errors.
The fixed-effects approach is motivated by the fact that the WALS estimator satisfies the Frisch-Waugh-Lovell theorem when the individual effects are treated as (nuisance) focus parameters. Thus, as with the classical fixed-effects estimator, WALS can be applied to the familiar within-transformed data to eliminate the individual effects.
The random-effects WALS estimator relies on a feasible generalized least squares (FGLS) approach. We first estimate the variance components using the unrestricted model. We then apply WALS to an FGLS transformation of the data, which adjusts for the stable equicorrelation of the one-way errors within each unit over time.
In addition to the basic setup with i.i.d. errors, we also incorporate the FGLS transformations proposed by Bhargava, Franzini, and Narendranathan (1982) and Baltagi and Wu (1999) to handle an extended framework for fixed-effects and random-effects models in which the errors follow a stationary AR(1) process and observations may be unequally spaced over time.
Help files
After installation, you can view the estimation options by typing in Stata
help xtwals
and the post-estimation options by typing
help xtwals postestimation
Key references (in chronological order)
Bhargava, A., Franzini, L., and Narendranathan, W. (1982). Serial correlation and the fixed effects model. Review of Economic Studies, 49, 533-549.
Baltagi, B. H., and Wu, P. X. (1999). Unequally spaced panel data regressions with AR(1) disturbances. Econometric Theory, 15, 814-823.
Magnus, J. R., Wan, A. T. K., and Zhang, X. (2011). Weighted average least squares estimation with nonspherical disturbances and an application to the Hong Kong housing market. Computational Statistics & Data Analysis, 55, 1331-1341.
De Luca, G., and Magnus, J. R. (2025a). Weighted-average least squares estimation of panel data models. In: M. Arashi, A., and Norouzirad, M. (eds), Advances in Shrinkage and Penalized Estimation Strategies: Honoring the Contributions of A. K. Md. Ehsanes Saleh, Emerging Topics in Statistics and Biostatistics. Springer, New York.
De Luca, G., and Magnus, J. R. (2025c). Weighted-average least squares: Beyond the simple linear regression model. The Stata Journal, 25(4), 1-40.