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:
_ObservedRegimeResultA 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;
gammais 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
gammais expressed against, retained so the weight path can be reproduced and sogammacan 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,sigma2andssr; the inherited propertiesupper_fraction,lower_stability,upper_stabilityandis_regimewise_stationaryread the regime blocks as linear autoregressions, andlikelihood_ratio_testrefuses because the threshold and delay are unidentified under linearity. The effective sample dropsmax(order, delay)leading observations.n_paramscounts the two regime blocks, the threshold,gammaand the variance. Standard errors are not yet reported by this estimator.See also
SETARResult– the hard switch this smooths;is_effectively_abruptsays when the two coincide.NonlinearSSM– whatnonlinear_state_space()emits.
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#
Specification label used when this result appears in a ranking. |
|
|
Assemble the public result from a raw fit and its specification. |
Structured summary rendered by every display path. |
|
The transition speed, inserted between the threshold and the variance. |
|
|
The transition function at one value of the transition variable. |