DPredict · Guide test 217
Levin–Lin–Chu test
Tests a panel unit root null under a common autoregressive parameter restriction.
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 = Levin–Lin–Chu.
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 · Levin–Lin–Chu test
0: every unit has a unit root (H₀ of the unit-root tests).
Your data
Simulated with known truth8 series of length 100: 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 t* 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 = .003).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- pooled coefficient of the normalized level residuals
- mean ratio of long-run to short-run SDs
- Levin, Lin & Chu's mean and SD adjustments
The verdict
t* = −2.73, p = .003
p ≤ α = .050: reject H₀
The alternative is homogeneous: every unit stationary with the same ρ. Cross-sectional dependence distorts it (see CIPS). Its adjustments are asymptotic: short series (T below about 100) over-reject.
- Statistic
- −2.733
- p-value
- 0.0031
Levin–Lin–Chu test on 8 series of length 100, 4 stationary: t* = −2.73, p = .003. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: every panel unit has a unit root; H1: a common stationary autoregressive coefficient.
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
ρ is common; nuisance lag dynamics and variances can differ. Remove individual lag/deterministic effects, standardize residuals, pool the lagged-level coefficient, then apply LLC bias/scale corrections using long-run variance ratios and tabulated moments.
Structure of the method
Residualize individual differenced and lagged-level series against selected deterministic terms and lagged differences, standardize their innovations, pool the lagged-level relationship, and apply LLC bias and scale corrections. The corrections are essential: an ordinary pooled regression t statistic is not the LLC test.
Estimated and nuisance parameters
Estimate a common level-feedback coefficient under the alternative, unit-specific short-run dynamics, deterministic effects, residual variances, and long-run variance ratios used by the correction. Common persistence is a restriction of this model; heterogeneous nuisance coefficients do not mean the tested autoregressive coefficient is unrestricted across units.
Settings and design choices
Select intercept/trend specification, lag order or information criterion, maximum lags, long-run variance bandwidth, and any cross-sectional demeaning. More lags reduce residual dependence but consume short panels. Removing cross-sectional means changes the data but does not establish robustness to arbitrary common-factor dependence.
Fitting and adaptation
Refit all auxiliary regressions when changing deterministic terms, lag selection, or sample coverage; there are no pretrained weights. Use software-supported balanced-panel and time-length conventions, and retain the correction appropriate to those choices. Report the panel dimensions and effective observations after lagging, rather than only the original row count.
Sensitivity and robustness
Assess common shocks, coefficient heterogeneity, short time spans, and structural breaks. Rejection supports the specified common-stationary alternative; it is not an estimate of which units are stationary. A rejection from dependence-driven size distortion is not repaired by a larger cross-sectional sample.
How to use and calibrate
Use the corrected standard normal negative tail; uncorrected pooled t is not LLC.
Example application
Test a panel for a common persistence departure from unit roots.
Interpretation and pitfalls
Watch out
Cross-sectional dependence and heterogeneous stationary coefficients can undermine the test. Rejection is conditional on the common-coefficient alternative.
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="levinlin",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="levinlin",exo="intercept",lags=1))
Output
Levin-Lin-Chu Unit-Root Test (ex. var.: Individual Intercepts) data: X z = -1.7209, p-value = 0.04263 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 217, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT217.