dcegm.toy_models.cons_ret_model_dcegm_paper¶
Submodules¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.budget_constraint
- dcegm.toy_models.cons_ret_model_dcegm_paper.params_model_specs_and_config_deaton
- dcegm.toy_models.cons_ret_model_dcegm_paper.params_model_specs_and_config_ret_model_no_shocks
- dcegm.toy_models.cons_ret_model_dcegm_paper.params_model_specs_and_config_ret_model_with_shocks
- dcegm.toy_models.cons_ret_model_dcegm_paper.state_space_objects
- dcegm.toy_models.cons_ret_model_dcegm_paper.utility_functions
Functions¶
|
Compute possible current beginning of period resources. |
Create dictionary with state space functions. |
|
|
Select state-specific feasible choice set such that retirement is absorbing. |
Create dictionary with utility functions for the final period. |
|
Create dictionary with utility functions. |
|
|
Computes the inverse marginal utility of a CRRA utility function. |
|
Computes marginal utility of CRRA utility function. |
|
Computes marginal utility of CRRA utility function. |
|
Computes the agent's current utility based on a CRRA utility function. |
|
Package Contents¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.budget_constraint(period: int, lagged_choice: int, asset_end_of_previous_period: float, income_shock_previous_period: float, model_specs: Dict[str, Any], params: Dict[str, float]) float¶
Compute possible current beginning of period resources.
Given the savings grid of the previous period (t -1) and the current state vector in t, including the agent’s lagged discrete choice made in t-1.
- Parameters:
state_beginning_of_period (np.ndarray) – 1d array of shape (n_state_variables,) denoting the current child state.
asset_end_of_previous_period (float) – One point on the exogenous savings grid carried over from the previous period.
income_shock_pervious_period (float) – Stochastic shock on labor income; may or may not be normally distributed. This float represents one particular realization of the income_shock_draws carried over from the previous period.
params (dict) – Dictionary containing model parameters.
model_specs (dict) – model_specs dictionary.
- Returns:
The beginning of period wealth in t.
- Return type:
(float)
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_config_deaton()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_specs_deaton()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_params_deaton()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_config_retirement_no_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_specs_retirement_no_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_params_retirement_no_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_config_ret_model_with_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_model_specs_ret_model_with_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.example_params_ret_model_with_shocks()¶
- dcegm.toy_models.cons_ret_model_dcegm_paper.create_state_space_function_dict()¶
Create dictionary with state space functions.
- Returns:
Dictionary with state space functions.
- Return type:
state_space_functions (dict)
- dcegm.toy_models.cons_ret_model_dcegm_paper.get_state_specific_feasible_choice_set(lagged_choice: int, model_specs: Dict) numpy.ndarray¶
Select state-specific feasible choice set such that retirement is absorbing.
Will be a user defined function later.
This is very basic in Ishkakov et al (2017).
- Parameters:
state (np.ndarray) – Array of shape (n_state_variables,) defining the agent’s state. In Ishkakov, an agent’s state is defined by her (i) age (i.e. the current period) and (ii) her lagged labor market choice. Hence n_state_variables = 2.
map_state_to_state_space_index (np.ndarray) – Indexer array that maps a period-specific state vector to the respective index positions in the state space. The shape of this object is quite complicated. For each state variable it has the number of potential states as rows, i.e. (n_potential_states_state_var_1, n_potential_states_state_var_2, ….).
- Returns:
- 1d array of length (n_feasible_choices,) with the
agent’s (restricted) feasible choice set in the given state.
- Return type:
choice_set (np.ndarray)
- dcegm.toy_models.cons_ret_model_dcegm_paper.create_final_period_utility_function_dict()¶
Create dictionary with utility functions for the final period.
- Returns:
- Dictionary with utility functions
for the final period.
- Return type:
utility_functions_final_period (dict)
- dcegm.toy_models.cons_ret_model_dcegm_paper.create_utility_function_dict()¶
Create dictionary with utility functions.
- Returns:
Dictionary with utility functions.
- Return type:
utility_functions (dict)
- dcegm.toy_models.cons_ret_model_dcegm_paper.inverse_marginal_utility_crra(marginal_utility: jax.numpy.array, params: Dict[str, float]) jax.numpy.array¶
Computes the inverse marginal utility of a CRRA utility function.
- Parameters:
marginal_utility (jnp.array) – Level of marginal CRRA utility. Array of shape (n_grid_wealth,).
params (dict) – Dictionary containing model parameters.
- Returns:
- Inverse of the marginal utility of
a CRRA consumption function. Array of shape (n_grid_wealth,).
- Return type:
inverse_marginal_utility(jnp.array)
- dcegm.toy_models.cons_ret_model_dcegm_paper.marginal_utility_crra(consumption: jax.numpy.array, params: Dict[str, float]) jax.numpy.array¶
Computes marginal utility of CRRA utility function.
- Parameters:
consumption (jnp.array) – Level of the agent’s consumption. Array of shape (n_quad_stochastic * n_grid_wealth,).
params (dict) – Dictionary containing model parameters. Relevant here is the CRRA coefficient theta.
- Returns:
- Marginal utility of CRRA consumption
function. Array of shape (n_quad_stochastic * n_grid_wealth,).
- Return type:
marginal_utility (jnp.array)
- dcegm.toy_models.cons_ret_model_dcegm_paper.marginal_utility_final_consume_all(choice, wealth: jax.numpy.array, params: Dict[str, float], model_specs: Dict[str, Any]) jax.numpy.array¶
Computes marginal utility of CRRA utility function.
- Parameters:
consumption (jnp.array) – Level of the agent’s consumption. Array of shape (n_quad_stochastic * n_grid_wealth,).
params (dict) – Dictionary containing model parameters. Relevant here is the CRRA coefficient theta.
- Returns:
- Marginal utility of CRRA consumption
function. Array of shape (n_quad_stochastic * n_grid_wealth,).
- Return type:
marginal_utility (jnp.array)
- dcegm.toy_models.cons_ret_model_dcegm_paper.utility_crra(consumption: jax.numpy.array, choice: int, params: Dict[str, float]) jax.numpy.array¶
Computes the agent’s current utility based on a CRRA utility function.
- Parameters:
consumption (jnp.array) – Level of the agent’s consumption. Array of shape (i) (n_quad_stochastic * n_grid_wealth,) when called by
map_exog_to_endog_grid()andget_next_period_value(), or (ii) of shape (n_grid_wealth,) when called byget_current_period_value().choice (int) – Choice of the agent, e.g. 0 = “retirement”, 1 = “working”.
params (dict) – Dictionary containing model parameters. Relevant here is the CRRA coefficient theta.
- Returns:
- Agent’s utility . Array of shape
(n_quad_stochastic * n_grid_wealth,) or (n_grid_wealth,).
- Return type:
utility (jnp.array)
- dcegm.toy_models.cons_ret_model_dcegm_paper.utility_final_consume_all(choice: int, wealth: jax.numpy.array, params: Dict[str, float])¶