DPredict · Guide test 218
Im–Pesaran–Shin test
Combines individual unit root statistics while allowing heterogeneous autoregressive parameters.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Panel unit-root tests — Across many units (countries, stores, firms), do the series have unit roots — or are some or all of them stationary?
In Panel unit-root tests, choose Test = Im–Pesaran–Shin W_t̄.
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Im–Pesaran–Shin test
0: every unit has a unit root (H₀ of the unit-root tests).
Your data
Simulated with known truth8 series of length 40: 4 stationary (solid) and 4 with a unit root (dashed). Stationary units keep returning to their own level; random walks drift away.
If H₀ were true
- The reference: how z varies across samples when H₀ is true (normal approximation).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = < .001).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- ADF t ratio of unit i (intercept, 1 lag)
- units and periods
- Im, Pesaran & Shin's tabulated moments
The verdict
W_t̄ = −3.66, z = −3.66, p < .001
p ≤ α = .050: reject H₀
Rejecting says some units are stationary, not which or how many.
- Statistic
- −3.662
- p-value
- 0.0001
Im–Pesaran–Shin test on 8 series of length 40, 4 stationary: W_t̄ = −3.66, z = −3.66, p < .001. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: all units have unit roots; H1: a positive fraction are stationary.
Assumptions
A panel with explicitly modeled individual deterministic terms and sufficient time observations. First-generation panel unit-root tests generally assume cross-sectional independence; lag lengths and balance conventions matter.
Formula
Parameters and notation
ti are individual ADF t statistics; null moments depend on time length, lags and deterministic terms.
Structure of the method
Fit a separate ADF regression to each panel unit, collect unit-specific unit-root t statistics, average them, and apply the appropriate null-moment standardization or tabulated t-bar calibration. This architecture deliberately retains heterogeneous autoregressive alternatives instead of pooling all units into one persistence coefficient.
Estimated and nuisance parameters
Estimate each unit’s short-run lag coefficients, deterministic terms, innovation scale, and autoregressive coefficient. Null centering/scaling moments depend on the selected statistic, effective time lengths, and lag configuration; they are calibration inputs, not additional freely optimized coefficients selected to improve significance.
Settings and design choices
Choose the IPS variant, deterministic specification, individual versus common lags, selection criterion, and balancing convention. Increasing lag allowance reduces omitted autocorrelation but can substantially degrade power in short panels. The unstandardized t-bar and standardized W/Z variants are not interchangeable outputs.
Fitting and adaptation
Re-estimate individual regressions when adapting to a changed panel or frequency. For any bootstrap extension, preserve the intended dependence structure and repeat lag selection when its randomness is part of the inference. If common factors dominate, use an appropriate cross-section-augmented alternative rather than attaching an iid IPS p value to dependent data.
Sensitivity and robustness
Inspect unit-specific results, missingness patterns, lag lengths, common shocks, and how a few strongly stationary units affect the average. Rejection means evidence against all-unit unit roots under the stated alternative; it does not establish that every series is stationary or justify identical subsequent transformations.
How to use and calibrate
Use the standardized IPS normal negative tail or its tabulated t-bar version.
Example application
Allow heterogeneous persistence across panel units.
Interpretation and pitfalls
Watch out
Rejection does not mean every unit is stationary. Cross-unit dependence invalidates naive independent-unit standardization.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Columns are panel units and rows time. Cross-sectional independence and the chosen common/heterogeneous dynamics matter; Hadri reverses the null to stationarity. Choi is represented by the inverse-normal member.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: plm
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
X<-replicate(15,cumsum(rnorm(60)));print(plm::purtest(X,test="ips",exo="intercept",lags=1))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Validated — Executed successfully in the validation environment · needs plm
set.seed(2026)
X<-replicate(15,cumsum(rnorm(60)));print(plm::purtest(X,test="ips",exo="intercept",lags=1))
Output
Im-Pesaran-Shin Unit-Root Test (ex. var.: Individual Intercepts) data: X Wtbar = -1.5713, p-value = 0.05806 alternative hypothesis: stationarity
Sources
- plm — plm · purtestAuthor documentation/source reviewed: plm 2.6-7.search.r-project.org
- purtestsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 218, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT218.