UnobservedComponentsResult._from_fit#

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

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

Copies the parameter record field by field, takes the sample facts and the smoothed paths from the fit, and the specification from the model, so the record can rebuild the system without either.

Parameters:
  • fit (_StructuralFit) – The packed estimate from _fit_structural.

  • model (_UnobservedComponentsModel[UnobservedComponentsResult]) – The specification the fit was produced for.

Return type:

UnobservedComponentsResult

Returns:

The public result record.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.cumsum(0.2 * rng.standard_normal(200)) + rng.standard_normal(200)
>>> model = UnobservedComponents(y, trend="smooth")
>>> res = UnobservedComponentsResult._from_fit(model._fit_structural(), model)
>>> res.trend, res.sigma2_level, res.nobs
('smooth', None, 200)