:py:mod:`respy.solve` ===================== .. py:module:: respy.solve .. autoapi-nested-parse:: Everything related to the solution of a structural model. .. !! processed by numpydoc !! Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: respy.solve.get_solve_func respy.solve.solve respy.solve._create_param_specific_objects respy.solve._create_choice_rewards respy.solve._solve_with_backward_induction respy.solve._full_solution .. py:function:: get_solve_func(params, options) Get the solve function. This function takes a model specification and returns the state space of the model along with components of the solution such as covariates, non-pecuniary rewards, wages, continuation values and expected value functions as attributes of the class. :Parameters: **params** : :obj:`pandas.DataFrame` DataFrame containing parameter series. **options** : :class:`python:dict` Dictionary containing model attributes which are not optimized. :Returns: **solve** : :func:`~respy.solve.solve` Function with partialed arguments. .. rubric:: Examples >>> import respy as rp >>> params, options = rp.get_example_model("robinson_crusoe_basic", with_data=False) >>> solve = rp.get_solve_func(params, options) >>> state_space = solve(params) .. !! processed by numpydoc !! .. py:function:: solve(params, options, state_space) Solve the model. .. !! processed by numpydoc !! .. py:function:: _create_param_specific_objects(complex_, choice_set, optim_paras, options, dense_key_to_dense_covariates, transit_keys=None) Create param specific objects. This function creates objects that are not fixed for a given model. Depending on their size they are either kept in working memory such as wages or dumped on disk such as transition probabilities! In the medium run we could also allow for fixed params here by saving values on disk directly! For objects that we store on disk we will just return the prefix of the location. .. !! processed by numpydoc !! .. py:function:: _create_choice_rewards(states, choice_set, optim_paras) Create wage and non-pecuniary reward for each state and choice. .. !! processed by numpydoc !! .. py:function:: _solve_with_backward_induction(state_space, optim_paras, options) Calculate utilities with backward induction. The expected value functions in one period are only computed by interpolation if: 1. Interpolation is requested. 2. If there are more states in the period than interpolation points. 3. If there are at least two interpolation points per `dense_index`. :Parameters: **state_space** : :class:`~respy.state_space.StateSpace` State space of the model which is not solved yet. **optim_paras** : :class:`python:dict` Parsed model parameters affected by the optimization. **options** : :class:`python:dict` Optimization independent model options. :Returns: **state_space** : :class:`~respy.state_space.StateSpace` .. .. !! processed by numpydoc !! .. py:function:: _full_solution(wages, nonpecs, continuation_values, period_draws_emax_risk, optim_paras) Calculate the full solution of the model. In contrast to approximate solution, the Monte Carlo integration is done for each state and not only a subset of states. .. !! processed by numpydoc !!