Skip to article content
Back to Article
The Sequential Endogenous Grid Method
Download Article

The Sequential Endogenous Grid Method

1A basic model

The baseline problem which I will use to demonstrate the Sequential Endogenous Grid Method (EGMn) is a discrete time version of Bodie et al. (1992) where a consumer has the ability to adjust their labor as well as their consumption in response to financial risk. The objective consists of maximizing the present discounted lifetime utility of consumption and leisure.

V0(B0,θ0)=maxEt[n=0Ttβnu(Ct+n,Zt+n)]\VFunc_0(\BLev_0, \tShkEmp_0) = \max \Ex_{t} \left[ \sum_{n = 0}^{T-t} \DiscFac^{n} \utilFunc(\CLev_{t+n}, \Leisure_{t+n}) \right]

In particular, this example makes use of a utility function that is based on Example 1 in the paper, which is that of additively separable utility of labor and leisure as

u(C,Z)=u(C)+h(Z)=C1ρ1ρ+ν1ρZ1ζ1ζ\utilFunc(\CLev, \Leisure) = \util(\CLev) + \h(\Leisure) = \frac{C^{1-\CRRA}}{1-\CRRA} + \labShare^{1-\CRRA} \frac{\Leisure^{1-\leiShare}}{1-\leiShare}

where the term ν1ρ\labShare^{1-\CRRA} is introduced to allow for a balanced growth path as in Mertens & Ravn (2011). The use of additively separable utility is ad-hoc, as it will allow for the use of multiple EGM steps in the solution process, as we’ll see later.

This model represents a consumer who begins the period with a level of bank balances bt\bRat_{t} and a given wage offer θt\tShkEmp_{t}. Simultaneously, they are able to choose consumption, labor intensity, and a risky portfolio share with the objective of maximizing their utility of consumption and leisure, as well as their future wealth.

The problem can be written in normalized recursive form[1] as

vt(bt,θt)=max{ct,zt,ςt}u(ct,zt)+βEt[Γt+11ρvt+1(bt+1,θt+1)]s.t.t=1ztmt=bt+θttat=mtctRt+1=R+(Rt+1R)ςtbt+1=atRt+1/Γt+1\begin{split} \vFunc_{t}(\bRat_{t}, \tShkEmp_{t}) & = \max_{\{\cRat_{t}, \leisure_{t}, \riskyshare_{t}\}} \utilFunc(\cRat_{t}, \leisure_{t}) + \DiscFac \Ex_{t} \left[ \PGro_{t+1}^{1-\CRRA} \vFunc_{t+1} (\bRat_{t+1}, \tShkEmp_{t+1}) \right] \\ & \text{s.t.} \\ \labor_{t} & = 1 - \leisure_{t} \\ \mRat_{t} & = \bRat_{t} + \tShkEmp_{t}\labor_{t} \\ \aRat_{t} & = \mRat_{t} - \cRat_{t} \\ \Rport_{t+1} & = \Rfree + (\Risky_{t+1} - \Rfree) \riskyshare_{t} \\ \bRat_{t+1} & = \aRat_{t} \Rport_{t+1} / \PGro_{t+1} \end{split}

in which t\labor_{t} is the time supplied to labor net of leisure, mt\mRat_{t} is the market resources totaling bank balances and labor income, at\aRat_{t} is the amount of saving assets held by the consumer, and ςt\riskyshare_{t} is the risky share of assets, which induce a Rt+1\Rport_{t+1} return on portfolio that results in next period’s bank balances bt+1\bRat_{t+1} normalized by next period’s permanent income Γt+1\PGro_{t+1}.

2Restating the problem sequentially

We can make a few choices to create a sequential problem which will allow us to use multiple EGM steps in succession. First, the agent decides their labor-leisure trade-off and receives a wage. Their wage plus their previous bank balance then becomes their market resources. Second, given market resources, the agent makes a pure consumption-saving decision. Finally, given an amount of savings, the consumer then decides their risky portfolio share.

