Patching utility functions
Some utility functions have singularity u(c) --> -infty
as c-->0
. CRRA utility, which is a good example, is one of the most popular specifications that are de facto standard in today’s macroeconomic modeling. However, the singularity u(c) --> -infty
as c
approaching zero brings annoying numerical challenges in practice. Even though in mathematics, such singularity ensures the optimal c >0
strictly, the numerical solvers, however, do not understand this implication and may try evaluating the Lagrangian/Hamiltonian at c >= 0
. This especially happens when the budget constraint leads to an irregular admissible space of c
and one is using interior point solvers.
A traditional numerical trick is to set a small tolerace d>0
:
$$ u(c) \approx \frac{1}{1-\gamma}(c+d)^{1-\gamma} $$
such that some small negative c
would not crash the whole program. Of course, the cost of such shifting operation is a little degree of risk aversion twist.
However, this trick is not good enough: how large should the d
be to handle all the millions of grid points in each iteration? If d
is too large, can we still claim that this is a CRRA utility?
Thus, a natural idea is to find a way to “extend” the CRRA utility function to the whole real line, while keeping the true CRRA utility function form without d
in the regions where the optimal solution locate.
To be accurate: by setting a small enough positive threshold m>0
, for any c<m
, we replace the true CRRA utility function with a smooth extrapolation. The patched CRRA utility function is a piecewise function:
$$ \hat{u}(c) = \begin{cases} \frac{1}{1-\gamma}c^{1-\gamma} , c \geq m \ P(c|m) , c < m \end{cases} $$
The extrapolation part P
is strictly monotonic and smooth enough. We call this operation as “patching”, i.e. cut off the undesirable part of the true function at some point then “patch” the removed part with a patching function P
. Intuitively, such patching does not affect the final solution when m
is small enough regarding the final optimal consumption level. It only provides a large enough evaluable region for the numerical solvers to explore.
In the following sections, we discuss some widely used utility function forms and their C^2
smooth patching.
One dimensional CRRA
OK, let’s do some math. Suppose we want a C^2
patch function P
for the one-dimensional CRRA utility u(c)
. Let’s consider the following polynomial up to the 2nd order:
$$ P(c|m) := \beta_0 + \beta_1 c + \beta_2 c^2 $$
The C^2
smoothness requries conditions at the boundary c =m
:
$$ P(m|m) = \beta_0 + \beta_1 m + \beta_2 m^2 = \frac{1}{1-\gamma}m^{1-\gamma} $$
$$ P_m (m|m)=\beta_1 + 2\beta_2 m = m^{-\gamma} $$
$$ P_{mm}(m|m)=2\beta_2 = -\gamma m^{-\gamma-1} $$
Recursively solving the coefficients gives:
$$ \beta_2 = -\frac{\gamma}{2} m^{-\gamma-1} $$
$$ \beta_1 = (1-m \gamma) m^{-\gamma} $$
$$ \beta_0 = m^{1-\gamma} ( \frac{1}{1-\gamma} - 1 + m\gamma + \frac{\gamma}{2} ) $$
The separable CRRA utility used in Jones, C., Midrigan, V. & Philippon, T. (2022, Econometrica)
(“Household Leverage and the Recession.”) follows the same structure because of the additivity.
(more on the way…)