Title

xtpanic methods -- Methods and formulas for xtpanic

Factor model

PANIC assumes the differenced data follow an approximate factor model,
dXt = L Ft + et, where Ft are r common factors,
L the loadings, and et idiosyncratic errors. For the trend model
the differences are demeaned first. Factors and loadings are estimated by
principal components: with the T x N matrix of (demeaned) differences X, an
eigen-decomposition of X'X (or XX' when T<N) gives the loadings from the largest
r eigenvectors, F-hat = X L / N, and the idiosyncratic residuals
e-hat = X - F-hat L'.

Number of common factors (Bai-Ng 2002)

For k = 1..kmax, let V(k) be the average residual sum of squares from the k-factor
fit. The information criterion (ICp, the default) minimizes
ln V(k) + k (N+T)/(NT) ln(min(N,T)) over k; PCp and AIC/BIC variants are also
available. The reported number of factors is the minimizer (ICp2).

Idiosyncratic ADF

The idiosyncratic residuals are cumulated, Eit = sum_ e-hatis,
and an augmented Dickey-Fuller regression without deterministic terms is run
for each unit:

dEit = rho Ei,t-1 + sum_j cj dEi,t-j + uit.

The reported statistic is the t-ratio on rho; the lag order is chosen by AIC,
SIC, or a general-to-specific t-test (default). Because the deterministics have
been removed by the factor/differencing step, the limiting distribution is the
Dickey-Fuller no-constant distribution for both the constant and trend
models (Bai and Ng 2004). p-values use the finite-sample response surface
CV(p,T) = c1 + c2/T + c3/T^2 with a nearest-critical-value lookup.

Pooled panel tests

The individual p-values pi are combined into the Fisher-type statistics

P = -2 sum ln(pi) ~ chi-square(2N),

Pm = ( -2 sum ln(pi) - 2N ) / sqrt(4N) ~ N(0,1).

Both reject the unit-root null for large values.

Step-to-code map

computation

principal-components factors Mata _xtp_pca

number of factors (Bai-Ng 2002 IC) Mata _xtp_fnumber

idiosyncratic ADF (no deterministics) Mata _xtp_adfnc / _xtp_getlag

DF-no-constant p-value (response surface) Mata _xtp_pval

pooled P and Pm Mata _xtp_run

Each block reproduces the corresponding GAUSS procedure in BNG_PANIC
(TSPDLIB); the statistics and p-values match Table 3 of Nazlioglu et al. (2023)
(the healthcare-expenditure application) to the last reported digit.

Reference

Bai, J., and S. Ng. 2004. A PANIC attack on unit roots and cointegration.
Econometrica 72: 1127-1177.

Back to xtpanic | xtflexur library