PerturbationDSGE.solve#
- PerturbationDSGE.solve(theta)[source]#
Solve the model at a parameter point.
- Parameters:
theta (
ArrayLike) – Structural parameters in the model’s own space.- Return type:
_PerturbationSolution- Returns:
The
_PerturbationSolutionwith the policy blocksh_x,g_x(andh_xx,g_xx,h_ss,g_ssat second order), the loadingetaand the steady state.- Raises:
NumericalError – If the steady state does not solve the equations or the Blanchard-Kahn conditions fail.
Example
For the AR(1) latent state the first-order solution is the model itself:
>>> 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 >>> solution = PerturbationDSGE(Latent(), np.zeros(50), order=1).solve([0.8, 0.5]) >>> solution.h_x.tolist(), solution.g_x.tolist(), solution.eta.tolist() ([[0.8]], [[1.0]], [[0.5]]) >>> solution.order, solution.is_stable, solution.n_shocks (1, True, 1)