Core models
The core models cover smooth, kinked, linear, income-dependent, and
reference-point preferences. They all live in utility_viz.models. This chapter
gives each model's function, parameters, distinct behaviour, and figure.
Smooth preferences
These models produce smooth indifference curves and normally have an interior optimum when prices and income are positive.
Cobb-Douglas
CobbDouglas
Weight on good \(x\).
Weight on good \(y\).
The standard model for smooth, strictly convex preferences Cobb (1928):
The exponents control the relative weight placed on each good. The indifference curves approach both axes without touching them.
CES
CES
Weight on good \(x\).
Weight on good \(y\).
Substitution parameter, \(\rho \ne 1\).
Constant elasticity of substitution Arrow (1961): the ease of substitution varies while preferences stay smooth,
The elasticity of substitution is \(\sigma = 1 / (1 - \rho)\). As \(\rho\) changes, CES approaches Cobb-Douglas (\(\rho \to 0\)), Leontief (\(\rho \to -\infty\)) or perfect substitutes (\(\rho \to 1\)).
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import CES
# figure settings
Config.load("econ-viz.toml").use()
model = CES(alpha=0.5, beta=0.5, rho=-0.5)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=20, y_max=15, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=5))
cvs.add_budget(2.0, 3.0, 30.0)
cvs.add_equilibrium(eq)
cvs.save("ces.png")
CES with \(\rho = -0.5\)
Translog
Translog
Log-utility intercept.
First-order weight on \(\ln x\).
First-order weight on \(\ln y\).
Curvature in \(x\).
Curvature in \(y\).
Interaction between \(x\) and \(y\).
A flexible log-quadratic model for smooth preferences Christensen (1975):
The quadratic and interaction terms let the curvature vary across the consumption space. With all \(\beta\) coefficients zero it reduces to a Cobb-Douglas-style log-linear form.
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import Translog
# figure settings
Config.load("econ-viz.toml").use()
model = Translog(alpha_x=0.6, alpha_y=0.4, beta_xy=0.12)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=18, y_max=12, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=4))
cvs.add_budget(2.0, 3.0, 30.0)
cvs.add_equilibrium(eq)
cvs.save("translog.png")
Translog with \(\beta_{x y} = 0.12\)
Kinks and corners
These models show how non-smooth or linear preferences move the optimum to a kink or a corner.
Perfect complements
Leontief
Weight on good \(x\).
Weight on good \(y\).
Goods consumed in fixed proportions:
The indifference curves are L-shaped, and the optimum lies at the kink where the two weighted quantities are equal.
The corners are drawn as exact right angles, in image and TikZ
output alike; this also holds for piecewise min/max functions built
with CustomUtility.
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import Leontief
# figure settings
Config.load("econ-viz.toml").use()
model = Leontief(a=1.0, b=1.0)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=20, y_max=15, x_label="$x$", y_label="$y$")
cvs.add_utility(
model,
levels=levels.around(eq.utility, n=5),
show_rays=True,
# ray and marker at each kink
show_kinks=True,
)
cvs.add_budget(2.0, 3.0, 30.0)
cvs.add_equilibrium(eq)
cvs.save("leontief.png")
Leontief with kink ray
Perfect substitutes
PerfectSubstitutes
Marginal utility of good \(x\).
Marginal utility of good \(y\).
A constant rate of trade-off between the goods:
The indifference curves are straight lines. The consumer normally buys only the good with the greater marginal utility per dollar, a corner solution.
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import PerfectSubstitutes
# figure settings
Config.load("econ-viz.toml").use()
model = PerfectSubstitutes(a=1.0, b=2.0)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=20, y_max=15, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=5))
cvs.add_budget(2.0, 3.0, 30.0)
cvs.add_equilibrium(eq)
cvs.save("perfect_substitutes.png")
Perfect substitutes corner solution
Maximum utility
maximum
Weight on good \(x\).
Weight on good \(y\).
Maximum utility keeps only the larger weighted quantity in each bundle:
Each indifference curve has two arms that extend towards the axes. The
preferences are non-convex, so on a linear budget the optimum normally
lies at the intercept with the greater weighted utility. There is no
dedicated class; the model is built with CustomUtility
(Advanced models).
import numpy as np
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import CustomUtility
# figure settings
Config.load("econ-viz.toml").use()
model = CustomUtility(
func=lambda x, y: np.maximum(x, y), name="maximum"
)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=25, y_max=20, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=5))
cvs.add_budget(2.0, 3.0, 30.0)
cvs.add_equilibrium(eq)
cvs.save("maximum.png")
Maximum utility
Income and reference points
These models add special income effects, subsistence requirements or a preferred consumption point.
Quasi-linear
QuasiLinear
Increasing, concave function \(f\).
Good that enters linearly.
One good enters utility linearly:
Once the solution is interior, the non-linear good has no income effect.
linear_in reverses the roles of \(x\) and \(y\).
import numpy as np
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import QuasiLinear
# figure settings
Config.load("econ-viz.toml").use()
model = QuasiLinear(v_func=np.log, linear_in="y")
eq = solve(model, px=1.0, py=2.0, income=20.0)
cvs = Canvas(x_max=15, y_max=15, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=5))
cvs.add_budget(1.0, 2.0, 20.0)
cvs.add_equilibrium(eq)
cvs.save("quasi_linear.png")
Quasi-linear preferences vertically parallel indifference curves
Haagsma
Haagsma
Weight on good \(x\); must be less than alpha_y.
Weight on good \(y\).
Lower bound on the quantity of \(x\).
Upper bound on the quantity of \(y\).
Closed-form interior solution.
Whether \(x\) is a Giffen good at the given budget.
The Haagsma (2012) utility function,
It is defined for \(x > \gamma_x\) and \(0 \le y < \gamma_y\), and requires \(0 < \alpha_x < \alpha_y\). Marshallian demand for \(x\) falls with income, and \(x\) is a Giffen good when \(\gamma_y p_y < I < \gamma_y p_y + \gamma_x p_x\).
Once income reaches \(\gamma_y p_y + \gamma_x p_x\), utility has no finite
maximum on the budget line and the model raises InvalidParameterError.
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import Haagsma
# figure settings
Config.load("econ-viz.toml").use()
model = Haagsma(gamma_y=10.0)
eq = solve(model, px=1.0, py=1.0, income=11.0)
cvs = Canvas(x_max=9, y_max=12, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=4))
cvs.add_budget(1.0, 1.0, 11.0)
cvs.add_equilibrium(eq)
cvs.save("haagsma.png")
Haagsma with \(\gamma_y = 10\)
Stone-Geary
StoneGeary
Weight on supernumerary \(x\).
Weight on supernumerary \(y\).
Subsistence quantity \(\overline{x}\).
Subsistence quantity \(\overline{y}\).
Cobb-Douglas with minimum consumption requirements Stone (1954)Geary (1950):
The consumer first covers the subsistence quantities \(\overline{x}\) and \(\overline{y}\), then allocates the remaining income like a Cobb-Douglas consumer.
from utility_viz import Canvas, Config, levels, solve
from utility_viz.models import StoneGeary
# figure settings
Config.load("econ-viz.toml").use()
model = StoneGeary(alpha=0.5, beta=0.5, bar_x=2.0, bar_y=2.0)
eq = solve(model, px=2.0, py=3.0, income=30.0)
cvs = Canvas(x_max=20, y_max=15, x_label="$x$", y_label="$y$")
cvs.add_utility(model, levels=levels.around(eq.utility, n=5))
cvs.add_budget(2.0, 3.0, 30.0, fill=True)
cvs.add_equilibrium(eq)
cvs.save("stone_geary.png")
Stone-Geary with \(\overline{x} = \overline{y} = 2\)
Satiation
Satiation
Bliss-point coordinate \(x^*\).
Bliss-point coordinate \(y^*\).
Curvature along the \(x\)-axis.
Curvature along the \(y\)-axis.
A bliss point that maximises utility:
Utility falls in every direction away from \((x^*, y^*)\), so the indifference curves are closed ellipses and monotonicity does not hold.
import numpy as np
from utility_viz import Canvas, Config, levels
from utility_viz.models import Satiation
# figure settings
Config.load("econ-viz.toml").use()
model = Satiation(bliss_x=6.0, bliss_y=4.0)
# curves from a utility grid
X, Y = np.meshgrid(
np.linspace(0.1, 12.0, 300), np.linspace(0.1, 10.0, 300)
)
cvs = Canvas(x_max=12, y_max=10, x_label="$x$", y_label="$y$")
# five percentiles of u
cvs.add_utility(
model, levels=levels.percentile(model(X, Y), n=5)
)
cvs.save("satiation.png")
Satiation around the bliss point \((6, 4)\)