dcegm.pre_processing.model_structure.state_choice_space¶
Functions¶
Create state choice space of all feasible state-choice combinations. |
|
|
Test state space objects for consistency. |
|
Conduct several checks on the endogenous state update function. |
Module Contents¶
- dcegm.pre_processing.model_structure.state_choice_space.create_state_choice_space_and_child_state_mapping(model_config, state_specific_choice_set, next_period_deterministic_state, state_space_arrays)¶
Create state choice space of all feasible state-choice combinations.
Also conditional on any realization of exogenous processes.
- Parameters:
state_space (np.ndarray) – 2d array of shape (n_states, n_state_vars + 1) which serves as a collection of all possible states. By convention, the first column must contain the period and the last column the exogenous state. Any other state variables are in between. E.g. if the two state variables are period and lagged choice and all choices are admissible in each period, the shape of the state space array is (n_periods * n_choices, 3).
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, ….).
state_specific_choice_set (Callable) – User-supplied function that returns the set of feasible choices for a given state.
- Returns:
- state_choice_space(np.ndarray): 2d array of shape
(n_feasible_state_choice_combs, n_state_and_exog_variables + 1) containing the space of all feasible state-choice combinations. By convention, the second to last column contains the exogenous process. The last column always contains the choice to be made at the end of the period (which is not a state variable).
- map_state_choice_vec_to_parent_state (np.ndarray): 1d array of shape
(n_states * n_feasible_choices,) that maps from any vector of state-choice combinations to the respective parent state.
- reshape_state_choice_vec_to_mat (np.ndarray): 2d array of shape
(n_states, n_feasible_choices). For each parent state, this array can be used to reshape the vector of feasible state-choice combinations to a matrix of lagged and current choice combinations of shape (n_choices, n_choices).
- transform_between_state_and_state_choice_space (np.ndarray): 2d boolean
array of shape (n_states, n_states * n_feasible_choices) indicating which state belongs to which state-choice combination in the entire state and state choice space. The array is used to (i) contract state-choice level arrays to the state level by summing
over state-choice combinations.
to expand state level arrays to the state-choice level.
- Return type:
tuple
- dcegm.pre_processing.model_structure.state_choice_space.test_child_state_mapping(model_config, state_choice_space, state_space, map_state_choice_to_child_states, discrete_states_names)¶
Test state space objects for consistency.
- dcegm.pre_processing.model_structure.state_choice_space.check_endog_update_function(endog_state_update, this_period_state, choice, stochastic_state_names)¶
Conduct several checks on the endogenous state update function.