LSTAR#

class cultivars.univariate.smooth_transition.LSTAR(endog, *, order, delay=1)[source]#

Logistic smooth-transition autoregression.

The weight \(G(z) = \bigl(1 + \exp(-\gamma (z - c) / s)\bigr)^{-1}\) rises monotonically through the threshold, so the two regimes are genuinely different states and the dynamics differ above and below. Use this when the asymmetry has a direction – contractions behaving differently from expansions, for instance. The transition variable is the series’ own lag \(y_{t-d}\); \(\gamma\) and \(c\) are searched by multi-start Nelder-Mead over a grid of speeds and two candidate thresholds, with the regime blocks concentrated out by least squares at each step.

Variables:
  • _endog – The validated series.

  • _order – Autoregressive order within each regime.

  • _delay – Delay of the transition variable.

  • _transition – "logistic".

Parameters:
  • endog (ArrayLike) – The series.

  • order (int) – Autoregressive order within each regime.

  • delay (int) – Delay of the transition variable y_{t-d}.

Raises:
  • SpecificationError – If order or delay is not a positive integer.

  • DimensionError – If endog is not one-dimensional or has fewer than 2(order + 2) + delay observations.

  • NumericalError – If endog contains non-finite values, or (at fit()) the transition variable has zero variance.

See also

References

Terasvirta, T. (1994). Specification, estimation, and evaluation of smooth transition autoregressive models. Journal of the American Statistical Association, 89(425), 208-218.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros(600)
>>> for t in range(1, 600):
...     w = 1.0 / (1.0 + np.exp(-10.0 * y[t - 1]))
...     y[t] = (1 - w) * (0.5 + 0.6 * y[t - 1]) + w * (-0.5 - 0.6 * y[t - 1])
...     y[t] += 0.3 * rng.standard_normal()
>>> res = LSTAR(y, order=1).fit()
>>> res._comparison_label(), bool(abs(res.threshold) < 0.1)
('LSTAR(1, d=1)', True)
>>> bool(res.lower_params[1] > 0.4), bool(res.upper_params[1] < -0.4)
(True, True)

Attributes#

delay

The transition-variable delay.

endog

The validated endogenous series.

order

AR order per regime.

transition

The transition function family.

Methods#

fit()

Estimate the transition by concentrated least squares.