Skip to content

DPredict · Guide test 204

Phillips–Ouliaris cointegration test

Uses residual based statistics with nonparametric correction to test absence of cointegration.

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:

  • Cointegration tests — Do several wandering (unit-root) series move together in the long run, so that some combination of them is stationary?

In Cointegration tests, choose Test = Phillips–Ouliaris Ẑ_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 · Phillips–Ouliaris cointegration test

80
1.50
0.60

1: the gap is a random walk too (no cointegration).

0.050

Your data

Simulated with known truth
—— y– – x—— gap y − 0.79 − 1.53·x

Cointegrated series wander together: the gap from their long-run line keeps returning to zero.

If H₀ were true

P_u = 55.19
  1. The reference: how P_u varies across samples when H₀ is true, P_u of two independent random walks, n = 80 (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 = < .001).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Pu=n ω^11⋅2n−1∑tu^t2,ω^11⋅2=ω^11−ω^212/ω^22P_u = \dfrac{n\,\hat\omega_{11\cdot2}}{n^{-1}\sum_t \hat u_t^2},\qquad \hat\omega_{11\cdot2} = \hat\omega_{11} - \hat\omega_{21}^2/\hat\omega_{22}

With your numbers

Pu=55.19,n=80P_u = 55.19,\qquad n = 80
ω^\hat\omega
long-run covariance of the VAR(1) residuals (Bartlett weights)
u^t\hat u_t
residuals of y ~ x

The verdict

P_u = 55.19, p < .001

p ≤ α = .050: reject H₀

Large P_u is evidence of cointegration (H0 is none). A variance-ratio test: no lag choice for the residual regression. The CodeSplash method reports the residual-based Ẑ_t statistic, not P_u, so its number differs from this bench.

Statistic
55.194
p-value
0.0005
Phillips–Ouliaris cointegration test on two series of length 80: P_u = 55.19, p < .001. The p-value is below α = .050, so the data are hard to reconcile with H0.

Phillips–Ouliaris cointegration test on two series of length 80: P_u = 55.19, p < .001. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: no cointegration among I(1) variables.

Assumptions

Compatible integration orders, valid deterministic specification and consistent long-run covariance estimation.

Formula

e^t=yt−β^Txt−η^TdtZα=T(ρ^−1)−ω^e2−γ^e02T−2∑te^t−12\begin{gathered}\widehat e_t=y_t-\widehat\beta^Tx_t-\widehat\eta^Td_t\\[5pt] Z_\alpha=T(\widehat\rho-1)-\frac{\widehat\omega_e^2-\widehat\gamma_{e0}}{2T^{-2}\sum_t\widehat e_{t-1}^2}\end{gathered}

Parameters and notation

ρ̂ is from residual AR(1); γ̂e0 and ω̂e² are short/long-run innovation variances. This represents a residual Z-type version; Pu/Pz variance-ratio variants use multivariate long-run covariance.

Structure of the method

Estimate a levels relationship or its system representation and use residual-based long-run covariance corrections to test lack of cointegration. The family includes Z statistics and Pu/Pz variance-ratio statistics with different constructions. The supplied R example computes Pu, whereas the displayed illustrative formula describes a Z-alpha-type member.

Estimated and nuisance parameters

Cointegrating regression coefficients, innovation covariance, long-run covariance, and residual summary quantities are fitted. Pz is designed to be invariant to normalization of the cointegration vector; Pu and particular residual regressions can depend on which variable is normalized as the response.

Settings and design choices

State the exact statistic, deterministic component, bandwidth/kernel or short/long rule, variable ordering, and matrix-inversion tolerance. A software function supporting Pu/Pz should not be described as computing the displayed Z statistic. Critical values must match statistic, dimension, and deterministic specification.

Fitting and adaptation

Refit the relationship and covariance estimates after sample or model changes. In simulated calibration, reproduce both stages and the chosen normalization. If extending to learned regressors or data-driven trend selection, use a separately justified procedure; ordinary PP unit-root calibration ignores the fitted cointegration relation.

Sensitivity and robustness

Ill-conditioned covariance, many series, near-perfect collinearity, breaks, and bandwidth choices affect numerical and inferential behavior. Weak adjustment and small samples lower power. Report variant-specific results and avoid interpreting different family members as independent replications. Cointegration evidence concerns stable stochastic relations under the maintained integration assumptions, not causality or predictive superiority.

How to use and calibrate

Use Phillips–Ouliaris cointegration critical values matching statistic, dimension and deterministic model.

Example application

Check a long-run relation with nonparametric serial-correlation correction.

Interpretation and pitfalls

Watch out

The family has several statistics; name the exact variant. A generic PP unit-root p value does not account for generated cointegration residuals.

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

The two Johansen implementations use different deterministic-term parameterizations; compare only after aligning the model. Test ranks sequentially using the corresponding critical-value table.

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));y<-1.5*x+rnorm(160);Z<-cbind(y,x)
library(urca)
print(summary(ca.po(Z,demean="constant",lag="short",type="Pu")))
"""
# 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));y<-1.5*x+rnorm(160);Z<-cbind(y,x)
library(urca)
print(summary(ca.po(Z,demean="constant",lag="short",type="Pu")))
Output
######################################## 
# Phillips and Ouliaris Unit Root Test # 
######################################## 

Test of type Pu 
detrending of series with constant only 


Call:
lm(formula = z[, 1] ~ z[, -1])

Residuals:
     Min       1Q   Median       3Q      Max 
-2.59218 -0.63876 -0.09583  0.60862  2.20574 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.08569    0.14693  -0.583    0.561    
z[, -1]      1.47833    0.02045  72.308   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9341 on 158 degrees of freedom
Multiple R-squared:  0.9707,	Adjusted R-squared:  0.9705 
F-statistic:  5228 on 1 and 158 DF,  p-value: < 2.2e-16


Value of test-statistic is: 125.8588 

Critical values of Pu are:
                  10pct   5pct    1pct
critical values 27.8536 33.713 48.0021

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 204, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT204.