Thanks to Kit Baum a new package is available: xtnumfac. You call install it by typing ssc install xtnumfac
xtnumfac is joint work with Simon Reese.
xtnumfac estimates the number of common factors in panel datasets using the methods of Bai and Ng (2002), Ahn and Horenstein (2013) Onatski (2010) and Gagliardini et al. (2019). The methods in Bai and Ng (2002) are based on six information criteria, while Ahn and Horenstein (2013) propose two estimation methods. Onatski (2010) and Gagliardini et al. (2019) contribute a single estimator each. In total 10 different methods are displayed.
The program requires the data to be xtset.
Syntax
The Syntax is very simple
Options allow to set the number of maximum factors, display different degree of detail and different forms of standardisation.
Example
We can use the Stata's own pennxrate dataset and estitimate the number of common factors in the real exchange rate:
xtnumfac is joint work with Simon Reese.
xtnumfac estimates the number of common factors in panel datasets using the methods of Bai and Ng (2002), Ahn and Horenstein (2013) Onatski (2010) and Gagliardini et al. (2019). The methods in Bai and Ng (2002) are based on six information criteria, while Ahn and Horenstein (2013) propose two estimation methods. Onatski (2010) and Gagliardini et al. (2019) contribute a single estimator each. In total 10 different methods are displayed.
The program requires the data to be xtset.
Syntax
The Syntax is very simple
Code:
xtnumfac [varname] [if] [in] [, options]
Example
We can use the Stata's own pennxrate dataset and estitimate the number of common factors in the real exchange rate:
Code:
webuse pennxrate
xtnumfac realxrate
Estimated number of common factors in realxrate
N = 151
T = 34
-------------------------------------------------
IC | # factors | IC | # factors
----------+-------------+----------+-------------
PC_{p1} | 8 | IC_{p1} | 8
PC_{p2} | 8 | IC_{p2} | 8
PC_{p3} | 8 | IC_{p3} | 8
ER | 1 | GR | 2
GOL | 1 | ED | 3
-------------------------------------------------
8 factors maximally considered.
PC_{p1},...,IC_{p3} from Bai and Ng (2002)
ER, GR from Ahn and Horenstein (2013)
ED from Onatski (2010)
GOL from Gagliardini, Ossola, Scaillet (2019)

Comment