{smcl} {* 23jul2026}{...} {vieweralsosee "xtpanic" "help xtpanic"}{...} {vieweralsosee "xtflexur (library)" "help xtflexur"}{...} {viewerjumpto "Factor model" "xtpanic_methods##model"}{...} {viewerjumpto "Number of factors" "xtpanic_methods##nf"}{...} {viewerjumpto "Idiosyncratic ADF" "xtpanic_methods##adf"}{...} {viewerjumpto "Pooled tests" "xtpanic_methods##pool"}{...} {viewerjumpto "Step-to-code map" "xtpanic_methods##map"}{...} {title:Title} {phang} {bf:xtpanic methods} {hline 2} Methods and formulas for {helpb xtpanic} {marker model}{...} {title:Factor model} {pstd} PANIC assumes the differenced data follow an approximate factor model, {it:dX{sub:t} = L F{sub:t} + e{sub:t}}, where {it:F{sub:t}} are r common factors, {it:L} the loadings, and {it:e{sub:t}} 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