arch.unitroot.cointegration.phillips_ouliaris¶
-
arch.unitroot.cointegration.phillips_ouliaris(y: ndarray[tuple[int], dtype[float64]] | Series, x: ndarray[tuple[int, int], dtype[float64]] | DataFrame, trend: 'n' | 'c' | 'ct' | 'ctt' =
'c', *, test_type: 'za' | 'zt' | 'pu' | 'pz' ='zt', kernel: str ='bartlett', bandwidth: float | None =None, force_int: bool =False, bandwidth_method: str ='newey-west') PhillipsOuliarisTestResults[source]¶ Test for cointegration within a set of time series.
- Parameters:¶
- y: ndarray[tuple[int], dtype[float64]] | Series¶
The left-hand-side variable in the cointegrating regression. It must be 1-d and contain only finite values.
- x: ndarray[tuple[int, int], dtype[float64]] | DataFrame¶
The right-hand-side variables in the cointegrating regression. It must be 1-d or 2-d with the same number of rows as y, between 1 and 12 columns, the same index as y if both are pandas objects, and contain only finite values. The number of rows must be at least two more than the number of parameters in the cointegrating regression (the number of columns of x and the number of terms in trend).
- trend: 'n' | 'c' | 'ct' | 'ctt' =
'c'¶ Trend to include in the cointegrating regression. Not case sensitive. Trends are:
”n”: No deterministic terms
”c”: Constant
”ct”: Constant and linear trend
”ctt”: Constant, linear and quadratic trends
- test_type: 'za' | 'zt' | 'pu' | 'pz' =
'zt'¶ The test statistic to compute. Not case sensitive. Supported options are:
”za”: The Zα test based on the debiased AR(1) coefficient.
”zt”: The Zt test based on the t-statistic from an AR(1).
”pu”: The Pᵤ variance-ratio test.
”pz”: The Pz test of the trace of the product of an estimate of the long-run residual variance and the inner-product of the data.
See the notes for details on the test.
- kernel: str =
'bartlett'¶ The string name of any known kernel-based long-run covariance estimator. Common choices are “bartlett” for the Bartlett kernel (Newey-West), “parzen” for the Parzen kernel and “quadratic-spectral” for the Quadratic Spectral kernel. Not case sensitive.
- bandwidth: float | None =
None¶ The bandwidth to use. It must be a finite non-negative number. If not provided, the optimal bandwidth is estimated from the data. Setting the bandwidth to 0 produces White’s covariance estimator.
- force_int: bool =
False¶ Whether to force the estimated optimal bandwidth to be an integer.
- bandwidth_method: str =
'newey-west'¶ The method used to estimate the bandwidth when bandwidth is None. “newey-west” uses the nonparametric estimate of Newey and West (1994) and “andrews” uses the AR(1) plug-in estimate of Andrews (1991), see
opt_bandwidthof the kernel estimators. Not case sensitive, and hyphens and underscores are ignored as in the names of kernels. Ignored if bandwidth is provided.
- Returns:¶
Results of the Phillips-Ouliaris test.
- Return type:¶
- Raises:¶
TypeError – If y or x cannot be converted to float64, bandwidth is not a real number or None, force_int is not a bool, or trend, test_type, kernel or bandwidth_method is not a string.
ValueError – If y or x contains NaN or inf, does not have the required dimensions, the same number of rows or the same index, or has too few rows. Also if x has more than 12 columns, bandwidth is negative, NaN or inf, trend, test_type, kernel or bandwidth_method is not one of the options, or bandwidth_method is “andrews” and the AR(1) cannot be fitted to the residuals.
InfeasibleTestException – If y is constant. This is also a
ValueError.
See also
arch.unitroot.ADFAugmented Dickey-Fuller testing.
arch.unitroot.PhillipsPerronPhillips & Perron’s unit root test.
arch.unitroot.cointegration.engle_grangerEngle & Granger’s cointegration test.
Notes
Supports 4 distinct tests.
Define the cross-sectional regression
\[y_t = x_t \beta + d_t \gamma + u_t\]where \(d_t\) are any included deterministic terms. Let \(\hat{u}_t = y_t - x_t \hat{\beta} + d_t \hat{\gamma}\).
The Zα and Zt statistics are defined as
\[\begin{split}\hat{Z}_\alpha & = T \times z \\ \hat{Z}_t & = \frac{\hat{\sigma}_u}{\hat{\omega}^2} \times \sqrt{T} z \\ z & = (\hat{\alpha} - 1) - \hat{\omega}^2_1 / \hat{\sigma}^2_u\end{split}\]where \(\hat{\sigma}^2_u=T^{-1}\sum_{t=2}^T \hat{u}_t^2\), \(\hat{\omega}^2_1\) is an estimate of the one-sided strict autocovariance, and \(\hat{\omega}^2\) is an estimate of the long-run variance of the process.
The \(\hat{P}_u\) variance-ratio statistic is defined as
\[\hat{P}_u = \frac{\hat{\omega}_{11\cdot2}}{\tilde{\sigma}^2_u}\]where \(\tilde{\sigma}^2_u=T^{-1}\sum_{t=1}^T \hat{u}_t^2\) and
\[\hat{\omega}_{11\cdot 2} = \hat{\omega}_{11} - \hat{\omega}'_{21} \hat{\Omega}_{22}^{-1} \hat{\omega}_{21}\]and
\[\begin{split}\hat{\Omega}=\left[\begin{array}{cc} \hat{\omega}_{11} & \hat{\omega}'_{21}\\ \hat{\omega}_{21} & \hat{\Omega}_{22} \end{array}\right]\end{split}\]is an estimate of the long-run covariance of \(\xi_t\), the residuals from an VAR(1) on \(z_t=[y_t,z_t]\) that includes and trends included in the test.
\[z_t = \Phi z_{t-1} + \xi_\tau\]The final test statistic is defined
\[\hat{P}_z = T \times \mathrm{tr}(\hat{\Omega} M_{zz}^{-1})\]where \(M_{zz} = \sum_{t=1}^T \tilde{z}'_t \tilde{z}_t\), \(\tilde{z}_t\) is the vector of data \(z_t=[y_t,x_t]\) detrended using any trend terms included in the test, \(\tilde{z}_t = z_t - d_t \hat{\kappa}\) and \(\hat{\Omega}\) is defined above.
The specification of the \(\hat{P}_z\) test statistic when trend is “n” differs from the expression in [1]. We recenter \(z_t\) by subtracting the first observation, so that \(\tilde{z}_t = z_t - z_1\). This is needed to ensure that the initial value does not affect the distribution under the null. When the trend is anything other than “n”, this step is not needed and the test statistics is identical whether the first observation is subtracted or not.
References