dcegm.egm.solve_euler_equation¶
Auxiliary functions for the EGM algorithm.
Functions¶
Calculate candidates for the optimal policy and value function. |
|
Compute EGM candidates for one state-choice and one continuous-state point. |
|
|
Solve the Euler equation for given discrete choice and child states. |
Module Contents¶
- dcegm.egm.solve_euler_equation.calculate_candidate_solutions_from_euler_equation(continuous_grids_info: Dict[str, Any], continuous_state_space: Dict[str, jax.numpy.ndarray], marg_util_next: jax.numpy.ndarray, emax_next: jax.numpy.ndarray, state_choice_mat: Dict[str, jax.numpy.ndarray], idx_post_decision_child_states: jax.numpy.ndarray, model_funcs: Dict[str, Any], params: Dict[str, float]) Tuple[jax.numpy.ndarray, jax.numpy.ndarray, jax.numpy.ndarray, jax.numpy.ndarray]¶
Calculate candidates for the optimal policy and value function.
- dcegm.egm.solve_euler_equation.compute_optimal_policy_and_value(marg_util_next: jax.numpy.ndarray, emax_next: jax.numpy.ndarray, continuous_state_vec: Any, assets_grid_end_of_period: jax.numpy.ndarray, state_choice_vec: Any, model_funcs: Dict[str, Any], params: Dict[str, float]) Tuple[jax.numpy.ndarray, jax.numpy.ndarray, jax.numpy.ndarray, jax.numpy.ndarray]¶
Compute EGM candidates for one state-choice and one continuous-state point.
- Parameters:
marg_util_next – Marginal utilities in child states for one assets grid point.
emax_next – Expected maximum values in child states for one assets grid point.
continuous_state_vec – Continuous-state values for one continuous-state point.
assets_grid_end_of_period – Exogenous end-of-period asset grid.
state_choice_vec – Dictionary of discrete states and choice.
model_funcs – Processed model functions used by the EGM step.
params – Model parameter dictionary.
- Returns:
A tuple
(endog_grid, policy, value, expected_value)where each array is state-choice specific on the assets grid.
- dcegm.egm.solve_euler_equation.solve_euler_equation(state_choice_vec: dict, marg_util_next: jax.numpy.ndarray, emax_next: jax.numpy.ndarray, compute_inverse_marginal_utility: Callable, compute_stochastic_transition_vec: Callable, params: Dict[str, float], discount_factor: float, interest_rate: float) Tuple[jax.numpy.ndarray, jax.numpy.ndarray]¶
Solve the Euler equation for given discrete choice and child states.
We integrate over the exogenous process and income uncertainty and then apply the inverese marginal utility function.
- Parameters:
marg_utils (np.ndarray) – 1d array of shape (n_stochastic_states,) containing the state-choice specific marginal utilities for a given point on the savings grid.
emax (np.ndarray) – 1d array of shape (n_stochastic_states,) containing the state-choice specific expected maximum value for a given point on the savings grid.
trans_vec_state (np.ndarray) – 1d array of shape (n_stochastic_states,) containing for each exogenous process state the corresponding transition probability.
compute_inverse_marginal_utility (callable) – Function for calculating the inverse marginal utility, which takes the marginal utility as only input. (n_stochastic_states, n_grid_wealth) with the maximum values.
params (dict) – Dictionary of model parameters.
- Returns:
- policy (np.ndarray): 1d array of the agent’s current state- and
choice-specific consumption policy. Has shape (n_grid_wealth,).
- expected_value (np.ndarray): 1d array of the agent’s current state- and
choice-specific expected value. Has shape (n_grid_wealth,).
- Return type:
tuple