SETARResult._from_fit#

classmethod SETARResult._from_fit(fit, model)[source]#

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

Rebuilds the aligned transition variable with trailing_lag – the series itself or the model’s external variable, lagged by the selected delay and cut to the effective sample – so the record can reproduce the regime assignment without the model.

Parameters:
  • fit (_ThresholdFit) – The packed estimate from _fit_family.

  • model (_ThresholdModel[SETARResult]) – The specification the fit was produced for.

Return type:

SETARResult

Returns:

The public result record.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros(300)
>>> for t in range(1, 300):
...     y[t] = (0.6 if y[t - 1] <= 0.0 else -0.4) * y[t - 1] + rng.standard_normal()
>>> model = SETAR(y, order=1, delay=1)
>>> res = SETARResult._from_fit(model._fit_family(), model)
>>> res.threshold_values.shape, res.nobs, res.searched_delay
((299,), 299, False)