Starting from the beginning of the period, we can define the labor-leisure problem as

vt(bt,θt)=maxzth(zt)+v~t(mt)s.t.0zt1t=1ztmt=bt+θtt.\begin{split} \vFunc_{t}(\bRat_{t}, \tShkEmp_{t}) & = \max_{ \leisure_{t}} \h(\leisure_{t}) + \vOpt_{t} (\mRat_{t}) \\ & \text{s.t.} \\ 0 & \leq \leisure_{t} \leq 1 \\ \labor_{t} & = 1 - \leisure_{t} \\ \mRat_{t} & = \bRat_{t} + \tShkEmp_{t}\labor_{t}. \end{split}

The pure consumption-saving problem is then

v~t(mt)=maxctu(ct)+βvt(at)s.t.0ctmtat=mtct.\begin{split} \vOpt_{t}(\mRat_{t}) & = \max_{\cRat_{t}} \util(\cRat_{t}) + \DiscFac\vEnd_{t}(\aRat_{t}) \\ & \text{s.t.} \\ 0 & \leq \cRat_{t} \leq \mRat_{t} \\ \aRat_{t} & = \mRat_{t} - \cRat_{t}. \end{split}

Finally, the risky portfolio problem is

vt(at)=maxςtEt[Γt+11ρvt+1(bt+1,θt+1)]s.t.0ςt1Rt+1=R+(Rt+1R)ςtbt+1=atRt+1/Γt+1.\begin{split} \vEnd_{t}(\aRat_{t}) & = \max_{\riskyshare_{t}} \Ex_{t} \left[ \PGro_{t+1}^{1-\CRRA} \vFunc_{t+1}(\bRat_{t+1}, \tShkEmp_{t+1}) \right] \\ & \text{s.t.} \\ 0 & \leq \riskyshare_{t} \leq 1 \\ \Rport_{t+1} & = \Rfree + (\Risky_{t+1} - \Rfree) \riskyshare_{t} \\ \bRat_{t+1} & = \aRat_{t} \Rport_{t+1} / \PGro_{t+1}. \end{split}

This sequential approach is explicitly modeled after the nested approaches explored in Clausen & Strub (2020) and Druedahl (2021). However, I will offer additional insights that expand on these methods. An important observation is that now, every single choice is self-contained in a subproblem, and although the structure is specifically chosen to minimize the number of state variables at every stage, the problem does not change by this structural imposition. This is because there is no additional information or realization of uncertainty that happens between decisions, as can be seen by the expectation operator being in the last subproblem. From the perspective of the consumer, these decisions are essentially simultaneous, but a careful organization into sub-period problems enables us to solve the model more efficiently and can provide key economic insights. In this problem, as we will see, a key insight will be the ability to explicitly calculate the marginal value of wealth and the Frisch elasticity of labor.

3The portfolio decision subproblem

As useful as it is to be able to use the EGM step more than once, there are clear problems where the EGM step is not applicable. This basic labor-portfolio choice problem demonstrates where we can use an additional EGM step, and where we can not. First, we go over a subproblem where we can not use the EGM step.

In reorganizing the labor-portfolio problem into subproblems, we assigned the utility of leisure to the leisure-labor subproblem and the utility of consumption to the consumption-savings subproblem. There are no more separable convex utility functions to assign to this problem, and even if we re-organized the problem in a way that moved one of the utility functions into this subproblem, they would not be useful in solving this subproblem via EGM as there is no direct relation between the risky share of portfolio and consumption or leisure. Therefore, the only way to solve this subproblem is through standard convex optimization and root-finding techniques.

Restating the problem in compact form gives

vt(at)=maxςtEt[Γt+11ρvt+1(at(R+(Rt+1R)ςt),θt+1)].\vEnd_{t}(\aRat_{t}) = \max_{\riskyshare_{t}} \Ex_{t} \left[ \PGro_{t+1}^{1-\CRRA} \vFunc_{t+1}\left(\aRat_{t}(\Rfree + (\Risky_{t+1} - \Rfree) \riskyshare_{t}), \tShkEmp_{t+1}\right) \right].

