*! version 1.3.0 11mar2026

Title

urstat -- Comprehensive Unified Unit Root & Stationarity Testing

Syntax

urstat
varlist
[if] [in]
[,
options]

varlist must contain time-series variables. Data must be tsset before
running urstat. Multiple variables are tested simultaneously and results
are displayed in aligned, publication-ready tables.

Test Selection
test(testlist) tests to run; default is ALL; individual tests:
ADF PP KPSS ZA CLEMAO1 CLEMAO2 CLEMIO1 CLEMIO2 ERS BSRW KM

none include "no constant, no trend" (None) specification column in Table 1

strategy show Elder-Kennedy decision summary (Tables 5 & 6)

ADF / PP / ERS Options
maxlag(#) maximum lag order for ADF information-criterion lag selection; default is 12

crit(string) information criterion for lag selection: BIC (default), AIC, or SIC (alias for BIC)

pplag(#) Phillips-Perron Newey-West bandwidth (truncation lag); default is 4

ersmethod(string) ERS/DF-GLS lag selection method: SIC (default), AIC, FIX, GTS05, GTS10

Structural Break Options
ztrim(#) Zivot-Andrews trimming proportion (fraction of sample excluded from each end); default is 0.15

clemtrim(#) Clemente-Montanes-Reyes trimming fraction; default is 0.05

clemmaxlag(#) Clemente maximum lag order; default is 12

Bootstrap Options
bsreps(#) number of bootstrap replications for bsrwalkdrift; default is 500. Higher values increase accuracy but slow computation

KM Test Options
kmlags(#) AR lags for Kobayashi-McAleer test; default is 0

nodrift use U1/U2 test statistics (no drift) instead of V1/V2 (with drift). Use when the series is believed to have no drift component

Display Options
nostars suppress significance stars (***, **, *) from all tables

level(#) significance level for confidence intervals; default is 95

title(string) custom title for Table 1 header

Graph Options
graph produce and export PNG visualizations for each variable (time series panels, ACF/PACF correlograms, structural break plots, integration order bar chart)

graphdir(string) output directory for PNG files; default is urstat_graphs. Directory is created if it does not exist

Description

urstat performs comprehensive unit root and stationarity testing on one or
more time series variables simultaneously. It produces up to six
publication-quality tables and optional high-resolution PNG graphs, consolidating
the most widely used tests into a single command.

All tests are applied at Level, First Difference, and Second Difference
to determine the integration order of each variable.

The following tests are supported:

Test Null Hypothesis

ADF Augmented Dickey-Fuller: H0 = unit root (non-stationary)

PP Phillips-Perron: H0 = unit root (non-stationary)

KPSS Kwiatkowski et al.: H0 = stationarity (opposite null!)

ZA Zivot-Andrews: H0 = unit root with structural break

CLEMAO1/AO2 Clemente AO: H0 = unit root with 1 or 2 additive outlier breaks

CLEMIO1/IO2 Clemente IO: H0 = unit root with 1 or 2 innovational outlier breaks

ERS/DF-GLS Elliott-Rothenberg-Stock: H0 = unit root (more powerful than ADF)

BSRW Bootstrap Random Walk: H0 = random walk with drift

KM Kobayashi-McAleer: tests linear vs logarithmic transformation

Important: ADF, PP, ERS, ZA, Clemente, and BSRW test the null of a unit root
(non-stationarity). KPSS tests the opposite null: stationarity. This means:

- ADF/PP/ERS/ZA/BSRW: Reject H0 => series is stationary

- KPSS: Reject H0 => series is non-stationary (has unit root)

Using both types together provides confirmatory evidence: if ADF rejects (stationary)
and KPSS fails to reject (stationary), you have strong evidence of stationarity.

Output Tables

Table 1. Standard Unit Root Tests (ADF / PP / KPSS)

Shows test statistics for each variable across three blocks: Level,
1st Difference, and 2nd Difference. Within each block, columns show
results under different deterministic specifications:

Const — constant only (intercept)

Const+Trend — constant plus linear time trend

None — no deterministic terms (only shown with none option)

Panel A (ADF): Test statistics with p-values (MacKinnon, 1996) in parentheses.
Lags selected automatically via BIC or AIC.

Panel B (PP): Phillips-Perron statistics with p-values. Uses Newey-West
bandwidth set by pplag().

Panel C (KPSS): KPSS statistics compared to asymptotic critical values
(no p-values available). Stars indicate rejection of the stationarity null.

KPSS critical values (5% level): Constant = 0.463; Constant+Trend = 0.146.

Table 2. Structural Break Tests (ZA / Clemente)

Shows structural break test statistics with estimated break dates in brackets
for Level, 1st Difference, and 2nd Difference. Three rows per variable
(L., d., d2.).

ZA columns: Zivot-Andrews test under two models:

ZA(Intercept) — Model A: allows break in intercept only

ZA(Both) — Model C: allows break in both intercept and trend

Clemente columns: Four variants:

ClemAO1/AO2 — Additive Outlier model with 1 or 2 breaks

ClemIO1/IO2 — Innovational Outlier model with 1 or 2 breaks

ZA critical values (5%): Intercept(Model A) = -4.80; Both(Model C) = -5.08.

Clemente critical values (5%): AO1 = -3.56; IO1 = -4.27; AO2/IO2 = -5.49.

Interpretation: If ZA rejects at level, the apparent unit root in ADF may be
due to a structural break rather than genuine non-stationarity. The series may
actually be stationary around a broken trend.

Table 3. Advanced Tests (ERS / Bootstrap)

ERS/DF-GLS: Six columns organized in three blocks (Level | 1st Diff | 2nd Diff),
each with Const (C) and Const+Trend (C+T) specifications. The DF-GLS test is
generally more powerful than ADF against near-unit-root alternatives.

Bootstrap RW: Three columns (Level | 1st Diff | 2nd Diff). The bootstrap unit
root test of Park (2003) is nonparametric and robust to non-normal errors.

Table 4. Kobayashi-McAleer Test

Tests whether a series should be modeled in levels (linear) or in logarithms.
Only applies to strictly positive variables. Variables with zero or negative
values are automatically skipped.

Decision rule: Reject H0:Linear + Fail to reject H0:Log => use LOGS.
Reject H0:Log + Fail to reject H0:Linear => use LEVELS.

Table 5. Integration Order & Decision (Elder-Kennedy)

Implements the Elder & Kennedy (2001) three-step testing procedure with additional
confirmatory evidence from ERS and Zivot-Andrews tests.

Columns: ADF(L.ct), ADF(d.c), ADF(d2.c), PP(L.ct), KPSS(L.c), ERS(L.c),
ERS(d.c), ZA(L), Trend, Order, Process.

Elder-Kennedy Decision Steps:

Step 1. Test ADF with constant+trend at level. If rejected AND trend is
significant => Trend Stationary (TS). Treatment: detrend the series.

Step 2. If step 1 fails, test ADF with constant on 1st difference. If
rejected => I(1) Difference Stationary (DS). Treatment: first-difference.

Step 3. If step 2 fails, test ADF with constant on 2nd difference. If
rejected => I(2) DS. Treatment: difference twice.

Step 4. If all steps fail => I(>2). The series is non-stationary at
all tested orders. Consider fractional integration or additional differencing.

Table 6. Comprehensive Integration Order Summary

Shows the integration order decision from each test independently:

Column Description

ADF Integration order from ADF test (Level->D->D2)

PP Integration order from PP test (Level->D->D2)

KPSS Integration order from KPSS test (reversed null)

ERS Integration order from ERS/DF-GLS test

ZA Integration order from Zivot-Andrews test

Consensus Majority vote across all available tests (count/total)

Process Recommended treatment for the series

Possible outcomes per test:

TS = Trend Stationary. Series is stationary around a deterministic trend.
Treatment: detrend (regress on time trend and use residuals).

I(0) = Stationary. Series is stationary in levels with no trend.
Treatment: use directly, no transformation needed.

I(1) = Integrated of order 1. Series has one unit root.
Treatment: take first differences (D.variable).

I(2) = Integrated of order 2. Series has two unit roots.
Treatment: take second differences (D2.variable).

I(>2) = Non-stationary at any tested order. No amount of differencing
(up to 2) achieves stationarity.
Treatment: consider fractional integration, structural breaks, or
nonlinear models. This may indicate a misspecified model or explosive behavior.

Color coding in Stata output:

Green (result text) = TS or I(0) — stationary

Default text = I(1) — common for economic series

Red (error text) = I(2) or I(>2) — requires attention

How to Interpret Results

Reading Test Statistics

ADF, PP, ERS, ZA, Clemente (Null = unit root):

A more negative test statistic provides stronger evidence against the unit root
null. Compare to critical values or check p-values.

Reject H0 (p < 0.05 or stat < critical value) => series is stationary.

Fail to reject H0 => insufficient evidence; series may have a unit root.

KPSS (Null = stationarity):

A larger test statistic provides stronger evidence against the stationarity
null. Compare to critical values (no p-values available).

Reject H0 (stat > critical value) => series is non-stationary.

Fail to reject H0 => series is stationary (or insufficient evidence
against stationarity).

Significance Stars

*** = significant at 1% level (very strong evidence)

** = significant at 5% level (strong evidence)

* = significant at 10% level (weak evidence)

No star = not significant (fail to reject null)

For KPSS, stars indicate rejection of the stationarity null, meaning the
series appears non-stationary. This is the opposite interpretation from ADF/PP.

Confirmatory Analysis Strategy

The recommended workflow is:

1. Run ADF and PP as primary unit root tests.

2. Use KPSS as confirmatory (opposite null hypothesis).

3. If ADF/PP and KPSS agree => strong conclusion.

4. If they disagree => series may be near the boundary; use ERS (more powerful)
and ZA (accounts for structural breaks) to resolve.

5. Table 6 consensus vote provides the final recommendation.

Common Scenarios

Scenario 1: All tests agree on I(1)

ADF=I(1), PP=I(1), KPSS=I(1), ERS=I(1), ZA=I(1) => Strong evidence of I(1).
First-difference the series before regression.

Scenario 2: ADF says I(1) but ZA says I(0)

The apparent unit root in ADF may be caused by a structural break.
The series may be stationary around a broken trend. Consider modeling with
break dummies instead of differencing.

Scenario 3: ADF says I(0) but KPSS rejects stationarity

Conflicting evidence. The series may be near the unit root boundary.
Check ERS for a more powerful result. Consider the sample size — short samples
reduce power of all tests.

Scenario 4: I(>2) for all tests

The series is not rendered stationary by first or second differencing.
Possible causes: explosive behavior, structural breaks, long memory (fractional
integration), or measurement issues. Check data for outliers or regime changes.

Graphs

When the graph option is specified, the following PNG files are exported
per variable to the directory specified by graphdir() (default: urstat_graphs/):

File Description

var_timeseries.png Three-panel plot: Level, 1st Diff, 2nd Diff

var_level_vs_diff.png Dual-axis overlay comparing Level and 1st Diff

var_correlogram.png ACF and PACF for Level and 1st Difference

var_structural_break.png Three-panel structural break plot with ZA break lines (Level, 1st Diff, 2nd Diff)

integration_order_summary.png Bar chart of integration orders (all variables)

Graphs also remain in Stata memory as named graphs (_urs_ts_*, _urs_cmp_*,
_urs_corr_*, _urs_brk_*, _urs_decision). Use graph display <name>
to re-display any graph.

Requirements & Installation

Required Stata Version

urstat requires Stata 14.0 or later. The data must be tsset before use.

Required User-Written Packages

urstat depends on several community-contributed packages. Missing packages
are detected automatically and a warning is displayed. Install them from SSC:

. ssc install kpss (KPSS stationarity test)

. ssc install zandrews (Zivot-Andrews structural break test)

. ssc install clemao_io (Clemente-Montanes-Reyes AO/IO tests)

. ssc install ersur (Elliott-Rothenberg-Stock DF-GLS test)

. ssc install kmtest (Kobayashi-McAleer linear vs log test)

The bsrwalkdrift package is from the Stata Journal and may need manual
installation. See https://www.stata-journal.com/.

Note: If a required package is not installed, urstat will display "N/A"
for that test and continue with the remaining tests. No error is thrown.

Warnings & Known Limitations

1. Small samples: All unit root tests have low power in small samples (T < 50).
Results should be interpreted with caution. The ERS/DF-GLS test is generally more
powerful than ADF in small samples.

2. KPSS no p-values: The KPSS test does not produce p-values. Compare the
test statistic to the critical values shown in the table footnotes. Stars are
assigned based on asymptotic critical values from Kwiatkowski et al. (1992).

3. Structural breaks: Standard ADF/PP tests are biased toward non-rejection
(finding unit roots) when the true DGP is stationary with structural breaks.
Always check ZA and Clemente results when ADF suggests a unit root.

4. Multiple testing: Running many tests increases the chance of conflicting
results. Table 6 uses majority voting to resolve conflicts, but the researcher
should exercise judgment, particularly weighting tests with better power properties
(ERS > ADF) and considering sample size.

5. Deterministic terms: The choice of deterministic specification (none, constant,
constant+trend) affects results. ADF with constant+trend has lower power when the
true DGP has no trend. Table 5 follows Elder-Kennedy's sequential procedure which
addresses this issue systematically.

6. Program caching: After editing the urstat.ado file, you must run
discard at the Stata command prompt to clear cached programs before
re-running urstat.

7. ZA break dates: The zandrews command returns an observation index
for the break date. urstat converts this to the time variable value. If the
break date appears empty, verify that the time variable is properly formatted.

8. Bootstrap computation time: The bsrwalkdrift test with bsreps(500)
can be slow for long series. Reduce bsreps() or omit BSRW from the
test list for faster execution.

Examples

Example 1: Full analysis with all tests and strategy decision:

. webuse lutkepohl2, clear

. tsset qtr

. urstat ln_inv ln_inc ln_consump, strategy

Example 2: All tests with graphs and custom output directory:

. urstat ln_inv ln_inc ln_consump, strategy graph graphdir("my_plots")

Example 3: ADF only with "None" deterministic specification:

. urstat ln_inv ln_inc, test(ADF) none

Example 4: Standard tests (ADF + PP + KPSS):

. urstat ln_inv ln_inc, test(ADF PP KPSS)

Example 5: Structural break tests only:

. urstat ln_inv, test(ZA CLEMAO1 CLEMAO2 CLEMIO1 CLEMIO2)

Example 6: KM transformation test for positive variables:

. urstat ln_inv ln_inc, test(KM) kmlags(2)

Example 7: Custom ADF settings (AIC criterion, max 8 lags):

. urstat ln_inv, test(ADF ZA) maxlag(8) crit(AIC) ztrim(0.10) strategy

Example 8: ERS test only with GTS method:

. urstat ln_inv ln_inc, test(ERS) ersmethod(GTS05)

Example 9: Quick test without significance stars:

. urstat ln_inv, test(ADF PP) nostars

Example 10: After running, re-display a saved graph:

. graph display _urs_decision

. graph display _urs_ts_ln_inv

References

Clemente, J., A. Montanes, and M. Reyes. 1998. Testing for a unit root in
variables with a double change in the mean. Economics Letters 59: 175-182.

Dickey, D.A. and W.A. Fuller. 1979. Distribution of the estimators for
autoregressive time series with a unit root. Journal of the American Statistical Association 74: 427-431.

Elder, J. and P.E. Kennedy. 2001. Testing for unit roots: What should
students be taught? Journal of Economic Education 32(2): 137-146.

Elliott, G., T.J. Rothenberg, and J.H. Stock. 1996. Efficient tests for
an autoregressive unit root. Econometrica 64(4): 813-836.

Kobayashi, M. and M. McAleer. 1999. Tests of linear and logarithmic
transformations for integrated processes. Journal of the American Statistical Association 94(447): 860-868.

Kwiatkowski, D., P.C.B. Phillips, P. Schmidt, and Y. Shin. 1992. Testing
the null hypothesis of stationarity against the alternative of a unit root.
Journal of Econometrics 54: 159-178.

MacKinnon, J.G. 1996. Numerical distribution functions for unit root and
cointegration tests. Journal of Applied Econometrics 11: 601-618.

Park, J.Y. 2003. Bootstrap unit root tests. Econometrica 71(6):
1845-1895.

Perron, P. and T.J. Vogelsang. 1992. Nonstationarity and level shifts with
an application to purchasing power parity. Journal of Business and Economic Statistics 10: 301-320.

Phillips, P.C.B. and P. Perron. 1988. Testing for a unit root in time
series regression. Biometrika 75: 335-346.

Zivot, E. and D.W.K. Andrews. 1992. Further evidence on the great crash,
the oil-price shock, and the unit-root hypothesis. Journal of Business and Economic Statistics 10: 251-270.

Author

Dr. Merwan Roudane

Email: merwanroudane920@gmail.com

Version: 1.3.0 (11 March 2026)

Required user-written commands:
kpss, zandrews, clemao1, clemao2, clemio1,
clemio2, ersur, bsrwalkdrift, kmtest.
Install from SSC: ssc install kpss, ssc install zandrews,
ssc install clemao_io, ssc install ersur, ssc install kmtest.

Suggested citation: Roudane, M. (2026). URSTAT: Stata module for comprehensive
unified unit root and stationarity testing. Statistical Software Components.