R/features.R
cointegration_phillips_ouliaris.Rdcointegration_phillips_ouliaris() calls urca::ca.po() and
returns a named numeric vector containing:
phillips_ouliaris_stat: the \(P_u\) or \(P_z\) test
statistic; and
phillips_ouliaris_pvalue: an approximate p-value obtained by
linearly interpolating the tabulated critical values in
result@cval.
Since it returns a simple numeric vector, this function is suitable for use
as a feature extractor within the fabletools
features framework.
cointegration_phillips_ouliaris(x, ...)A numeric matrix (or object coercible to a matrix) of time series to be tested for cointegration. Columns represent series and rows represent ordered observations.
Additional arguments passed to urca::ca.po(), such as
demean, lag, type, and tol. See
ca.po for details.
A named numeric vector of length two:
phillips_ouliaris_stat
phillips_ouliaris_pvalue
Compute Phillips and Ouliaris (1990) residual-based cointegration test statistics and an approximate p-value as numeric features.
This is a small wrapper around urca::ca.po() designed so that the
Phillips–Ouliaris test can be used directly inside
features.
The function requires the urca package; an informative error is raised if it is not installed.
The p-value is computed by interpolating over the first row of
result@cval, which contains critical values at various significance
levels (e.g., "10pct", "5pct", "1pct"). These labels
are converted to probabilities (0.10, 0.05, 0.01), and
approx is used to obtain the approximate p-value at the
observed test statistic. The interpolation is done with rule = 2,
implying linear extrapolation outside the tabulated range.
Phillips, P.C.B. and Ouliaris, S. (1990), “Asymptotic Properties of Residual Based Tests for Cointegration”, Econometrica, 58(1), 165–193.
cointegration_phillips_ouliaris(cbind(mdeaths, fdeaths))
#> phillips_ouliaris_stat phillips_ouliaris_pvalue
#> 58.1279 0.0100