The first-order condition with respect to the risky portfolio share is then

Et[Γt+1ρvt+1b(bt+1,θt+1)(Rt+1R)]=0.\Ex_{t} \left[ \PGro_{t+1}^{-\CRRA} \vFunc_{t+1}^{\bRat}\left(\bRat_{t+1}, \tShkEmp_{t+1}\right) (\Risky_{t+1} - \Rfree) \right] = 0.

Finding the optimal risky share requires numerical optimization and root-solving of the first-order condition. To close out the problem, we can calculate the envelope condition as

vt(at)=Et[Γt+1ρvt+1b(bt+1,θt+1)Rt+1].\vEnd_{t}'(\aRat_{t}) = \Ex_{t} \left[ \PGro_{t+1}^{-\CRRA} \vFunc_{t+1}^{\bRat}\left(\bRat_{t+1}, \tShkEmp_{t+1}\right) \Rport_{t+1} \right].

3.1A note on avoiding taking expectations more than once

We could instead define the portfolio choice subproblem as:

vt(at)=maxςtv~ˋ(at,ςt)\vEnd_{t}(\aRat_{t}) = \max_{\riskyshare_{t}} \vOptAlt(\aRat_{t}, \riskyshare_{t})

where

v~ˋt(at,ςt)=Et[Γt+11ρvt+1(bt+1,θt+1)]Rt+1=R+(Rt+1R)ςtbt+1=atRt+1/Γt+1\begin{split} \vOptAlt_{t}(\aRat_{t}, \riskyshare_{t}) & = \Ex_{t} \left[ \PGro_{t+1}^{1-\CRRA} \vFunc_{t+1}\left(\bRat_{t+1}, \tShkEmp_{t+1}\right) \right] \\ \Rport_{t+1} & = \Rfree + (\Risky_{t+1} - \Rfree) \riskyshare_{t} \\ \bRat_{t+1} & = \aRat_{t} \Rport_{t+1} / \PGro_{t+1} \end{split}

In this case, the process is similar. The only difference is that we don’t have to take expectations more than once. Given the next period’s solution, we can calculate the marginal value functions as:

v~ˋta(at,ςt)=Et[Γt+1ρvt+1(bt+1,θt+1)Rt+1]v~ˋtς(at,ςt)=Et[Γt+1ρvt+1(bt+1,θt+1)at(Rt+1R)]\begin{split} \vOptAlt_{t}^{\aRat}(\aRat_{t}, \riskyshare_{t}) & = \Ex_{t} \left[ \PGro_{t+1}^{-\CRRA} \vFunc_{t+1}'\left(\bRat_{t+1}, \tShkEmp_{t+1}\right) \Rport_{t+1} \right] \\ \vOptAlt_{t}^{\riskyshare}(\aRat_{t}, \riskyshare_{t}) & = \Ex_{t} \left[ \PGro_{t+1}^{-\CRRA} \vFunc_{t+1}'\left(\bRat_{t+1}, \tShkEmp_{t+1}\right) \aRat_{t} (\Risky_{t+1} - \Rfree) \right] \\ \end{split}

If we are clever, we can calculate both of these in one step. Now, the optimal risky share can be found by the first-order condition and we can use it to evaluate the envelope condition.

F.O.C.:v~ˋtς(at,ςt)=0E.C.:vta(at)=v~ˋta(at,ςt)\text{F.O.C.:} \qquad \vOptAlt_{t}^{\riskyshare}(\aRat_{t}, \riskyshare_{t}^{*}) = 0 \qquad \text{E.C.:} \qquad \vEnd_{t}^{\aRat}(\aRat_{t}) = \vOptAlt_{t}^{\aRat}(\aRat_{t}, \riskyshare_{t}^{*})

4The consumption-saving subproblem

The consumption-saving EGM follows Carroll (2006) but I will cover it for exposition. We can begin the solution process by restating the consumption-savings subproblem in a more compact form, substituting the market resources constraint and ignoring the no-borrowing constraint for now. The problem is:

