VFI Toolkit can now do a ‘second layer’ of interpolation on a finer grid. Currently this works for all the baseline finite-horizon problems, it will gradually roll-out to everything else.
As user you just set
vfoptions.gridinterplayer=1
which tells toolkit to use a ‘gridded interpolation layer’, and then use
vfoptions.ngridinterp=5
to say how many points to use for the interpolation.
And then you put the same into simoptions.
Idea is that if you have, say, n_a=20 (and so a_grid is 20-by-1), then between every two consecutive points on the a_grid it will put vfoptions.ngridinterp evenly spaced points. Conceptually, the problem we want to solve is using aprime_grid=interp1(1:1:N_a,a_grid,linspace(1,N_a,N_a+(N_a-1)*vfoptions.ngridinterpt)); (N_a=prod(n_a);) We evaluate the ReturnFn exactly on this aprime_grid, and we linearly interpolate E[V] (the expected next period value function) from a_grid onto aprime_grid.
This pdf explains what grid interpolation layer is and provides pseudocode. Following is intended to give you the intuition.
In the ‘first layer’ the codes just do the usual thing of solving ‘pure discretization’ with the 20 points on next period assets (the same points used for current assets, so a_grid). This gives us the optimal aprime index (on the a_grid).
In the 'second layer’, the codes consider the range for aprime from one a_grid point below the optimal aprime index to one point above, and puts ‘vfoptions.ngridinterp’ points between each of the original grid points, so considers a total of 2*vfoptions.ngridinterp+3 points. This is done conditional on any decision variables, d. Finally find the optimal of these, using exact valuation of the ReturnFn, and linear interpolation of E[V].
The output for the value function is essentially the same, and the interpretation is identical. The output for the policy function now contains two indexes for the aprime value, the first is a ‘lower grid point’ and the second is from 1-to-(vfoptions.ngridinterp+2) and the two endpoints represent the lower grid point and the upper grid point (and the rest count the evenly spaced points we interpolated onto).
You can use divide-and-conquer (vfoptions.divideandconquer=1) together with grid interpolation layer. In this case, there are the same two layers as described above, and divide-and-conquer is used to solve the first layer.