SETAR.fit#
- SETAR.fit()[source]#
Estimate the threshold, the delay, and both regimes by grid search.
- Return type:
- Returns:
The fitted two-regime autoregression.
- Raises:
NumericalError – If no candidate split leaves both regimes with at least
order + 2observations.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> y = np.zeros(300) >>> for t in range(1, 300): ... y[t] = (0.6 if y[t - 1] <= 0.0 else -0.4) * y[t - 1] + rng.standard_normal() >>> res = SETAR(y, order=1, delay=1).fit() >>> res.self_exciting, bool(res.lower_params[1] > res.upper_params[1]) (True, True)