DPredict · Guide test 202
Schmidt–Phillips test
Tests a unit root while accounting for deterministic trends using an LM formulation.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Unit-root and stationarity tests — Does the series wander like a random walk (a unit root), or return to a mean or trend — and how many differences make it stationary?
In Unit-root and stationarity tests, choose Test = Schmidt–Phillips (LM).
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 · Schmidt–Phillips test
Each error carries φ × the previous one; 1 is a random walk.
Your data
Simulated with a known ρIf H₀ were true
- The reference: how Z(τ) varies across samples when H₀ is true, Z(τ) of random walks of length 60 (Monte Carlo null: 1,999 samples simulated under H₀ (seed 20261107)).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .016).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- the series detrended under the null (trend from the first and last values)
- short-run ÷ long-run variance (Bartlett weights)
The verdict
Z(τ) = −3.37, p = .016
p ≤ α = .050: reject H₀
Its trend parameters keep the same meaning under both hypotheses, unlike the ADF trend model.
- Statistic
- −3.372
- p-value
- 0.0160
Schmidt–Phillips test on 60 (x, y) pairs: Z(τ) = −3.37, p = .016. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: unit root in a series with a specified polynomial deterministic trend.
Assumptions
Polynomial trend degree selected in advance; weak-dependence conditions and a consistent long-run variance estimate.
Formula
Parameters and notation
Estimate β0 under ρ=1 by regressing Δy on Δd. Regress Δy on Δd and S(t−1); the LM τ statistic is the coefficient t ratio, with the source’s long-run variance correction; a ρ-type LM statistic also exists.
Structure of the method
Estimate polynomial deterministic effects under the unit-root null using differences, construct the resulting detrended cumulative process, and form the Schmidt–Phillips LM coefficient or t-type statistic with its prescribed long-run correction. The deterministic coefficients are represented under both hypotheses, distinguishing this method from simply adding polynomial terms to ordinary ADF.
Estimated and nuisance parameters
Null-imposed trend coefficients, the LM regression coefficient, residual variation, and required long-run variance quantities are estimated. Polynomial degree is a design setting. The tau and rho versions summarize the same testing principle differently and require their respective calibration.
Settings and design choices
Specify polynomial degree, statistic type, significance/critical-value convention, and the implementation's long-run variance rule. The documented ur.sp interface does not expose an arbitrary user bandwidth argument; do not invent one or claim direct tuning unsupported by the selected function.
Fitting and adaptation
Refit null detrending and all variance corrections after any sample or deterministic-specification change. If evaluating alternatives to the implementation's fixed rule, use a documented custom procedure with matching critical values or valid simulation. Repeat any degree-selection stage during calibration or choose degree independently.
Sensitivity and robustness
High-degree trends can be poorly conditioned and consume effective information. Breaks, seasonal behavior, strong serial dependence, and small samples may not be captured by a smooth polynomial trend. A different polynomial degree changes the maintained hypothesis and should not be selected just to change significance. Report the exact tau/rho variant and all supported settings.
How to use and calibrate
Use Schmidt–Phillips critical values matching trend degree and statistic. Specify HAC lag bandwidth.
Example application
Test for a unit root while reducing sensitivity to nuisance polynomial trend parameters.
Interpretation and pitfalls
Watch out
This is an LM detrending procedure, not merely ADF with another trend regressor; use its own critical values.
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
Read the unit-root/stationarity statistic and its nonstandard critical values, not the auxiliary regression coefficient’s ordinary t p-value. Deterministic terms, bandwidth and lag selection must match before comparing implementations.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: urca
# 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<-cumsum(rnorm(160))
library(urca)
print(summary(ur.sp(x,type="tau",pol.deg=1,signif=.05)))
"""
# 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 urca
set.seed(2026)
x<-cumsum(rnorm(160))
library(urca)
print(summary(ur.sp(x,type="tau",pol.deg=1,signif=.05)))
Output
###################################
# Schmidt-Phillips Unit Root Test #
###################################
Call:
lm(formula = sp.data)
Residuals:
Min 1Q Median 3Q Max
-2.42077 -0.68894 0.00342 0.71539 2.46609
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.448105 0.198898 -2.253 0.0257 *
y.lagged 0.961380 0.022137 43.428 <2e-16 ***
trend.exp1 0.002443 0.001736 1.407 0.1613
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9943 on 156 degrees of freedom
Multiple R-squared: 0.9245, Adjusted R-squared: 0.9235
F-statistic: 954.7 on 2 and 156 DF, p-value: < 2.2e-16
Value of test-statistic is: -2.5244
Critical value for a significance level of 0.05
is: -3.04Sources
- urca — urca · ur.spAuthor documentation/source reviewed: urca 1.3-4.search.r-project.org
- ur.spsearch.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 202, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT202.