PerturbationDSGEResult._from_fit#
- classmethod PerturbationDSGEResult._from_fit(fit, model)[source]#
Assemble the public result from a raw fit and its specification.
- Parameters:
fit (
_PerturbationFit) – The packed fit: estimate, solution, criterion, filter name, effective sample, parameter count and filtered states.model (
PerturbationDSGE) – The model that produced it, kept on the result as its engine.
- Return type:
- Returns:
A populated result.
Example
>>> import numpy as np >>> class Latent: ... parameter_names, bounds = ("rho", "sigma"), ((0.0, 0.99), (0.01, 1.0)) ... n_states, n_controls = 1, 1 ... def equations(self, th, y_next, y, x_next, x): ... return np.array([y[0] - x[0], x_next[0] - th[0] * x[0]]) ... def steady_state(self, th): ... return np.zeros(1), np.zeros(1) ... def shock_loading(self, th): ... return np.array([[th[1]]]) ... def observation(self, th): ... return np.array([[0.0, 1.0]]), np.zeros(1), np.array([[1e-4]]) ... def log_prior(self, th): ... return 0.0 >>> rng = np.random.default_rng(0) >>> model = PerturbationDSGE(Latent(), rng.standard_normal(80), order=1) >>> fit = model._fit_point( ... np.array([0.5, 0.5]), filter_name="kalman", n_particles=0, seed=None ... ) >>> res = PerturbationDSGEResult._from_fit(fit, model) >>> res._engine is model, res.filter, res.order (True, 'kalman', 1)