v~t(mt)=maxctu(ct)+βvt(mtct)\vOpt_{t}(\mRat_{t}) = \max_{\cRat_{t}} \util(\cRat_{t}) + \DiscFac \vEnd_{t}(\mRat_{t}-\cRat_{t})

To solve, we derive the first-order condition with respect to ct\cRat_{t} which gives the familiar Euler equation:

u(ct)=βvt(mtct)=βvt(at)\utilFunc'(\cRat_t) = \DiscFac \vEnd_{t}'(\mRat_{t} - \cRat_{t}) = \DiscFac \vEnd_{t}'(\aRat_{t})

Inverting the above equation is the (first) EGM step.

ct(at)=u1(βvt(at))\cEndFunc_{t}(\aRat_{t}) = \utilFunc'^{-1}\left( \DiscFac \vEnd_{t}'(\aRat_{t}) \right)

Given the utility function above, the marginal utility of consumption and its inverse are

u(c)=cρu1(x)=x1/ρ.\utilFunc'(\cRat) = \cRat^{-\CRRA} \qquad \utilFunc'^{-1}(\xRat) = \xRat^{-1/\CRRA}.

Carroll (2006) demonstrates that by using an exogenous grid of [a]\aMat points we can find the unique ct([a])\cEndFunc_{t}(\aMat) that optimizes the consumption-saving problem, since the first-order condition is necessary and sufficient. Further, using the market resources constraint, we can recover the exact amount of market resources that is consistent with this consumption-saving decision as

mt([a])=ct([a])+[a].\mEndFunc_{t}(\aMat) = \cEndFunc_{t}(\aMat) + \aMat.

This mt([a])\mEndFunc_{t}(\aMat) is the ``endogenous’’ grid that is consistent with the exogenous decision grid [a]\aMat. Now that we have a (mt([a]),ct([a]))(\mEndFunc_{t}(\aMat), \cEndFunc_{t}(\aMat)) pair for each a[a]\aRat \in \aMat, we can construct an interpolating consumption function for market resources points that are off-the-grid.

The envelope condition will be useful in the next section, but for completeness is defined here.

v~t(mt)=βvt(at)=u(ct)\vOpt_{t}'(\mRat_{t}) = \DiscFac \vEnd_{t}'(\aRat_{t}) = \utilFunc'(\cRat_{t})

5The labor-leisure subproblem

The labor-leisure subproblem can be restated more compactly as:

vt(bt,θt)=maxzth(zt)+v~t(bt+θt(1zt))\vFunc_{t}(\bRat_{t}, \tShkEmp_{t}) = \max_{ \leisure_{t}} \h(\leisure_{t}) + \vOpt_{t}(\bRat_{t} + \tShkEmp_{t}(1-\leisure_{t}))

The first-order condition with respect to leisure implies the labor-leisure Euler equation

h(zt)=v~t(mt)θt\h'(\leisure_{t}) = \vOpt_{t}'(\mRat_{t}) \tShkEmp_{t}

The marginal utility of leisure and its inverse are

h(z)=νzζh1(x)=(x/ν)1/ζ\h'(\leisure) = \labShare\leisure^{-\leiShare} \qquad \h'^{-1}(\xRat) = (\xRat/\labShare)^{-1/\leiShare}

Using an exogenous grid of [m]\mMat and [θ]\tShkMat, we can find leisure as

zt([m],[θ])=h1(v~t([m])[θ])\zEndFunc_{t}(\mMat, \tShkMat) = \h'^{-1}\left( \vOpt_{t}'(\mMat) \tShkMat \right)

In this case, it’s important to note that there are conditions for leisure itself. An agent with a small level of market resources mt\mRat_{t} might want to work more than their available time endowment, especially at higher levels of income θt\tShkEmp_{t}, if the utility of leisure is not enough to compensate for their low wealth. In these situations, the optimal unconstrained leisure might be negative, so we must impose a constraint on the optimal leisure function. This is similar to the treatment of an artificial borrowing constraint in the pure consumption subproblem. From now on, let’s call this constrained optimal function z^t([m],[θ])\hat{\zEndFunc}_{t}(\mMat, \tShkMat), where

