View and download the notebook here!

Numerical Integration#

One important component of the solution to the DCDP problem in respy models is numerical integration. A bottleneck in solving and estimating the model is the solution of the expected value function, the so-called \(EMax(\cdot)\). Solving the \(EMax(\cdot)\) requires us to solve a multi-dimensional integral at every point in the state space. The integrated value function does not have an analytical solution and thus requires the application of numerical methods.

As the models become more complex, the computational burden increases as adding new features to the model increases the required number of function evaluations, which are the costly operation in numerical integration. Numerical integration usually uses monte carlo simulation. Results from applied mathematics, however, suggest methods that are more efficient and thus enable a performance increase. For the same number of function evaluations (and hence computational cost) quasi-Monte Carlo methods achieve a significantly higher accuracy. respy thus enables users to select between various methods for the numerical approximation of the \(EMax(\cdot)\). The numerical integration is controlled in the options of a specified model.

[2]:
import respy as rp
_, options = rp.get_example_model("kw_94_one", with_data=False)

Numerical integration method#

The option monte_carlo_sequence controls how points are drawn.

  • random: Points are drawn randomly (crude Monte Carlo).

  • sobol or halton: Points are drawn from low-discrepancy sequences (superiority in coverage). This means a given approximation error can be achieved with less points.

Note: respy relies on chaospy for the sobol and halton sequence. You need to install it in addition to respy.

[3]:
options["monte_carlo_sequence"]
[3]:
'random'

Solution draws#

The number of solution draws controls how many points are used to evaluate an integral. You can specify them using the option solution_draws.

[4]:
options["solution_draws"]
[4]:
500

Increasing the number of solution draws increases the accuracy of the solution at the cost of the computational burden.

Project Find an exploration of numerical integration methods in EKW models in Improving the Numerical Integration.