HARK.dcegm¶
Functions for working with the discretecontinuous EGM (DCEGM) algorithm as described in “The endogenous grid method for discretecontinuous dynamic choice models with (or without) taste shocks” by Iskhakov et al. (2016) [https://doi.org/10.3982/QE643 and ijrsDCEGM2017 in our Zotero]
Example can be found in https://github.com/econark/DemARK/blob/master/notebooks/DCEGMUpperEnvelope.ipynb

HARK.dcegm.
calcMultilineEnvelope
(M, C, V_T, commonM)¶ Do the envelope step of the DCEGM algorithm. Takes in market ressources, consumption levels, and inverse values from the EGM step. These represent (m, c) pairs that solve the necessary first order conditions. This function calculates the optimal (m, c, v_t) pairs on the commonM grid.
Parameters:  M (np.array) – market ressources from EGM step
 C (np.array) – consumption from EGM step
 V_T (np.array) – transformed values at the EGM grid
 commonM (np.array) – common grid to do upper envelope calculations on

HARK.dcegm.
calcSegments
(x, v)¶ Find index vectors rise and fall such that rise holds the indeces i such that x[i+1]>x[i] and fall holds indeces j such that either  x[j+1] < x[j] or,  x[j]>x[j1] and v[j]<v[j1].
The vectors are essential to the DCEGM algorithm, as they definite the relevant intervals to be used to construct the upper envelope of potential solutions to the (necessary) first order conditions.
Parameters:  x (np.ndarray) – array of points where v is evaluated
 v (np.ndarray) – array of values of some function of x
Returns:  rise (np.ndarray) – see description above
 fall (np.ndarray) – see description above