z^t([m],[θ])=max[min[zt([m],[θ]),1],0]\hat{\zEndFunc}_{t}(\mMat, \tShkMat) = \max \left[ \min \left[ \zEndFunc_{t}(\mMat, \tShkMat), 1 \right], 0 \right]

Then, we derive labor as lt(mt,θt)=1z^t(mt,θt)\lEndFunc_{t}(\mRat_{t}, \tShkEmp_{t}) = 1 - \hat{\zEndFunc}_{t}(\mRat_{t}, \tShkEmp_{t}). Finally, for each θt\tShkEmp_{t} and mt\mRat_{t} as an exogenous grid, we can find the endogenous grid of bank balances as bt(mt,θt)=mtθtlt(mt,θt)\bEndFunc_{t}(\mRat_{t}, \tShkEmp_{t}) = \mRat_{t} - \tShkEmp_{t}\lEndFunc_{t}(\mRat_{t}, \tShkEmp_{t}).

The envelope condition then provides a heterogeneous Frisch elasticity of labor as simply

vtb(bt,θt)=v~t(mt)=h(zt)/θt.\vFunc_{t}^{b}(\bRat_{t}, \tShkEmp_{t}) = \vOpt_{t}'(\mRat_{t}) = \h'(\leisure_{t})/\tShkEmp_{t}.

6Alternative Parametrization

An alternative formulation for the utility of leisure is to state it in terms of the disutility of labor as in (references)

h()=ζ1+ν1+ν\h(\labor) = - \leiShare \frac{\labor^{1+\labShare}}{1+\labShare}

In this case, we can restate the problem as

h(z)=ζ(1z)1+ν1+ν\h(\leisure) = - \leiShare \frac{(1-\leisure)^{1+\labShare}}{1+\labShare}

The marginal utility of leisure and its inverse are

h(z)=ζ(1z)νh1(x)=1(x/ζ)1/ν\h'(\leisure) = \leiShare(1-\leisure)^{\labShare} \qquad \h'^{-1}(\xRat) = 1 - (\xRat/\leiShare)^{1/\labShare}

7Curvilinear Grids

Although EGMn seems to be a simple approach, there is one important caveat that we have not discussed, which is the details of the interpolation. In the pure consumption-savings problem, a one-dimensional exogenous grid of post-decision liquid assets [a]\aMat results in a one-dimensional endogenous grid of total market resources [m]\mMat. However, as we know from standard EGM, the spacing in the [m]\mMat grid is different from the spacing in the [a]\aMat grid as the inverted Euler equation is non-linear. This is no problem in a one-dimensional problem as we can simply use non-uniform linear interpolation.

However, the same is true of higher dimensional problems, where the exogenous grid gets mapped to a warped endogenous grid. In this case, it is not possible to use standard multi-linear interpolation, as the resulting endogenous grid is not rectilinear. Instead, I introduce a novel approach to interpolation that I call Warped Grid Interpolation (WGI), which is similar to White (2015)’s approach but computationally more efficient and robust. The details of this interpolation method will be further explained in Section 4, but for now, we show the resulting warped endogenous grid for the labor-leisure problem.

Warped Curvlinear Grid that results from multivariate EGM. This grid can be interpolated by WGI.

Figure 1:Warped Curvlinear Grid that results from multivariate EGM. This grid can be interpolated by WGI.

8Warped Grid Interpolation (WGI)

Assume we have a set of points indexed by (i,j)(i,j) in two-dimensional space for which we have corresponding functional values in a third dimension, such that f(xij,yij)=zijf(x_{ij},y_{ij}) = z_{ij}. In practice, we are interested in cases where the zijz_{ij} are difficult to compute and f(xij,yij)f(x_{ij},y_{ij}) is unknown, so we are unable to compute them at other values of xx and yy --- which is why we want to interpolate[2]. These (xij,yij)(x_{ij},y_{ij}) points however are not evenly spaced and do not form a rectilinear grid which would make it easy to interpolate the function off the grid. Nevertheless, these points do have a regular structure as we will see.

