A nonparametric test for stationarity of a multivariate Itô diffusion process, based on comparing two estimators of the diffusion matrix whose convergence rates diverge under the alternative of nonstationarity.
The process
observed discretely on
-
$H_0$ :$X$ is stationary (equivalently, positive Harris recurrent with$\alpha$ -index$1$ ). -
$H_1$ :$X$ is nonstationary ($\alpha$ -index$< 1$ , so the occupation measure $L_{n,T}(x) = o_p(T)$).
Stationarity is identified through the empirical occupation measure
By Darling–Kac (1957) and Meyn–Tweedie (2012), a stationary process satisfies
The test is a Durbin–Wu–Hausman-style comparison of two consistent estimators of
Time-domain smoother (Jacod–Protter 2011): a local average of outer products of increments over a window of
Its central-limit rate is
State-domain smoother (Bandi–Moloche 2018): a Nadaraya–Watson kernel regression of squared increments on the state space,
with near-optimal bandwidth
Under stationarity the two estimators are asymptotically independent (proved via
for every
Because the full path $(Z_{t'j}){j=1,\dots,n}$ must be assessed jointly, the test uses the running maximum
For simulation studies, Benjamini–Hochberg (1995) and Benjamini–Yekutieli (2001) FDR procedures are applied to the
The package also provides:
- Batch KPSS and Leybourne-McCabe stationarity tests on process paths for comparison.
pip install -e .Or install dependencies only:
pip install -r requirements.txtRequires Python >= 3.10.
import numpy as np
from mht.models.processes import BivariateOUProcess
from mht.testing.kernel_test import KernelTest, Kernel, TestPlotter
# Simulate a bivariate OU process
ou_config = {
'T': 365, 'dt': 1/20,
'sigma1': np.sqrt(2), 'sigma2': np.sqrt(2),
'theta1': 0.2, 'theta2': 0.2,
'rho': 0.75,
}
process = BivariateOUProcess(**ou_config)
process.simulate(seed=1)
X, T, n = process.config()
# Set up the test configuration
config = {
'data': X,
'kernel_params': {
'bandwidth': np.sqrt(3) * 9 / ((n ** (1/6)) * np.log(n)),
'n': n, 'T': T,
'kernel': Kernel.BaseKernel,
},
'time_params': {'bandwidth': 200 * T / n, 'n': n, 'T': T},
}
# Estimate and test
test = KernelTest(**config)
test.time_domain_smoother(lamb=0.99)
test.state_domain_smoother(dist=True) # True = use KDE for joint density
test.gauss()
bound, scalar_gauss = test.transform_1D_gauss()
# Plot
plotter = TestPlotter(test)
plotter.plot_running_maximum()See notebooks/example.ipynb for a full worked example including
Monte Carlo simulations and comparison with KPSS / Leybourne-McCabe.
src/mht/
testing/
kernel_test.py # KernelTest, Simulator, TestPlotter
hypothesis.py # MultipleHypTest, UnitRootTest, LaTeXTable
leybourne_mccabe.py # Leybourne-McCabe test (single canonical copy)
models/
processes.py # BivariateOUProcess, BivariateCorrelatedBM, ...
io/
reader.py # Reader class for simulation CSV files
viz/ # TestPlotter re-exported here
utils/
decorators.py
simulations/ # Pre-computed CSV simulation results
notebooks/
example.ipynb
tests/
test_processes.py
test_kernel_test.py
- Bandi, F.M., & Moloche, G. (2018). On the functional estimation of multivariate diffusion processes. Econometric Theory, 34(4): 896–946.
- Jacod, J., & Protter, P. (2011). Discretization of Processes. Springer.
- Darling, D.A., & Kac, M. (1957). On occupation times for Markoff processes. Transactions of the American Mathematical Society, 84(2): 444–458.
- Berman, S.M. (1964). Limit theorems for the maximum term in stationary sequences. Annals of Mathematical Statistics, 35(2): 502–516.
- Pickands, J. (1969). Asymptotic properties of the maximum in a stationary Gaussian process. Transactions of the American Mathematical Society, 145: 75–86.
- Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate. Journal of the Royal Statistical Society B, 57(1): 289–300.
- Benjamini, Y., & Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency. Annals of Statistics, 29(4): 1165–1188.
- Leybourne, S.J., & McCabe, B.P.M. (1994). A consistent test for a unit root. Journal of Business and Economic Statistics, 12: 157–166.
- Meyn, S.P., & Tweedie, R.L. (2009). Markov Chains and Stochastic Stability (2nd ed.). Cambridge University Press.