Skip to content

DPredict · Guide test 202

Schmidt–Phillips test

Tests a unit root while accounting for deterministic trends using an LM formulation.

Runs in CodeSplashPython (calls R) example not runR example validated

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

60
0.050
0.60

Each error carries φ × the previous one; 1 is a random walk.

0.0
0.050

Your data

Simulated with a known ρ

If H₀ were true

Z(τ) = −3.37
  1. 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)).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .016).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

S~t=yt−ψ~−ξ~t,Δyt=c+ϕ S~t−1+εt,Z(τ)=τϕ^ω^2\tilde S_t = y_t - \tilde\psi - \tilde\xi t,\qquad \Delta y_t = c + \phi\,\tilde S_{t-1} + \varepsilon_t,\qquad Z(\tau) = \dfrac{\tau_{\hat\phi}}{\sqrt{\hat\omega^2}}

With your numbers

Z(τ)=(−3.68)1.19=(−3.37)Z(\tau) = \dfrac{(-3.68)}{\sqrt{1.19}} = (-3.37)
S~t\tilde S_t
the series detrended under the null (trend from the first and last values)
ω^2\hat\omega^2
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 H0.

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

yt=dtTβ+xtxt=ρxt−1+utSt=yt−y1−∑s=2tΔdsTβ^0\begin{gathered}y_t=d_t^T\beta+x_t\\[5pt] x_t=\rho x_{t-1}+u_t\\[5pt] S_t=y_t-y_1-\sum_{s=2}^{t}\Delta d_s^T\widehat\beta_0\end{gathered}

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.

Python · invokes R

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()
R

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.04

Sources

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.