True function and curvilinear grid of points for which we know the value of the function.

Figure 2:True function and curvilinear grid of points for which we know the value of the function.

In Figure 2, we can see the true function in three-dimensional space, along with the points for which we actually know the value of the function. The underlying regular structure comes from the points’ position in the matrix, the (i,j)(i,j) coordinates. If we join the points along every row and every column, we can see that the resulting grid is regular and piecewise affine (curvilinear).

In Figure 3 we see the values of the function at their index coordinate points in the matrix. We can see that there exists a mapping between the curvilinear grid and the index coordinates of the matrix.

Homotopy between the curvilinear grid and the index coordinates of the matrix.

Figure 3:Homotopy between the curvilinear grid and the index coordinates of the matrix.

The objective is to be able to interpolate the value of the function at any point off the grid, where presumably we are only interested in points internal to the curvilinear space and not outside the boundaries. For example, we can imagine that we want an approximation to the function at the point (x,y)=(3,5)(x,y) = (3, 5) pictured Figure 4. If we could find the corresponding point in the coordinate grid, interpolation would be straightforward. We can find where the xx-coordinate of the point of interest intersects with the index-coordinates of the matrix. This is similar to assuming that we have 3 linear interpolators formed by connecting the points on the green lines in the x-direction, and for each interpolator we can approximate the corresponding y and z values using the grid data. Now, for each circle in Figure 4, we have a corresponding pair (y,z)(y,z), and we can interpolate in the y-direction to find the corresponding z-value for the point’s y-coordinate[3].

The method consist of extending the loci of points in the x dimension to find the corresponding crossing points in the y dimension.

Figure 4:The method consist of extending the loci of points in the xx dimension to find the corresponding crossing points in the yy dimension.

Footnotes
  1. As in Carroll (2009), where the utility of normalized consumption and leisure is defined as

    u(ct,zt)=Pt1ρct1ρ1ρ+(νPt)1ρzt1ζ1ζ\utilFunc(\cRat_{t}, \leisure_{t}) = \PLev_{t}^{1-\CRRA} \frac{\cRat_{t}^{1-\CRRA}}{1-\CRRA} + (\labShare\PLev_{t}) ^{1-\CRRA} \frac{\leisure_{t}^{1-\leiShare}}{1-\leiShare}
  2. For this illustration, we generate zz’s arbitrarily using the function

    f(x,y)=(xy)1/4.f(x,y) = (xy)^{1/4}.
  3. For more examples of the Warped Grid Interpolation method in action, see the github project alanlujan91/multinterp.

References
  1. Bodie, Z., Merton, R. C., & Samuelson, W. F. (1992). Labor supply flexibility and portfolio choice in a life cycle model. Journal of Economic Dynamics & Control, 16(3–4), 427–449. 10.1016/0165-1889(92)90044-F
  2. Mertens, K., & Ravn, M. O. (2011). Understanding the aggregate effects of anticipated and unanticipated tax policy shocks. Review of Economic Dynamics, 14(1), 27–54. 10.1016/j.red.2010.07.004
  3. Clausen, A., & Strub, C. (2020). Reverse calculus and nested optimization. Journal of Economic Theory, 187(105019), 105019. 10.1016/j.jet.2020.105019
  4. Druedahl, J. (2021). A Guide on Solving Non-convex Consumption-Saving Models. Computational Economics, 58(3), 747–775. 10.1007/s10614-020-10045-x
  5. Carroll, C. D. (2006). The method of endogenous gridpoints for solving dynamic stochastic optimization problems. Economics Letters, 91(3), 312–320. 10.1016/j.econlet.2005.09.013
Content
Introduction
Content
The EGM^n in Higher Dimensions