STARResult#

class cultivars.univariate.smooth_transition.STARResult(*, endog, fittedvalues, resid, llf, nobs, n_params, order, delay, threshold, threshold_values, lower_params, upper_params, sigma2, ssr, transition, gamma, transition_scale)[source]

Bases: _ObservedRegimeResult

A fitted smooth-transition autoregression.

The model blends two linear autoregressions by a weight that moves smoothly with a lagged value of the series,

\[y_t = \bigl(1 - G(z_t)\bigr)\,\phi_L' x_t + G(z_t)\,\phi_U' x_t + \varepsilon_t, \qquad x_t = (1, y_{t-1}, \ldots, y_{t-p})', \qquad z_t = y_{t-d},\]

with the logistic transition \(G(z) = \bigl(1 + \exp(-\gamma (z - c) / s)\bigr)^{-1}\) and the exponential transition \(G(z) = 1 - \exp(-\gamma (z - c)^2 / s^2)\), where \(s\) is the sample standard deviation of \(z\). The logistic weight is monotone in \(z\), so the regimes are “low” and “high”; the exponential weight is symmetric about \(c\), so both tails share a regime and the middle is the other. Conditional on \((\gamma, c)\) the model is linear, so the regime blocks are concentrated out by least squares and only the two transition parameters are searched; gamma is reported per standard deviation of the transition variable so it is comparable across series, with the scale retained so the weight path can be reproduced.

Variables:
  • transition – "logistic" or "exponential".

  • gamma – Transition speed, in units of standard deviations of the transition variable.

  • transition_scale – The standard deviation gamma is expressed against, retained so the weight path can be reproduced and so gamma can be read on the original scale.

Note

The inherited fields are endog, fittedvalues, resid, llf, nobs, n_params, order, delay, threshold, threshold_values, lower_params, upper_params, sigma2 and ssr; the inherited properties upper_fraction, lower_stability, upper_stability and is_regimewise_stationary read the regime blocks as linear autoregressions, and likelihood_ratio_test refuses because the threshold and delay are unidentified under linearity. The effective sample drops max(order, delay) leading observations. n_params counts the two regime blocks, the threshold, gamma and the variance. Standard errors are not yet reported by this estimator.

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.

van Dijk, D., Terasvirta, T., & Franses, P. H. (2002). Smooth transition autoregressive models: A survey of recent developments. Econometric Reviews, 21(1), 1-47.

Example

A logistic transition between a rising and a falling regime, recovered with its threshold:

>>> 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.transition, res.nobs
('logistic', 599)
>>> list(res.params)
['lower.const', 'lower.ar.L1', 'upper.const', 'upper.ar.L1', 'threshold', 'gamma', 'sigma2']
>>> bool(abs(res.threshold) < 0.1), bool(abs(res.gamma / res.transition_scale - 10.0) < 4.0)
(True, True)
>>> bool(res.lower_params[1] > 0.4), bool(res.upper_params[1] < -0.4)
(True, True)

Private methods#

_comparison_label()

Specification label used when this result appears in a ranking.

_from_fit(fit, model)

Assemble the public result from a raw fit and its specification.

_summary_table()

Structured summary rendered by every display path.

_transition_params()

The transition speed, inserted between the threshold and the variance.

_weight_at(z)

The transition function at one value of the transition variable.