TARNNResult.nonlinear_state_space#

TARNNResult.nonlinear_state_space(measurement_variance)[source]#

The fitted two-network threshold mean as a noisily observed state space.

The errors-in-variables reading of the fit: the latent state is the lag stack of the true series (deep enough to hold both the feature lags and the transition lag), the transition routes each state to its regime’s network by the fitted threshold (z <= r to the lower, as in training), and the observation reads the current level through Gaussian measurement error of the stated variance, required and strictly positive because with none the model is observation-driven and filtering it is vacuous. The hard switch makes the transition non-smooth at the threshold, so the particle filter is the natural reader; the extrapolation caveat of the single-network emitter applies to each regime’s network on its own training subsample.

Parameters:

measurement_variance (float) – Observation noise variance the emitted system is read through, strictly positive.

Return type:

_NonlinearStateSpace

Returns:

The NonlinearSSM.

Raises:

SpecificationError – If the threshold variable is external – the emitted transition can depend only on the state, so only self-exciting fits have a closed state-space form – or if the variance is not strictly positive.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = rng.standard_normal(300)
>>> TARNN(y, order=1, delay=2).fit().nonlinear_state_space(0.1).k_states
2
>>> external = TARNN(y, order=1, threshold_variable=rng.standard_normal(300)).fit()
>>> external.nonlinear_state_space(0.1)
Traceback (most recent call last):
    ...
cultivars.exceptions.SpecificationError: the threshold variable is an external ...