The purpose of this package is to perform the Panel Analysis of Nonstationarity in Idiosyncratic and Common Components from Bai and Ng (2004,2010). When working with large dimensional panels, standard pooled and aggregated nonstationarity tests tend to over-reject null hypothesis due to:
Instead of testing the data directly, PANIC performs a factor model to derive the common and idiosyncratic components of the panel. By using the BIC3 from Bai and Ng (2004) it is possible to determine the number of common components in panels that reduce cross correlation in the error term. In this vignette we will perform PANIC on three aggregate levels of National Income and Product Accounts in order to test these aggregates for aggregation bias
This vignette will use the functions panic10()
and panic04()
availabe through library(PANICr)
. These functions perform a factor model on each level of aggregation, derive the common and idiosyncratic components, and then perform several pooled test statistics. One of several benefits of PANIC is that by reducing cross-correlation we allow valid pooling of individual statistics and so panel tests can be run that have reasonable strength. Performing the factor analysis using BIC3, the criteria for determining the number of factors in our approximate factor model, allows us to determine whether the nonstationarity is pervasive, variable specific, or both.
The data we use is gathered from the Price Indexes for Personal Consumption Expenditures by Type of Product available from the BEA. The data is monthly from 1959 to 20131. At this point we run the data through X-132. After extracting each sector we divide them up into three seperate levels of aggregation from highest level of aggregation to lowest. To turn this dataset into year on year inflation we perform \(log(p_{t}/p_{t-12})\). The data is available already cleaned and manipulated as NIPAagg1, NIPAagg2, and NIPAagg3, respectivly.
Consider a factor analytic model:
\(X_{it} = D_{it} + \lambda_{i}' F_{t} + e_{it}\)
Where \(D_{it}\) is a polynomial trend function, \(F_{t}\) is an \(r\times{1}\) vector of common factors, and \(\lambda_{i}\) is a vector of factor loadings. The panel \(X_{it}\) is the sum of a deterministic component \(D_{it}\) , a common component \(\lambda_{i}' F_{t}\), and an error \(e_{it}\) that is largely idiosyncratic. A factor model with \(N\) variables has \(N\) idiosyncratic components, but a smaller number of common factors. \(D_{it}\) can be modeled by \(P\). In PANIC 2004, When the number of common factors is greater than one, \(P=1\) and the deterministic trend has an individual specific fixed effect and time trend. When the number of common factors is equal to one, \(P=0\) is an individual specific fixed effect. When the number of common factors is zero, \(P=0\) is neither.
PANIC 2010 examines the data with ADF models A, B, and C. A assumes no deterministic componet, B assumes a constant to allow for a fixed effect, and C allows a constant and a trend. Note that this is different than P as P is a data generating process while Models A, B, and C impose these constraints inside of the ADF test.
The benefit of this factor model is that, if the number of factors has been correctly determined, the error term will be largely idosyncratic and the common components will explain the largest variance of the data. To determine the approximate number of factors we use the BIC3 from Bai and Ng (2002) such that:
\(BIC3 = V(k,\hat{F}^k)+k\hat{\sigma}^2 + \frac{(N+T-k)ln(NT)}{NT}\)
\((k,\hat{F}^k)\) is the average residual variance when k factors are assumed for each cross-section unit. \(\hat{\sigma}^2\) is the mean of the error term squared over N and T.
Once we have this model we perform ADF style pooled tests on the idiosyncratic and common components. panic04
and panic10
ask for nfac, the number of estimated factors, k1, the maximum lag allowed in the ADF test, and jj, the criteria to determine the number of factors in our approximate factor model. nfac is weak to underestimation so it is suggested to overestimate the number of factors. To determine the lag of the ADF test Bai and Ng (2002) suggest \(4(\sqrt{\frac{T}{100}})\). jj is an Integer 1 through 8. Choices 1 through 7 are respectively, IC(1), IC(2), IC(3), AIC(1), BIC(1), AIC(3), and BIC(3), respectively. Choosing 8 makes the number of factors equal to the number of columns whose sum of eigenvalues is less than or equal to .5. panic10()
also has the option to run models on demeaned or non-demeaned data (TRUE or FALSE) which will return models A and B in the first case and C in the second.
With this information it is now appropriate to start running our tests.
library(PANICr)
data(NIPAagg1)
data(NIPAagg2)
data(NIPAagg3)
agg1.04 <- panic04(NIPAagg1,12,7,8)
Test | Values | |
---|---|---|
Pooled Demeaned | 151.287625586434 | 18.3723862242089 |
Pooled Idiosyncratic | 131.157425663919 | 15.4668421381828 |
Pooled Cointegration test | 197.117010015667 | 24.9872880834621 |
-5.719374 -4.345388
agg2.04 <- panic04(NIPAagg2,12,7,8)
-6.281520 -5.915479 -4.683622
Test | Values | |
---|---|---|
Pooled Demeaned | 611.71868977349 | 38.8866151821883 |
Pooled Idiosyncratic | 522.753968510507 | 32.2555763707432 |
Pooled Cointegration test | 490.814016498057 | 29.8749129074792 |
agg3.04 <- panic04(NIPAagg3,12,7,8)
Test | Values | |
---|---|---|
Pooled Demeaned | 2115.1699605466 | 73.452641227304 |
Pooled Idiosyncratic | 1717.95911237424 | 57.3436141575353 |
Pooled Cointegration test | 2799.94347308076 | 101.223874316303 |
-5.935561 -6.873747 -7.459283 -7.441815 -6.793798 -4.670801 -5.780318 -8.341453 -7.701933
agg1.10.d <- panic10(NIPAagg1,12,7,8,TRUE)
Pool Test | P | MP Test | Model C |
---|---|---|---|
Pa | -7.63651881335912 | ta | -0.467619458642501 |
Pb | -4.05999136202944 | tb | -0.317062025430413 |
PMSB | rho1 | 04 Pool LM |
---|---|---|
-2.143561 | 0.9994772 | 11.49549 |
agg2.10.d <- panic10(NIPAagg2,12,7,8,TRUE)
Pool Test | P | MP Test | Model C |
---|---|---|---|
Pa | -23.384118727417 | ta | -2.07060482650457 |
Pb | -10.0792738880704 | tb | -1.06027699291859 |
PMSB | rho1 | 04 Pool LM |
---|---|---|
-4.2875 | 0.998678 | 27.72071 |
agg3.10.d <- panic10(NIPAagg3,12,7,8,TRUE)
Pool Test | P | MP Test | Model C |
---|---|---|---|
Pa | -36.7995444340426 | ta | -3.4444255000788 |
Pb | -15.0178637121261 | tb | -1.58906392647526 |
PMSB | rho1 | 04 Pool LM |
---|---|---|
-6.039356 | 0.998452 | 52.06343 |
agg1.10.nd <- panic10(NIPAagg1,12,7,8,FALSE)
MP | Model A | Model B |
---|---|---|
ta | -18.6986081207265 | 0.496952725573856 |
tb | -5.83235690939432 | 0.242043809710246 |
PMSB | rho1 | 04 Pool ADF |
---|---|---|
-2.088406 | 1.000497 | 14.97401 |
agg2.10.nd <- panic10(NIPAagg2,12,7,8,FALSE)
MP | Model A | Model B |
---|---|---|
ta | -41.6496402167829 | -0.687013376283987 |
tb | -11.6726242443272 | -0.243108562817226 |
PMSB | rho1 | 04 Pool ADF |
---|---|---|
-3.752921 | 0.9996068 | 30.84134 |
agg3.10.nd <- panic10(NIPAagg3,12,7,8,FALSE)
MP | Model A | Model B |
---|---|---|
ta | -55.4162521481366 | -2.29876504766966 |
tb | -15.7271993582764 | -0.714690391494631 |
PMSB | rho1 | 04 Pool ADF |
---|---|---|
-5.146306 | 0.9990782 | 57.71948 |