Title: | Estimate the Number of Factors in Large Nonstationary Datasets |
---|---|
Description: | Large panel data sets are often subject to common trends. However, it can be difficult to determine the exact number of these common factors and analyse their properties. The package implements the Barigozzi and Trapani (2022) <doi:10.1080/07350015.2021.1901719> test, which not only provides an efficient way of estimating the number of common factors in large nonstationary panel data sets, but also gives further insights on factor classes. The routine identifies the existence of (i) a factor subject to a linear trend, (ii) the number of zero-mean I(1) and (iii) zero-mean I(0) factors. Furthermore, the package includes the Integrated Panel Criteria by Bai (2004) <doi:10.1016/j.jeconom.2003.10.022> that provide a complementary measure for the number of factors. |
Authors: | Paul Haimerl [aut, cre] |
Maintainer: | Paul Haimerl <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.10.3 |
Built: | 2024-11-27 06:47:09 UTC |
Source: | CRAN |
Calculates the Integrated Panel Criteria (IPC) to estimate the total number of common trends in a nonstationary panel as proposed by Bai (2004).
BaiIPC(X, r_max = 10)
BaiIPC(X, r_max = 10)
X |
a |
r_max |
the maximum number of factors to consider. Default is 10. |
For further details on the three criteria and their respective differences, I refer to Bai (2004, sec. 3).
A vector of the estimated number of factors for each of the three criteria.
Paul Haimerl
Bai, J. (2004). Estimating cross-section common stochastic trends in nonstationary panel data. Journal of Econometrics, 122(1), 137-183. doi:10.1016/j.jeconom.2003.10.022
# Simulate a nonstationary panel X <- sim_DGP(N = 100, n_Periods = 200) # Obtain the estimated number of common factors pre criterion BaiIPC(X = X, r_max = 10)
# Simulate a nonstationary panel X <- sim_DGP(N = 100, n_Periods = 200) # Obtain the estimated number of common factors pre criterion BaiIPC(X = X, r_max = 10)
Runs the testing routine proposed in Barigozzi & Trapani (2022) to estimate the number and types of common trends in a nonstationary panel.
The method can identify the existence of a common factor subject to a linear trend, as well as the number of zero-mean and zero-mean
factors.
BTtest(X, r_max = 10, alpha = 0.05, BT1 = TRUE, R = NULL)
BTtest(X, r_max = 10, alpha = 0.05, BT1 = TRUE, R = NULL)
X |
a |
r_max |
the maximum number of factors to consider. Default is 10. Note that changing |
alpha |
the significance level. Default is 0.05. |
BT1 |
logical. If |
R |
the number of draws from an i.i.d. standard normal random variable that constructs the randomized test statistic. If |
For details on the testing procedure I refer to Barigozzi & Trapani (2022, sec. 4).
A vector with the estimated number of (i) factors with a linear trend (), (ii) zero-mean
factors (
) and (ii) zero-mean
factors (
).
Paul Haimerl
Barigozzi, M., & Trapani, L. (2022). Testing for common trends in nonstationary large datasets. Journal of Business & Economic Statistics, 40(3), 1107-1122. doi:10.1080/07350015.2021.1901719
# Simulate a nonstationary panel X <- sim_DGP(N = 100, n_Periods = 200) # Obtain the estimated number of factors (i) with a linear trend (r_1), (ii) zero-mean I(1) (r_2) # and (iii) zero-mean I(0) (r_3) BTtest(X = X, r_max = 10, alpha = 0.05, BT1 = TRUE)
# Simulate a nonstationary panel X <- sim_DGP(N = 100, n_Periods = 200) # Obtain the estimated number of factors (i) with a linear trend (r_1), (ii) zero-mean I(1) (r_2) # and (iii) zero-mean I(0) (r_3) BTtest(X = X, r_max = 10, alpha = 0.05, BT1 = TRUE)
Simulate a nonstationary panel as laid out in Barigozzi & Trapani (2022, sec. 5).
sim_DGP( N = 100, n_Periods = 200, drift = TRUE, drift_I1 = TRUE, r_I1 = 2, r_I0 = 1, return_factor = FALSE )
sim_DGP( N = 100, n_Periods = 200, drift = TRUE, drift_I1 = TRUE, r_I1 = 2, r_I0 = 1, return_factor = FALSE )
N |
the number of cross-sectional units. |
n_Periods |
the number of simulated time periods. |
drift |
logical. If |
drift_I1 |
logical. If |
r_I1 |
the total number of non zero-mean I(1) factors (corresponding to r_2 + r_1 * d_2). |
r_I0 |
the total number of non zero-mean I(0) factors (corresponding to r_3 + r_1 * (1 - d_2)). |
return_factor |
logical. If |
For further details on the construction of the DGP, see Barigozzi & Trapani (2022, sec. 5).
A (T x N) matrix of simulated observations. If return_factor = TRUE
, a (N x r) matrix of factors.
Paul Haimerl
Barigozzi, M., & Trapani, L. (2022). Testing for common trends in nonstationary large datasets. Journal of Business & Economic Statistics, 40(3), 1107-1122. doi:10.1080/07350015.2021.1901719
# Simulate a panel containing a factor with a linear drift (r_1 = d_1 = 1) and I(1) process # (d_2 = 1), one zero-mean I(1) factor (r_2 = 1) and two zero-mean I(0) factors (r_3 = 2) X <- sim_DGP(N = 100, n_Periods = 200, drift = TRUE, drift_I1 = TRUE, r_I1 = 2, r_I0 = 2) # Simulate a panel containing only 3 common zero-mean I(0) factor (r_1 = 0, r_2 = 0, r_3 = 3) X <- sim_DGP(N = 100, n_Periods = 200, drift = FALSE, drift_I1 = TRUE, r_I1 = 0, r_I0 = 3)
# Simulate a panel containing a factor with a linear drift (r_1 = d_1 = 1) and I(1) process # (d_2 = 1), one zero-mean I(1) factor (r_2 = 1) and two zero-mean I(0) factors (r_3 = 2) X <- sim_DGP(N = 100, n_Periods = 200, drift = TRUE, drift_I1 = TRUE, r_I1 = 2, r_I0 = 2) # Simulate a panel containing only 3 common zero-mean I(0) factor (r_1 = 0, r_2 = 0, r_3 = 3) X <- sim_DGP(N = 100, n_Periods = 200, drift = FALSE, drift_I1 = TRUE, r_I1 = 0, r_I0 = 3)