dcegm.pre_processing.alternative_sim_functions

Functions

generate_alternative_sim_functions(model_config, ...)

Set up the model for dcegm.

process_alternative_sim_functions(model_config, ...[, ...])

Create wrapped functions from user supplied functions.

Module Contents

dcegm.pre_processing.alternative_sim_functions.generate_alternative_sim_functions(model_config: Dict, model_specs: Dict, model_specs_jax: Dict, state_space_functions: Dict[str, Callable], budget_constraint: Callable, shock_functions: Dict[str, Callable] = None, stochastic_states_transitions: Dict[str, Callable] = None)

Set up the model for dcegm.

It consists of two steps. First it processes the user supplied functions to make them compatible with the interface the dcegm software expects. Second it creates the states and choice objects used by the dcegm software.

Parameters:
  • options (Dict[str, int]) – Options dictionary.

  • state_space_functions (Dict[str, Callable]) – Dictionary of user supplied

  • of (functions for computation) –

    1. next period endogenous states

    2. next period exogenous states

    3. next period discrete choices

  • budget_constraint (Callable) – User supplied budget constraint.

dcegm.pre_processing.alternative_sim_functions.process_alternative_sim_functions(model_config: Dict, model_specs: Dict, model_specs_jax: Dict, stochastic_states_transition, state_space_functions: Dict[str, Callable], budget_constraint: Callable, shock_functions: Dict[str, Callable] = None)

Create wrapped functions from user supplied functions.

Parameters:
  • options (Dict[str, int]) – Options dictionary.

  • map_state_variables_to_index (Dict[str, int]) – Dictionary mapping state variables to their index in the state vector.

  • user_utility_functions (Dict[str, callable]) – Dictionary of three user-supplied functions for computation of: (i) utility (ii) inverse marginal utility (iii) next period marginal utility

  • user_budget_constraint (callable) – Callable budget constraint.

  • exogenous_transition_function (callable) – User-supplied function returning for each state a transition matrix vector.

Returns:

  • compute_utility (callable): Function for computation of agent’s utility.

  • compute_marginal_utility (callable): User-defined function to compute the

    agent’s marginal utility. The input `params` is already partialled in.

  • compute_inverse_marginal_utility (Callable): Function for calculating the

    inverse marginal utility, which takes the marginal utility as only input.

  • compute_value (callable): Function for calculating the value from consumption

    level, discrete choice and expected value. The inputs `discount_rate` and `compute_utility` are already partialled in.

  • compute_next_wealth_matrices (callable): User-defined function to compute the

    agent’s wealth matrices of the next period (t + 1). The inputs `savings_grid`, `income_shocks`, `params` and `options` are already partialled in.

  • compute_upper_envelope (Callable): Function for calculating the upper envelope

    of the policy and value function. If the number of discrete choices is 1, this function is a dummy function that returns the policy and value function as is, without performing a fast upper envelope scan.

  • transition_function (Callable): Partialled transition function that returns

    transition probabilities for each state.

Return type:

tuple