Numerical Experiments on Certainty Equivalents, Risk Premiums, and Risk Aversion

Environment

Python 3.14.6, NumPy 2.5.4, SciPy 1.18.1, Matplotlib 3.11.2 (Jupyter Notebook).

This article is a rewrite of a post from around 2021, with calculations performed in the environment described above.

Overview

Compare certain and uncertain wealth with the same mean. For square-root and exponential utility, we calculate certainty equivalents, risk premiums, and Arrow–Pratt risk-aversion measures, and check a small-risk approximation.

This article corresponds to Chapter 2, “Preferences and Expected Utility”, of The Theory and Practice of Decision Making. The numerical examples are illustrative, not observed data.

Setup

Run the cells in order. Round to three significant figures only when displaying results.

Check versions, import libraries, and configure plots
import sys
from pathlib import Path
from pprint import pprint

import numpy as np
import scipy
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter, ScalarFormatter
from matplotlib_inline.backend_inline import set_matplotlib_formats
from IPython.display import Math, display

# 表示だけを丸め、計算には丸める前の値を使う。
def s3(value):
    return format(float(value), "#.3g").rstrip(".")


np.set_printoptions(formatter={"float_kind": s3})
set_matplotlib_formats("svg")
plt.rcParams.update({
    "figure.figsize": (7, 4),
    "font.size": 11,
    "axes.spines.top": False,
    "axes.spines.right": False,
    "axes.grid": True,
    "grid.alpha": 0.200,
    "svg.fonttype": "path",
})
OUT_DIR = Path("106_nb_files")
OUT_DIR.mkdir(exist_ok=True)


def save_fig(fig, name):
    # 数値の目盛りだけを整形し、候補名などのラベルは保つ。
    for ax in fig.axes:
        for axis in (ax.xaxis, ax.yaxis):
            if isinstance(axis.get_major_formatter(), ScalarFormatter):
                axis.set_major_formatter(FuncFormatter(lambda x, pos: s3(x)))
    # SVGをファイルとセル出力の両方に残す。
    fig.tight_layout()
    fig.savefig(OUT_DIR / f"{name}.svg", format="svg", bbox_inches="tight")
    display(fig)
    plt.close(fig)


assert sys.version_info[:3] == (3, 14, 6), "Python 3.14.6のカーネルを選択すること"
print("実行環境: wa-src(3.14.6)")
print("Python:", sys.version.split()[0])
print("NumPy:", np.__version__, "SciPy:", scipy.__version__)
print("Matplotlib:", matplotlib.__version__)
実行環境: wa-src(3.14.6)
Python: 3.14.6
NumPy: 2.5.4 SciPy: 1.18.1
Matplotlib: 3.11.2

1. A certainty equivalent matches utility

Let $W$ be final wealth and $u$ a continuous, strictly increasing utility function on the interval where $W$ takes its values. Assume that $\mathbb E|W|$ and $\mathbb E|u(W)|$ are finite. The certainty equivalent CE is the certain amount whose utility equals the lottery’s expected utility.

$$ u(CE)=\mathbb E[u(W)],\qquad CE=u^{-1}(\mathbb E[u(W)]). $$

Define the risk premium by $\pi=\mathbb E[W]-CE$. For concave utility, Jensen’s inequality gives $\mathbb E[u(W)]\leq u(\mathbb E[W])$, hence $CE\leq\mathbb E[W]$ and $\pi\geq0$. This premium is the valuation difference for the specified distribution and utility.

Wealth is 80 or 120, each with probability $1/2$, and $u(w)=\sqrt w$ for $w>0$. Mean wealth is 100.

$$ \begin{aligned} \mathbb E[u(W)]&=\frac{\sqrt{80}+\sqrt{120}}{2}\approx9.95,\\ CE&=\left(\frac{\sqrt{80}+\sqrt{120}}{2}\right)^2\\ &=\frac{80+120+2\sqrt{80\times120}}{4}\approx99.0,\\ \pi&=100-CE\approx1.01. \end{aligned} $$

Subtracting the displayed CE of 99.0 would lose precision. The code therefore calculates the premium from the unrounded certainty equivalent.

$$ \displaystyle CE=99.0,\qquad \pi=1.01 $$

wealth = np.array([80, 120], dtype=float)
probability = np.array([0.500, 0.500])
mean_wealth = float(probability @ wealth)
expected_utility = float(probability @ np.sqrt(wealth))
ce = expected_utility ** 2
premium = mean_wealth - ce
pprint({"平均資産": s3(mean_wealth), "期待効用": s3(expected_utility),
        "確実性等価": s3(ce), "リスクプレミアム": s3(premium)})
assert ce <= mean_wealth and premium > 0

w_grid = np.linspace(60, 140, 301)
fig, ax = plt.subplots()
ax.plot(w_grid, np.sqrt(w_grid), label="u(w) = sqrt(w)")
ax.plot(wealth, np.sqrt(wealth), "o--", label="Chord between outcomes")
ax.scatter([ce], [expected_utility], color="tab:red", label="Certainty equivalent")
ax.scatter([100], [expected_utility], color="tab:purple", label="Expected utility at mean wealth")
ax.axhline(expected_utility, color="gray", linestyle=":")
ax.set(xlabel="Final wealth", ylabel="Utility")
ax.legend(fontsize=9)
save_fig(fig, "01_certainty_equivalent")
{'リスクプレミアム': '1.01', '平均資産': '100', '期待効用': '9.95', '確実性等価': '99.0'}

2. Derive risk aversion from derivatives

