terasvirta#
- cultivars.diagnostics.nonlinearity.terasvirta(endog, *, order, delay=1)[source]#
Teräsvirta’s (1994) LM-type test of linearity against smooth transition.
A STAR model is a linear AR(\(p\)) whose coefficients move with a transition function \(G(y_{t-d})\), and under the null \(G\) is constant. Replacing \(G\) by its third-order Taylor expansion in the transition variable turns the alternative into the auxiliary regression
\[\hat u_t = \beta_0^\top w_t + \sum_{i = 1}^{p} \beta_{1i}\, y_{t-i} y_{t-d} + \sum_{i = 1}^{p} \beta_{2i}\, y_{t-i} y_{t-d}^2 + \sum_{i = 1}^{p} \beta_{3i}\, y_{t-i} y_{t-d}^3 + e_t,\]with \(w_t\) the linear regressors and \(\hat u_t\) the AR residual, and the null of linearity into the exclusion of the \(3p\) interaction terms, referred to \(F(3p, n - 4p - 1)\) because the chi-squared form over-rejects at the sample sizes the test meets. The escalation sequence
H04,H03,H02incompanionstests the cubic terms, then the quadratic given the cubic, then the linear given both, and is the paper’s rule for choosing the transition: when the quadratic step rejects most strongly the transition is even in \(y_{t-d}\) and hence exponential (ESTAR), otherwise logistic (LSTAR). At order 1 the test holds size at 4% on 100 observations and rejects a two-regime SETAR or LSTAR with 250 observations essentially always.- Parameters:
- Return type:
- Returns:
The
LinearityTestnamed"Teräsvirta"withsuggestionset and the three escalation steps ascompanions.- Raises:
SpecificationError – If the order or delay is not positive or the series is too short for the auxiliary regression.
NumericalError – If a value is not finite or the auxiliary regressions are degenerate.
Note
The transition variable is a lag of the series itself; a STAR with an exogenous transition variable is not covered. The
suggestionis always set, since one of the three steps is always the strongest; read it only when the test rejects.See also
tsay()– the threshold test that assumes no functional form for the transition.hansen_threshold()– the sup-F test that also locates the threshold.
References
Teräsvirta, T. (1994). Specification, estimation, and evaluation of smooth transition autoregressive models. Journal of the American Statistical Association, 89(425), 208-218.
Luukkonen, R., Saikkonen, P., & Teräsvirta, T. (1988). Testing linearity against smooth transition autoregressive models. Biometrika, 75(3), 491-499.
Example
A logistic transition is rejected and the escalation sequence reads it as logistic: the quadratic step is not the strongest:
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> y = np.zeros(300) >>> for t in range(1, 300): ... g = 1.0 / (1.0 + np.exp(-5.0 * y[t - 1])) ... y[t] = 0.8 * y[t - 1] - 1.4 * y[t - 1] * g + rng.standard_normal() >>> verdict = terasvirta(y, order=1) >>> verdict.reject(), verdict.suggestion (True, 'LSTAR') >>> [(c.name, round(c.pvalue, 4)) for c in verdict.companions] [('H04', 0.1403), ('H03', 0.0002), ('H02', 0.0)]