\documentclass[./BufferStockTheory.tex]{subfiles}


\begin{document}

%\begin{verbatimwrite}{\ApndxDir/ApndxSolnMethEndogGpts.tex}
\section{Endogenous Gridpoints Solution Method}

  The model is solved using an extension of the method of endogenous
  gridpoints (\cite{BufferStockTheory}): A grid of possible values of
  end-of-period assets $\vec{\aRat}$ is defined (\texttt{aVec} in the
  software), and at these points, marginal end-of-period-$t$ value is
  computed as the discounted next-period expected marginal utility of
  consumption (which the Envelope theorem says matches expected
  marginal value).  The results are then used to identify the
  corresponding levels of consumption at the beginning of the period:\footnote{The software can also
solve a version of the model with explicit liquidity constraints, where the Envelope condition does not hold.}

\begin{eqnarray}
  \uP(\cEndFunc_{t}(\vec{\aRat})) & = & \Rfree \beta \Ex_{t}[ \uP(\PGro_{t+1}
  \cFunc_{t+1}(\Rnorm_{t+1}\vec{\aRat} + \tShk_{t+1}))] \label{eq:cEulerEndog}
\\ \vec{c}_{t} \equiv \cEndFunc_{t}(\vec{\aRat}) & = & \left(\Rfree \beta \Ex_{t}\left[ \left(\PGro_{t+1}
      \cFunc_{t+1}(\Rnorm_{t+1}\vec{\aRat} +
      \tShk_{t+1})\right)^{-\CRRA}\right]\right)^{-1/\CRRA}. \notag
\end{eqnarray}

The dynamic budget constraint can then be used to generate the corresponding $\mRat$'s:
\begin{eqnarray*}
  \vec{\mRat}_{t} & = & \vec{\aRat}+\vec{c}_{t}.
\end{eqnarray*}

An approximation to the consumption function could be constructed by
linear interpolation between the $\{\vec{\mRat},\vec{\cRat}\}$ points.
But a vastly more accurate approximation can be made (for a given
number of gridpoints) if the interpolation is constructed so that it
also matches the marginal propensity to consume at the gridpoints. Differentiating \eqref{eq:cEulerEndog}
with respect to $\aRat$ (and dropping policy function arguments for
simplicity) yields a marginal propensity to {\it have consumed} $\cEndFunc^{\aRat}$ at
each gridpoint:
\begin{eqnarray}
\uPP(\cEndFunc_{t})\cEndFunc_{t}^{\aRat} & = & \Rfree \beta \Ex_{t}[\uPP(\PGro_{t+1} \cFunc_{t+1})\PGro_{t+1} \cFunc^{\mRat}_{t+1}\Rnorm_{t+1}] \notag
\\ & = & \Rfree \beta \Ex_{t}[\uPP(\PGro_{t+1} \cFunc_{t+1}) \Rfree \cFunc^{\mRat}_{t+1}] \notag
\\ \cEndFunc_{t}^{\aRat} & = & \Rfree \beta \Ex_{t}[\uPP(\PGro_{t+1}  \cFunc_{t+1}) \Rfree \cFunc^{\mRat}_{t+1}]/\uPP(\cEndFunc_{t}) \label{eq:MPTHC}
\end{eqnarray}
and the marginal propensity to consume at the beginning of the period is obtained from the marginal
propensity to have consumed by noting that, if we define $\mathfrak{m}(a) = \cEndFunc(a)-a$,
\begin{eqnarray*}
   \cRat & = & \mathfrak{m}-\aRat
\\ \cEndFunc^{\aRat}+1 & = & \mathfrak{m}^{\aRat}
\end{eqnarray*}
which, together with the chain rule $\cEndFunc^{\aRat}  = \cFunc^{\mRat}\mathfrak{m}^{\aRat}$,
yields the MPC from

\begin{eqnarray*}
   \cFunc^{\mRat}(\cEndFunc^{\aRat}+1) & = & \cEndFunc^{\aRat}
\\ \cFunc^{\mRat} & = & \cEndFunc^{\aRat}/(1+\cEndFunc^{\aRat}) \label{eq:MPCfromMPTHC}
\end{eqnarray*}
and we call the vector of MPC's at the $\vec{\mRat}_{t}$ gridpoints $\vec{\MPC}_{t}$.
\begin{comment}

Standard polynomial interpolation methods can then be used to
construct a function that matches the level and first derivative at a
set of points; the actual solution code uses the built-in
interpolation tools of {\it Mathematica} for this purpose.

With the level and derivative of the consumption function defined at a discrete set of gridpoints,
it is possible to construct an interpolating function that is a highly accurate approximation to
the true consumption function within the grid.  But if any such interpolation is extended beyond the
boundaries defined by the minimum and maximum gridpoints, it is sure to go badly astray.

A solution to this problem is given by defining a `precautionary savings function':
\begin{eqnarray}
  \sFunc_{t}(\mRat) & = & \bar{\cFunc}_{t}(\mRat) - \cFunc_{t}(\mRat)
\end{eqnarray}
which measures the difference between the unconstrained perfect foresight solution to the problem (which
will always exist for any finite horizon) and the solution in the presence of uncertainty.
Note further that
\begin{eqnarray}
  \sFunc_{t}^{\prime}(\mRat) & = & \MinMPC_{t} - \MPC_{t}(\mRat).
\end{eqnarray}
It turns out, conveniently, that the limiting relationship between $\log \sFunc_{t}(\mRat)$ and
$\mu \equiv \log \mRat$ is linear.  Thus we can define
\begin{eqnarray}
  \varsigma_{t}(\mu) & = & \log \sFunc_{t}(\exp(\mu))
\end{eqnarray}
so that
\begin{eqnarray}
  \varsigma_{t}^{\prime} & = & \left(\frac{d \varsigma_{t}(\mRat)}{d \mRat}\frac{d \mRat}{d \mu}\right)
\\ & = & \left(\frac{\sFunc_{t}^{\prime}(\mRat)}{\sFunc_{t}(\mRat)}\frac{d e^{\mu}}{d \mu}\right)
\\ & = & \left(\frac{\sFunc_{t}^{\prime}(\mRat)e^{\mu}}{\sFunc_{t}(\mRat)}\right)
\end{eqnarray}
so that we can approximate the $\sFunc$ function by assembling
the level and first derivative of the $\varsigma$ function at the $\vec{m}$ gridpoints, and
using standard polynomial interpolation methods for the value of the function between the points.
Designating the approximated function by $\hat{\varsigma}_{t}$, the level of consumption can
be obtained from\footnote{The actual procedure adds 1 to $\mRat$ before constructing the approximating function, to avoid problems caused by the fact that the lowest value of $\mRat$ for which we want to be able to
evaluate the function is $\mRat=0$ but $\log 0 = -\infty$ which is difficult for the computer to handle.}
\begin{eqnarray}
  \hat{\cFunc}_{t}(\mRat) & = & \bar{\cFunc}_{t}(\mRat)-\exp(\hat{\varsigma}_{t}(\log \mRat)).
\end{eqnarray}
\end{comment}


%\end{verbatimwrite}%\input {\ApndxDir/ApndxSolnMethEndogGpts.tex}

% When compiling main file, bibliography goes at the end of document, not at the end of this appendix
\onlyinsubfile{
\clearpage\vfill\eject

\normalsize


\write18{if [ ! -f \texname.bib     ]; then touch \texname.bib     ; fi}
\write18{if [ ! -f \texname-Add.bib ]; then touch \texname-Add.bib ; fi}

\bibliographystyle{\econtexBibStyle}
\bibliography{economics,\texname,\texname-Add}
}

\end{document}
