We introduce a computational technique- precomputation of integrals - that makes it possible to construct conditional expectation functions in dynamic stochastic models in the initial stage of a solution procedure. This technique is very general: it works for a broad class of approximating functions, including piecewise polynomials; it can be applied to both Bellman and Euler equations; and it is compatible with both continuous-state and discrete-state shocks. In the case of normally distributed shocks, the integrals can be constructed in a closed form. After the integrals are precomputed, we can solve stochastic models as if they were deterministic. We illustrate this technique using one- and multi-agent growth models with continuous-state shocks (and up to 60 state variables), as well as Aiyagari's ( 1994) model with discrete-state shocks. Precomputation of integrals saves programming efforts, reduces computational burden, and increases the accuracy of solutions. It is of special value in computationally intense applications. MATLAB codes are provided.
Dynamic model precomputation numerical integration dynamic programming value function iteration Bellman equation Euler equation envelope condition method endogenous grid method Aiyagari model