For twice-differentiable utility with $u^{\prime}>0$, define absolute risk aversion $A$ and relative risk aversion $R$ as follows.

$$ A(w)=-\frac{u^{\prime\prime}(w)}{u^{\prime}(w)},\qquad R(w)=wA(w). $$

For square-root utility,

$$ u^{\prime}(w)=\frac{1}{2\sqrt w},\quad u^{\prime\prime}(w)=-\frac{1}{4w^{3/2}},\quad A(w)=\frac{1}{2w},\quad R(w)=\frac12. $$

$A(w)$ has units of inverse wealth, while $R(w)$ is dimensionless. With square-root utility, absolute risk aversion decreases as wealth increases, but relative risk aversion stays constant. Replacing utility by $au+b$ with $a>0$ leaves these ratios unchanged because $a$ cancels.

3. Approximate a small risk

Let $W=w+\varepsilon$, $\mathbb E[\varepsilon]=0$, and $\operatorname{Var}(\varepsilon)=\sigma^2$. A Taylor expansion around the mean gives

$$ \mathbb E[u(w+\varepsilon)]\approx u(w)+u^{\prime}(w)\mathbb E[\varepsilon] +\frac12u^{\prime\prime}(w)\mathbb E[\varepsilon^2] =u(w)+\frac12u^{\prime\prime}(w)\sigma^2. $$

On the certainty-equivalent side, $CE=w-\pi$ gives $u(w-\pi)\approx u(w)-u^{\prime}(w)\pi$. Equating the two approximations yields

$$ -u^{\prime}(w)\pi\approx\frac12u^{\prime\prime}(w)\sigma^2 \quad\Longrightarrow\quad \pi\approx\frac12A(w)\sigma^2. $$

More precisely, this is a second-order approximation obtained by setting $\varepsilon=tZ$ and taking $t\to0$, with differentiability and moment conditions that control the remainder. Here $A(100)=0.00500$ and $\sigma^2=400$, giving 1.00. This is close to the exact premium of 1.01, but the gap grows with the size of the fluctuations.

center = 100
amplitude = np.linspace(1, 90, 180)
# ±hの対称なくじなので、分散はhの二乗になる。
ce_exact = ((np.sqrt(center - amplitude) + np.sqrt(center + amplitude)) / 2) ** 2
premium_exact = center - ce_exact
premium_approx = amplitude ** 2 / (4 * center)
fig, ax = plt.subplots()
ax.plot(amplitude, premium_exact, label="Exact (square-root utility)")
ax.plot(amplitude, premium_approx, "--", label="Second-order approximation")
ax.set(xlabel="Risk amplitude h", ylabel="Risk premium")
ax.legend()
save_fig(fig, "02_small_risk_approximation")
pprint({"h=20の厳密値": s3(premium), "h=20の近似値": s3(20 ** 2 / 400)})
{'h=20の厳密値': '1.01', 'h=20の近似値': '1.00'}

4. Exponential utility has constant absolute risk aversion

For exponential utility $u(w)=-\exp(-aw)$ with $a>0$, the derivatives are $u^{\prime}(w)=a\exp(-aw)$ and $u^{\prime\prime}(w)=-a^2\exp(-aw)$, so $A(w)=a$ and $R(w)=aw$. If $W=w\pm h$ with equal probabilities,

$$ \begin{aligned} -\exp(-aCE)&=-\frac{\exp\{-a(w-h)\}+\exp\{-a(w+h)\}}{2}\\ &=-\exp(-aw)\cosh(ah),\\ CE&=w-\frac{\log\cosh(ah)}{a},\qquad \pi=\frac{\log\cosh(ah)}{a}. \end{aligned} $$

For the same additive monetary risk, the premium is independent of initial wealth $w$. This property is called CARA. It does not make the assumption appropriate in every setting.

a = 0.0200
h = 20
# log(cosh(x))を指数のオーバーフローを避けて計算する。
log_cosh = np.logaddexp(a * h, -a * h) - np.log(2)
cara_premium = float(log_cosh / a)
pprint({"CARAのa": s3(a), "CARAのプレミアム": s3(cara_premium)})
assert np.isclose(cara_premium, np.log(np.cosh(a * h)) / a)

w = np.linspace(20, 200, 181)
fig, axes = plt.subplots(1, 2, figsize=(9, 3.80))
axes[0].plot(w, 1 / (2 * w), label="Square root")
axes[0].plot(w, np.full_like(w, a), label="CARA")
axes[0].set(xlabel="Wealth", ylabel="Absolute risk aversion")
axes[1].plot(w, np.full_like(w, 0.500), label="Square root")
axes[1].plot(w, a * w, label="CARA")
axes[1].set(xlabel="Wealth", ylabel="Relative risk aversion")
for ax in axes:
    ax.legend()
save_fig(fig, "03_risk_aversion")
{'CARAのa': '0.0200', 'CARAのプレミアム': '3.90'}

The shape and parameters of utility are assumptions about preferences. Comparing certainty equivalents for the same lottery makes their implications in monetary terms easier to see than comparing risk-aversion parameters alone.

Conclusion

We calculated certainty equivalents and risk premiums exactly, then compared them with derivative-based risk aversion and the small-risk approximation.

Absolute risk aversion decreases with wealth for square-root utility and is constant for exponential utility. When using an approximation, vary the risk size and compare it with the exact calculation.

References

Muhamet Yildiz, Decision Making under Risk, MIT OpenCourseWare . Reference for the connection between expected utility and risk aversion.