From 9c4d651ada5aa8b562c0a4319c592bc0b987cb9e Mon Sep 17 00:00:00 2001 From: thomassargent30 Date: Fri, 11 Sep 2026 20:14:34 -0400 Subject: [PATCH] Revise the two supply and demand lectures Corrections to supply_demand_multiple_goods.md and supply_demand_heterogeneity.md: * fix the sign and restore the missing mu in the matrix of demand curve slopes, which is -mu (Pi' Pi)^{-1} * separate Frisch from Hicksian demand curves; holding mu fixed gives a Frisch demand curve, and the claim that freezing mu leaves p'e + w unaltered was false * restrict the monopoly output comparison to the single good case, since with several goods cross effects can raise one good's output * correct the two good cross slope explanation; preference substitution rather than the shift in the demand intercept drives the larger fall in the second quantity * label the consumption vector correctly in the risk section * write h' c rather than h c in the welfare criterion * replace a cross document equation reference that could not resolve * state the budget constraint p'(c_i - e_i) = W_i that defines mu_i * fix two code bugs: Ws is None, and np.isclose for the wealth sum New material: * derive welfare criterion = CS + PS - b'b/(2 mu), which ties the planning problem to the surplus measure of intro_supply_demand * add a section on Negishi weights: a competitive equilibrium allocation solves a planning problem with welfare weights 1/mu_i and eta = p * add seven exercises with dropdown solutions, and supply solutions for the four exercises that had none * connect the lectures to cons_smooth, where beta R = 1 is assumed and here derived, and to pv, olg, lp_intro and linear_equations * add concluding remarks to both lectures cons_smooth.md gains a forward pointer recording that it takes R as given while supply_demand_multiple_goods determines R. All code cells execute and every number reported in the text is verified. Co-Authored-By: Claude Opus 5 (1M context) --- lectures/cons_smooth.md | 6 + lectures/supply_demand_heterogeneity.md | 599 ++++++++++++++++-- lectures/supply_demand_multiple_goods.md | 769 ++++++++++++++++++----- 3 files changed, 1168 insertions(+), 206 deletions(-) diff --git a/lectures/cons_smooth.md b/lectures/cons_smooth.md index 9ecf7ee1..63cbe96b 100644 --- a/lectures/cons_smooth.md +++ b/lectures/cons_smooth.md @@ -130,6 +130,12 @@ By **smoother** we mean as close as possible to being constant over time. The preference for smooth consumption paths that is built into the model gives it the name "consumption-smoothing model". +This lecture takes the gross interest rate $R$ as given from outside the model. + +{doc}`supply_demand_multiple_goods` studies a general equilibrium model in which $R$ is the relative price of goods at two dates. + +There $R = \beta^{-1}$ when a consumer's endowment is the same at both dates, so the condition that Friedman and Hall assumed emerges as an equilibrium outcome. + We'll postpone verifying our claim that a constant consumption path is optimal when $\beta R=1$ by comparing welfare levels that comes from a constant path with ones that involve non-constant paths. diff --git a/lectures/supply_demand_heterogeneity.md b/lectures/supply_demand_heterogeneity.md index e3d5fe98..2b58102d 100644 --- a/lectures/supply_demand_heterogeneity.md +++ b/lectures/supply_demand_heterogeneity.md @@ -19,15 +19,15 @@ kernelspec: In the {doc}`previous lecture `, we studied competitive equilibria in an economy with many goods. -While the results of the study were informative, we used a strong simplifying assumption: all of the agents in the economy are identical. +That economy contained a single representative consumer. -In the real world, households, firms and other economic agents differ from one another along many dimensions. +Households, firms and other economic agents differ from one another along many dimensions. -In this lecture, we introduce heterogeneity across consumers by allowing their preferences and endowments to differ. +This lecture introduces heterogeneity across consumers by letting their preferences and endowments differ. -We will examine competitive equilibrium in this setting. +We set production aside and study a pure exchange economy throughout. -We will also show how a "representative consumer" can be constructed. +We compute competitive equilibria, construct a representative consumer, and verify both welfare theorems. Here are some imports: @@ -40,7 +40,11 @@ from scipy.linalg import inv Let's study a simple example of a **pure exchange** economy without production. -There are two consumers who differ in their endowment vectors $e_i$ and their bliss-point vectors $b_i$ for $i=1,2$. +Two consumers differ in their endowment vectors $e_i$ and their bliss point vectors $b_i$ for $i=1,2$. + +Both consumers share the same matrix $\Pi$. + +The shared $\Pi$ lets us aggregate the two consumers into a single representative consumer below. The total endowment is $e_1 + e_2$. @@ -50,7 +54,7 @@ $$ c_1 + c_2 = e_1 + e_2 $$ -Assume the demand curves +Recall from {doc}`supply_demand_multiple_goods` that each consumer's demand curve is $$ c_i = (\Pi^\top \Pi )^{-1}(\Pi^\top b_i - \mu_i p ) @@ -69,7 +73,9 @@ $$ (\mu_1 + \mu_2) p = \Pi^\top(b_1+ b_2) - \Pi^\top \Pi (e_1 + e_2) $$ (eq:old6) -We can normalize prices by setting $\mu_1 + \mu_2 =1$ and then solving +We take $\Pi$ to be square and invertible, as in {doc}`supply_demand_multiple_goods`, so that $(\Pi^\top \Pi)^{-1}\Pi^\top = \Pi^{-1}$. + +We normalize prices by setting $\mu_1 + \mu_2 =1$ and then solve $$ \mu_i(p,e) = \frac{p^\top (\Pi^{-1} b_i - e_i)}{p^\top (\Pi^\top \Pi )^{-1} p} @@ -81,10 +87,10 @@ for $\mu_i, i = 1,2$. :label: sdh_ex1 ``` -Show that, up to normalization by a positive scalar, the same competitive equilibrium price vector that you computed in the preceding two-consumer economy would prevail in a single-consumer economy in which a single **representative consumer** has utility function +Show that, up to normalization by a positive scalar, the same competitive equilibrium price vector that you derived in the preceding two-consumer economy would prevail in a single-consumer economy in which a single **representative consumer** has utility function $$ --.5 (\Pi c -b) ^\top (\Pi c -b ) +- \frac{1}{2} (\Pi c -b) ^\top (\Pi c -b ) $$ and endowment vector $e$, where @@ -102,10 +108,48 @@ $$ ```{exercise-end} ``` +```{solution-start} sdh_ex1 +:class: dropdown +``` + +For the two-consumer economy, equation {eq}`eq:old6` says that the competitive equilibrium price vector satisfies + +$$ +(\mu_1 + \mu_2)\, p = \Pi^\top (b_1 + b_2) - \Pi^\top \Pi (e_1 + e_2) + = \Pi^\top b - \Pi^\top \Pi e +$$ + +Now consider the single representative consumer with bliss point $b = b_1 + b_2$ and endowment $e = e_1 + e_2$. + +Because that consumer is alone in the economy, market clearing requires $c = e$, so their demand curve implies the price vector $\tilde p$ that satisfies + +$$ +\tilde \mu \, \tilde p = \Pi^\top b - \Pi^\top \Pi e +$$ + +The right sides of the two displayed equations are identical, so + +$$ +\tilde p = \frac{\mu_1 + \mu_2}{\tilde \mu}\, p +$$ + +The two price vectors are therefore proportional, with a positive factor of proportionality because marginal utilities of wealth are positive. + +Since only relative prices matter, the two economies have the same competitive equilibrium prices; normalizing $\mu_1 + \mu_2 = \tilde\mu = 1$ makes the two price vectors equal. + +We verify this more carefully, and allow for transfers of wealth, in the section {ref}`deducing a representative consumer ` below. + +```{solution-end} +``` + ## Pure exchange economy Let's further explore a pure exchange economy with $n$ goods and $m$ people. +In this lecture $m$ denotes the number of consumers. + +In {doc}`supply_demand_multiple_goods` $m$ denoted the number of rows of $\Pi$. + ### Competitive equilibrium We'll compute a competitive equilibrium. @@ -114,16 +158,33 @@ To compute a competitive equilibrium of a pure exchange economy, we use the fact - Relative prices in a competitive equilibrium are the same as those in a special single person or representative consumer economy with preference $\Pi$ and $b=\sum_i b_i$, and endowment $e = \sum_i e_{i}$. -We can use the following steps to compute a competitive equilibrium: +This aggregation requires that all consumers share the same matrix $\Pi$. + +Consumer $i$ faces the budget constraint + +$$ +p^{\top}\left(c_{i}-e_{i}\right)=W_{i} +$$ (eq:budget_i) + +where $W_{i}$ is a lump-sum transfer of wealth measured in units of the numeraire good, and the transfers satisfy $\sum_i W_{i}=0$. -- First we solve the single representative consumer economy by normalizing $\mu = 1$. Then, we renormalize the price vector by using the first consumption good as a numeraire. +Setting $W_{i}=0$ for every $i$ returns a pure exchange economy in which a consumer's endowment is their only source of income. -- Next we use the competitive equilibrium prices to compute each consumer's marginal utility of wealth: +Substituting the demand curve into {eq}`eq:budget_i` and solving for $\mu_i$ gives $$ -\mu_{i}=\frac{-W_{i}+p^{\top}\left(\Pi^{-1}b_{i}-e_{i}\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p}$$ +\mu_{i}=\frac{-W_{i}+p^{\top}\left(\Pi^{-1}b_{i}-e_{i}\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p} +$$ (eq:mu_i) + +These are **Marshallian** demand curves in the terminology of {doc}`supply_demand_multiple_goods`: we solve for $\mu_i$ from a budget constraint instead of fixing it. + +We compute a competitive equilibrium in three steps. -- Finally we compute a competitive equilibrium allocation by using the demand curves: +- First we solve the single representative consumer economy by normalizing $\mu = 1$, then renormalize the price vector by using the first consumption good as a numeraire. + +- Next we compute each consumer's marginal utility of wealth from {eq}`eq:mu_i`. + +- Finally we compute a competitive equilibrium allocation from the demand curves: $$ c_{i}=\Pi^{-1}b_{i}-(\Pi^{\top}\Pi)^{-1}\mu_{i}p @@ -137,28 +198,23 @@ Below we shall construct a Python class with the following attributes: * **Preferences** in the form of - * an $n \times n$ positive definite matrix $\Pi$ - * an $n \times 1$ vector of bliss points $b$ + * an $n \times n$ invertible matrix $\Pi$, shared by all consumers, which makes $\Pi^\top \Pi$ positive definite + * an $n \times 1$ vector of bliss points $b_i$ for each consumer $i$ * **Endowments** in the form of - * an $n \times 1$ vector $e$ - * a scalar "wealth" $W$ with default value $0$ + * an $n \times 1$ vector $e_i$ for each consumer $i$ + * a scalar "wealth" $W_i$ for each consumer $i$, with default value $0$ -The class will include a test to make sure that $b \gg \Pi e $ and raise an exception if it is violated +The class will include a test to make sure that $b_i \gg \Pi e_i $ and raise an exception if it is violated (at some threshold level we'd have to specify). - * **A Person** in the form of a pair that consists of - - * **Preferences** and **Endowments** - * **A Pure Exchange Economy** will consist of - * a collection of $m$ **persons** + * a collection of $m$ **persons**, each described by a bliss point $b_i$, an endowment $e_i$ and a wealth $W_i$ - * $m=1$ for our single-agent economy - * $m=2$ for our illustrations of a pure exchange economy + * $m=2$ in all of the economies that we study below * an equilibrium price vector $p$ (normalized somehow) * an equilibrium allocation $c_1, c_2, \ldots, c_m$ -- a collection of $m$ vectors of dimension $n \times 1$ @@ -181,7 +237,7 @@ class ExchangeEconomy: bs (list): all consumers' bliss points es (list): all consumers' endowments Ws (list): all consumers' wealth - thres (float): a threshold set to test b >> Pi e violated + thres (float): a threshold used to test whether b >> Π e is violated """ n, m = Π.shape[0], len(bs) @@ -190,11 +246,10 @@ class ExchangeEconomy: if np.min(b / np.max(Π @ e)) <= thres: raise Exception('set bliss points further away') - if Ws == None: + if Ws is None: Ws = np.zeros(m) - else: - if sum(Ws) != 0: - raise Exception('invalid wealth distribution') + elif not np.isclose(np.sum(Ws), 0): + raise Exception('invalid wealth distribution') self.Π, self.bs, self.es, self.Ws, self.n, self.m = Π, bs, es, Ws, n, m @@ -240,12 +295,16 @@ Next we use the class ``ExchangeEconomy`` defined above to study * a two-person economy without production, * a dynamic economy, and -* an economy with risk and arrow securities. +* an economy with risk and Arrow securities. ### Two-person economy without production Here we study how competitive equilibrium $p, c_1, c_2$ respond to different $b_i$ and $e_i$, $i \in \{1, 2\}$. +We also report each consumer's marginal utility of wealth $\mu_i$. + +A high $\mu_i$ identifies a consumer who is poor at equilibrium prices, in the sense that an extra unit of wealth would be worth a lot to them. + ```{code-cell} ipython3 Π = np.array([[1, 0], [0, 1]]) @@ -261,8 +320,13 @@ p, c_s, μ_s = EE.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) ``` +The two consumers have identical preferences and differ only in which good they are endowed with. + +They trade to a symmetric allocation, and their marginal utilities of wealth are equal. + What happens if the first consumer likes the first good more and the second consumer likes the second good more? ```{code-cell} ipython3 @@ -273,11 +337,19 @@ p, c_s, μ_s = EE.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) ``` +Each consumer now ends up with more of the good that they like better. + Let the first consumer be poorer. +Each cell below sets both the bliss points and the endowments, so that no experiment inherits values from the preceding one. + ```{code-cell} ipython3 +EE.bs = [np.array([6, 5]), # first consumer's bliss points + np.array([5, 6])] # second consumer's bliss points + EE.es = [np.array([0.5, 0.5]), # first consumer's endowment np.array([1, 1])] # second consumer's endowment @@ -285,8 +357,17 @@ p, c_s, μ_s = EE.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) ``` +The poorer consumer has the higher marginal utility of wealth. + +The first consumer consumes none of the second good. + +Our quadratic utility function does not rule out such corners. + +A poorer first consumer would drive the allocation negative, and our class would raise an exception. + Now let's construct an autarky (i.e., no-trade) equilibrium. ```{code-cell} ipython3 @@ -300,8 +381,37 @@ p, c_s, μ_s = EE.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) +``` + +The equilibrium allocation reproduces the endowments, and no trade occurs. + +Each consumer likes the good with which they are endowed enough to keep it at the equilibrium price vector. + +The aggregate endowment and the aggregate bliss point have been symmetric across the two goods in every experiment so far, and the equilibrium price vector has been $(1, 1)$. + +With $\Pi = I$, equation {eq}`eq:old6` makes $p$ proportional to $b - e$, so symmetry of both aggregates produces equal prices. + +Let's now make the second good scarcer in the aggregate. + +```{code-cell} ipython3 +EE.bs = [np.array([6, 5]), # first consumer's bliss points + np.array([5, 6])] # second consumer's bliss points + +EE.es = [np.array([1.25, 0.75]), # first consumer's endowment + np.array([1.25, 0.75])] # second consumer's endowment + +p, c_s, μ_s = EE.competitive_equilibrium() + +print('Competitive equilibrium price vector:', p) +print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) ``` +The relative price of the second good now exceeds $1$, because the second good is the scarcer of the two. + +The two consumers have identical endowments, so their differing tastes drive all trade. + Now let's redistribute endowments before trade. ```{code-cell} ipython3 @@ -317,11 +427,86 @@ p, c_s, μ_s = EE_new.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Marginal utilities of wealth:', μ_s) +``` + +A lump-sum transfer of wealth from the second consumer to the first leaves the equilibrium price vector at $(1,1)$. + +It moves the allocation from $(1,1)$ for each consumer to $(1.25, 1.25)$ and $(0.75, 0.75)$. + +Redistributing wealth before trade has supported a different Pareto optimal allocation as a competitive equilibrium, an instance of the **second welfare theorem** of {doc}`supply_demand_multiple_goods`. + +```{exercise} +:label: sdh_ex2 + +Take $\Pi = I$ and bliss points $b_1 = (6,5)^\top$ and $b_2 = (5,6)^\top$. + +Consider two ways of dividing the *same* aggregate endowment $e_1 + e_2 = (3, 1.5)^\top$: + +* distribution A: $e_1 = (2, 0.5)^\top$ and $e_2 = (1, 1)^\top$ +* distribution B: $e_1 = (0.5, 1.5)^\top$ and $e_2 = (2.5, 0)^\top$ + +a. Compute the equilibrium price vector, allocation and marginal utilities of wealth under each distribution. + + What changes and what does not? + +b. Verify that $\sum_i \mu_i$ is also the same under the two distributions, and explain why by using equation {eq}`eq:old6`. + +c. Which consumer has the higher marginal utility of wealth under distribution A, and why? + +``` + +```{solution-start} sdh_ex2 +:class: dropdown +``` + +```{code-cell} ipython3 +Π = np.array([[1, 0], + [0, 1]]) + +bs = [np.array([6, 5]), + np.array([5, 6])] + +distributions = {'A': [np.array([2, 0.5]), np.array([1, 1])], + 'B': [np.array([0.5, 1.5]), np.array([2.5, 0])]} + +for name, es in distributions.items(): + EE_d = ExchangeEconomy(Π, bs, es) + p, c_s, μ_s = EE_d.competitive_equilibrium() + print(f'distribution {name}: aggregate endowment = {sum(es)}') + print(f' price vector : {p}') + print(f' allocation : {[np.round(c, 4) for c in c_s]}') + print(f' μ_1, μ_2 : {np.round(μ_s, 4)}, sum = {np.sum(μ_s):.4f}\n') +``` + +The price vector is identical under the two distributions. + +The allocations differ. + +Equation {eq}`eq:old6` makes the price vector depend on the individual $b_i$ and $e_i$ only through the sums $b = \sum_i b_i$ and $e = \sum_i e_i$, and redistributing a fixed aggregate endowment leaves both sums unchanged. + +All consumers share the same $\Pi$, so every demand curve has the same slope $-(\Pi^\top \Pi)^{-1} p$ with respect to the marginal utility of wealth. + +Moving wealth from one consumer to another shifts one demand curve down and the other up by offsetting amounts. + +For part b, $\sum_i \mu_i = 8.0$ under both distributions. + +Equation {eq}`eq:old6` pins that sum down given $p$, $b$ and $e$. + +It equals the marginal utility of wealth $\tilde\mu$ of the representative consumer constructed below. + +For part c, the second consumer has the higher marginal utility of wealth under distribution A. + +Their endowment sells for less at equilibrium prices, so an extra unit of wealth is worth more to them. + +```{solution-end} ``` ### A dynamic economy -Now let's use the tricks described above to study a dynamic economy, one with two periods. +Now let's use the tricks described in {doc}`supply_demand_multiple_goods` to study a dynamic economy, one with two periods. + +We give our two consumers identical preferences but endow them at different dates: the first consumer is endowed early and the second consumer late. ```{code-cell} ipython3 beta = 0.95 @@ -329,20 +514,100 @@ beta = 0.95 Π = np.array([[1, 0], [0, np.sqrt(beta)]]) -bs = [np.array([5, np.sqrt(beta) * 5])] +bs = [np.array([5, np.sqrt(beta) * 5]), + np.array([5, np.sqrt(beta) * 5])] -es = [np.array([1, 1])] +es = [np.array([2, 0]), # first consumer is endowed at date 1 + np.array([0, 2])] # second consumer is endowed at date 2 EE_DE = ExchangeEconomy(Π, bs, es) p, c_s, μ_s = EE_DE.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Gross interest rate R = p1/p2:', p[0] / p[1]) +``` + +The gross interest rate is $R = \beta^{-1} = 1.0526$. + +The first consumer is endowed early and lends to the second consumer, who is endowed late. + +Each consumer's consumption is constant across the two dates. + +Neither consumer's endowment is constant. + +The exercise below derives that flatness from the condition $\beta R = 1$ of {doc}`cons_smooth`. + +{doc}`olg` studies an economy with the same two-period structure, in which the young and the old trade at a gross interest rate. + +{doc}`olg` adds production and an unending sequence of overlapping generations. + +Our economy has a single pair of consumers and no production. + +```{exercise} +:label: sdh_ex3 + +Consider the two-period economy just computed, in which both consumers have bliss point $\Pi (5,5)^\top$. + +a. Show that consumer $i$'s consumption is constant across the two dates if and only if $\beta R = 1$, where $R = p_1 / p_2$. + +b. Now let the aggregate endowment grow, by setting $e_1 = (1.5, 0)^\top$ and $e_2 = (0, 2.5)^\top$. + + Recompute the equilibrium. What happens to $R$ and to the shapes of the two consumption paths? + +``` + +```{solution-start} sdh_ex3 +:class: dropdown +``` + +For part a, the demand curve is $c_i = \Pi^{-1} b_i - \mu_i (\Pi^\top \Pi)^{-1} p$. + +Here $\Pi^{-1} b_i = (5,5)^\top$ and $(\Pi^\top \Pi)^{-1} = \operatorname{diag}(1, \beta^{-1})$, so + +$$ +c_{i,2} - c_{i,1} = - \mu_i \left( \frac{p_2}{\beta} - p_1 \right) + = - \mu_i p_1 \left( \frac{1}{\beta R} - 1 \right) +$$ + +This difference is zero for every consumer if and only if $\beta R = 1$, because $\mu_i > 0$ and $p_1 > 0$. + +{doc}`cons_smooth` obtains a flat consumption path from the same condition. + +```{code-cell} ipython3 +bs = [np.array([5, np.sqrt(beta) * 5]), + np.array([5, np.sqrt(beta) * 5])] + +es = [np.array([1.5, 0]), + np.array([0, 2.5])] + +EE_growth = ExchangeEconomy(Π, bs, es) +p, c_s, μ_s = EE_growth.competitive_equilibrium() + +print('Competitive equilibrium price vector:', p) +print('Competitive equilibrium allocation:', [np.round(c, 4) for c in c_s]) +print(f'R = {p[0] / p[1]:.6f}') +print(f'1 / beta = {1 / beta:.6f}') +``` + +The aggregate endowment grows from $1.5$ at date $1$ to $2.5$ at date $2$. + +The gross interest rate rises to $R = 1.1930$ and exceeds $\beta^{-1} = 1.0526$. + +Both consumption paths tilt upward over time, because $\beta R > 1$. + +The two consumers share the consumption growth; they do not share the endowment growth. + +```{solution-end} ``` -### Risk economy with arrow securities +### Risk economy with Arrow securities -We use the tricks described above to interpret $c_1, c_2$ as "Arrow securities" that are state-contingent claims to consumption goods. +We use the tricks described in {doc}`supply_demand_multiple_goods` to interpret $c_1, c_2$ as "Arrow securities" that are state-contingent claims to consumption goods. + +The first consumer is endowed only in state $1$ and the second consumer only in state $2$. + +The economy-wide endowment is therefore one unit in each state, so the economy carries **individual** risk and no **aggregate** risk. ```{code-cell} ipython3 prob = 0.7 @@ -361,18 +626,82 @@ p, c_s, μ_s = EE_AS.competitive_equilibrium() print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c_s) +print('Ratio of state prices p1/p2:', p[0] / p[1]) +print('Ratio of probabilities λ/(1-λ):', prob / (1 - prob)) +``` + +The relative price of the two Arrow securities equals the odds ratio $\lambda/(1-\lambda) = 0.7/0.3$, so state-contingent claims trade at **actuarially fair odds**. + +Each consumer's consumption is the same in both states: $c_1 = (0.7, 0.7)$ and $c_2 = (0.3, 0.3)$. + +The market in Arrow securities delivers **complete insurance**. + +No consumer's consumption depends on which state occurs. + +Consumption differs across the two consumers because they are not equally rich. + +The first consumer owns the endowment in the state that occurs with probability $0.7$. + +That endowment sells for more at equilibrium prices, and the market converts its value into a safe consumption stream. + +```{exercise} +:label: sdh_ex4 + +Return to the Arrow securities economy just computed. + +a. Introduce **aggregate** risk by setting $e_1 = (1.5, 0)^\top$ while leaving $e_2 = (0,1)^\top$, so that the economy-wide endowment is $1.5$ in state $1$ and $1$ in state $2$. + + Recompute the equilibrium. Is consumption still state-independent? Does $p_1/p_2$ still equal the odds ratio? + +b. Explain which kind of risk a complete set of Arrow securities can eliminate and which kind it cannot. + +``` + +```{solution-start} sdh_ex4 +:class: dropdown +``` + +```{code-cell} ipython3 +es = [np.array([1.5, 0]), + np.array([0, 1])] + +EE_agg = ExchangeEconomy(Π, bs, es) +p, c_s, μ_s = EE_agg.competitive_equilibrium() + +print('aggregate endowment:', sum(es)) +print('Competitive equilibrium price vector:', p) +print('Competitive equilibrium allocation:', [np.round(c, 4) for c in c_s]) +print(f'p1/p2 = {p[0] / p[1]:.4f}, odds λ/(1-λ) = {prob / (1 - prob):.4f}') +``` + +Insurance is no longer complete. + +Consumption is state-dependent for both consumers. + +Both consume more in state $1$, the state in which the economy as a whole has more. + +The price ratio falls to $2.2037$, below fair odds, because state $1$ consumption is now abundant and cheap. + +For part b, a complete set of Arrow securities eliminates individual risk, which concerns who receives the goods. + +It cannot eliminate aggregate risk, which concerns how many goods the economy has. + +Consumers share aggregate risk, and it shows up in state-contingent consumption and in state prices that depart from the odds. + +```{solution-end} ``` +(rep_consumer)= ## Deducing a representative consumer In the class of multiple consumer economies that we are studying here, it turns out that there exists a single **representative consumer** whose preferences and endowments can be deduced from lists of preferences and endowments for separate individual consumers. -Consider a multiple consumer economy with initial distribution of wealth $W_i$ satisfying $\sum_i W_{i}=0$ +Consider a multiple consumer economy with an initial distribution of wealth $W_i$ satisfying $\sum_i W_{i}=0$. We allow an initial redistribution of wealth. -We have the following objects +We have the following objects: - The demand curve: @@ -409,9 +738,13 @@ $$ where $$ -\mu = \sum_i\mu_{i}=\frac{0 + p^{\top}\left(\Pi^{-1}b-e\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p}. +\mu = \sum_i\mu_{i} + = \frac{-\sum_i W_{i} + p^{\top}\left(\Pi^{-1}b-e\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p} + = \frac{p^{\top}\left(\Pi^{-1}b-e\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p} $$ +Here the wealth transfers have dropped out of the sum because $\sum_i W_{i}=0$. + Now consider the representative consumer economy specified above. Denote the marginal utility of wealth of the representative consumer by $\tilde{\mu}$. @@ -422,7 +755,7 @@ $$ c=\Pi^{-1}b-(\Pi^{\top}\Pi)^{-1}\tilde{\mu} p $$ -Substituting this into the budget constraint gives +Substituting this into the representative consumer's budget constraint $p^{\top}(c-e)=0$, which contains no wealth term because $\sum_i W_{i}=0$, gives $$ \tilde{\mu}=\frac{p^{\top}\left(\Pi^{-1}b-e\right)}{p^{\top}(\Pi^{\top}\Pi)^{-1}p} @@ -436,3 +769,185 @@ $$ Thus, we have verified that, up to the choice of a numeraire in which to express absolute prices, the price vector in our representative consumer economy is the same as that in an underlying economy with multiple consumers. + +```{note} +Aggregation worked because all of our consumers share the same matrix $\Pi$, which gives every demand curve a common slope in wealth. + +Preferences with this property take the **Gorman form**. + +Without it, the equilibrium price vector would depend on the distribution of wealth, and no representative consumer would exist. + +The representative consumer computes prices. + +It tells us nothing about how goods are distributed among individual consumers, and its utility is not a social welfare function. +``` + +## Negishi weights and the first welfare theorem + +{doc}`supply_demand_multiple_goods` verified a version of the **first welfare theorem**: a competitive equilibrium quantity vector solves a planning problem. + +That lecture contained a single consumer, so its planner had nobody to choose among. + +A planner with many consumers must attach a weight to each of them. + +Let $\theta_i > 0$ be the weight that a planner attaches to consumer $i$ and consider the planning problem + +$$ +\max_{\{c_i\}} \ \sum_i \theta_i \left(-\frac{1}{2}\right)(\Pi c_{i}-b_{i})^{\top}(\Pi c_{i}-b_{i}) +\quad \text{subject to} \quad \sum_i c_{i}=\sum_i e_{i} +$$ + +Form the Lagrangian + +$$ +L = \sum_i \theta_i \left(-\frac{1}{2}\right)(\Pi c_{i}-b_{i})^{\top}(\Pi c_{i}-b_{i}) + + \eta^{\top}\left(\sum_i e_{i}-\sum_i c_{i}\right) +$$ + +where $\eta$ is a vector of Lagrange multipliers on the resource constraint. + +First-order conditions with respect to $c_i$ are + +$$ +-\theta_{i}\Pi^{\top}(\Pi c_{i}-b_{i})-\eta=0 +$$ + +so that + +$$ +c_{i}=\Pi^{-1}b_{i}-(\Pi^{\top}\Pi)^{-1}\frac{\eta}{\theta_{i}} +$$ (eq:negishi_demand) + +Now compare {eq}`eq:negishi_demand` with the competitive equilibrium demand curve + +$$ +c_{i}=\Pi^{-1}b_{i}-(\Pi^{\top}\Pi)^{-1}\mu_{i}p +$$ + +The two coincide when + +$$ +\theta_{i}=\frac{1}{\mu_{i}} \quad \text{and} \quad \eta = p +$$ + +A competitive equilibrium allocation solves a planning problem whose welfare weights are the reciprocals of the consumers' marginal utilities of wealth. + +[Takashi Negishi](https://en.wikipedia.org/wiki/Takashi_Negishi) introduced weights of this kind, and they carry his name. + +A consumer who is poor at equilibrium prices has a high $\mu_i$, and a planner attaches a low weight $\theta_i$ to them to justify the market outcome. + +The multiplier $\eta$ on the resource constraint equals the equilibrium price vector. + +Shadow prices of scarce resources are market prices, as {doc}`lp_intro` discusses. + +```{exercise} +:label: sdh_ex5 + +Verify these claims numerically. + +a. Write a function that solves the planner's problem for arbitrary weights $\theta_i$ by combining {eq}`eq:negishi_demand` with the resource constraint. + +b. Check that setting $\theta_i = 1/\mu_i$ reproduces the competitive equilibrium allocation, and that $\eta$ is proportional to $p$. + + Do this both for the two-person economy in which the second good is scarce and for the Arrow securities economy. + +c. Now set equal weights $\theta_1 = \theta_2$ and describe how the planner's allocation differs from the competitive one. + +``` + +```{solution-start} sdh_ex5 +:class: dropdown +``` + +```{code-cell} ipython3 +def planner_allocation(Π, bs, es, θs): + """ + Solve the planner's problem for welfare weights θs + """ + slope_dc = inv(Π.T @ Π) + Π_inv = inv(Π) + e = sum(es) + + # the resource constraint pins down the multiplier η + A = slope_dc * sum(1 / θ for θ in θs) + rhs = sum(Π_inv @ b for b in bs) - e + η = np.linalg.solve(A, rhs) + + c_s = [Π_inv @ bs[i] - slope_dc @ η / θs[i] for i in range(len(bs))] + return η, c_s +``` + +```{code-cell} ipython3 +# the two-person economy in which the second good is scarce +Π_1 = np.array([[1, 0], + [0, 1]]) +bs_1 = [np.array([6, 5]), np.array([5, 6])] +es_1 = [np.array([1.25, 0.75]), np.array([1.25, 0.75])] + +# the Arrow securities economy +prob = 0.7 +Π_2 = np.array([[np.sqrt(prob), 0], + [0, np.sqrt(1 - prob)]]) +bs_2 = [np.array([np.sqrt(prob) * 5, np.sqrt(1 - prob) * 5]), + np.array([np.sqrt(prob) * 5, np.sqrt(1 - prob) * 5])] +es_2 = [np.array([1, 0]), np.array([0, 1])] + +economies = [('scarce good 2', Π_1, bs_1, es_1), + ('Arrow securities', Π_2, bs_2, es_2)] + +for name, Π_i, bs_i, es_i in economies: + p, c_s, μ_s = ExchangeEconomy(Π_i, bs_i, es_i).competitive_equilibrium() + η, c_pl = planner_allocation(Π_i, bs_i, es_i, θs=[1 / μ for μ in μ_s]) + + print(name) + print(f' competitive allocation : {[np.round(c, 4) for c in c_s]}') + print(f' planner allocation : {[np.round(c, 4) for c in c_pl]}') + print(f' p : {np.round(p, 4)}') + print(f' η / η[0] : {np.round(η / η[0], 4)}') + print(f' allocations agree : {np.allclose(c_s, c_pl)}\n') +``` + +Setting $\theta_i = 1/\mu_i$ reproduces the competitive allocation, and the normalized multiplier $\eta$ equals the competitive price vector. + +Now give the two consumers equal weights. + +```{code-cell} ipython3 +for name, Π_i, bs_i, es_i in economies: + η, c_pl = planner_allocation(Π_i, bs_i, es_i, θs=[1, 1]) + print(f'{name}: equal-weight allocation = {[np.round(c, 4) for c in c_pl]}') +``` + +The equal-weight planner disregards who owns what. + +In the Arrow securities economy it gives each consumer $(0.5, 0.5)$, an equal share of the aggregate endowment in each state. + +The market delivers $(0.7, 0.7)$ and $(0.3, 0.3)$ and respects each consumer's ownership of their state-contingent endowment. + +A lump-sum redistribution of wealth would decentralize the equal-weight allocation as a competitive equilibrium, by the second welfare theorem. + +The first welfare theorem makes the market outcome a planner's outcome for some weights. + +The second welfare theorem turns a planner's outcome for any weights into a market outcome, given the right transfers. + +```{solution-end} +``` + +## Concluding remarks + +This lecture studied a competitive equilibrium of a pure exchange economy whose consumers differ in their preferences and their endowments. + +The equilibrium price vector depends on individual consumers only through the **aggregate** bliss point and the **aggregate** endowment. + +A single representative consumer reproduces the equilibrium prices of an economy with many consumers. + +A competitive equilibrium allocation solves a planning problem whose welfare weights are the reciprocals of the consumers' marginal utilities of wealth, an instance of the first welfare theorem. + +Redistributing wealth before trade changes the allocation and leaves prices unchanged, an instance of the second welfare theorem. + +The same apparatus describes borrowing and lending when goods are dated, and insurance when goods are state-contingent. + +A competitive equilibrium delivers complete consumption smoothing when $\beta R = 1$ and complete insurance when no aggregate risk exists. + +Neither result survives variation in the aggregate endowment across dates or across states. + +Consumers share aggregate risk and aggregate growth; they cannot eliminate them. diff --git a/lectures/supply_demand_multiple_goods.md b/lectures/supply_demand_multiple_goods.md index cb17e2f1..d13c675a 100644 --- a/lectures/supply_demand_multiple_goods.md +++ b/lectures/supply_demand_multiple_goods.md @@ -44,7 +44,7 @@ Important extensions to the key ideas were obtained by * [Harold Hotelling](https://en.wikipedia.org/wiki/Harold_Hotelling) * [Paul Samuelson](https://en.wikipedia.org/wiki/Paul_Samuelson) * [Kenneth Arrow](https://en.wikipedia.org/wiki/Kenneth_Arrow) -* [Gerard Debreu](https://en.wikipedia.org/wiki/G%C3%A9rard_Debreu) +* [Gérard Debreu](https://en.wikipedia.org/wiki/G%C3%A9rard_Debreu) We shall describe two classic welfare theorems: @@ -53,6 +53,12 @@ We shall describe two classic welfare theorems: * **second welfare theorem:** An allocation of goods to consumers that solves a social planning problem can be supported by a competitive equilibrium with an appropriate initial distribution of wealth. +This lecture studies a single representative consumer, so the distribution of wealth plays no role in it. + +We verify a version of the **first** welfare theorem only. + +{doc}`supply_demand_heterogeneity` takes up the distribution of wealth and both welfare theorems. + As usual, we start by importing some Python modules. ```{code-cell} ipython3 @@ -64,6 +70,8 @@ from scipy.linalg import inv ## Formulas from linear algebra +{doc}`linear_equations` describes tools for solving the linear systems that appear in this lecture and in {doc}`supply_demand_heterogeneity`. + We shall apply formulas from linear algebra that * differentiate an inner product with respect to each vector @@ -84,13 +92,21 @@ $$ \frac{\partial x^\top A x}{\partial x} = (A + A^\top)x $$ +```{note} +The first and third formulas differentiate a scalar with respect to a vector and return $n \times 1$ vectors. + +The second differentiates a vector with respect to a vector and returns an $n \times n$ matrix. + +We use the first and third formulas below. +``` + ## From utility function to demand curve Our study of consumers will use the following primitives -* $\Pi$ be an $m \times n$ matrix, -* $b$ be an $m \times 1$ vector of bliss points, -* $e$ be an $n \times 1$ vector of endowments, and +* $\Pi$, an $m \times n$ matrix, +* $b$, an $m \times 1$ vector of bliss points, +* $e$, an $n \times 1$ vector of endowments +++ @@ -107,12 +123,22 @@ We assume that $\Pi$ has linearly independent columns, which implies that $\Pi^\ * it follows that $\Pi^\top \Pi$ has an inverse. -We shall see below that $(\Pi^\top \Pi)^{-1}$ is a matrix of slopes of (compensated) demand curves for $c$ with respect to a vector of prices: +In all of our examples we shall set $m = n$ and take $\Pi$ to be invertible, so that $(\Pi^\top \Pi)^{-1} \Pi^\top = \Pi^{-1}$. + +The matrix $-\mu (\Pi^\top \Pi)^{-1}$ gives the slopes of demand curves for $c$ with respect to $p$, holding fixed the marginal utility of wealth $\mu$ that we define below: $$ - \frac{\partial c } {\partial p} = (\Pi^\top \Pi)^{-1} + \frac{\partial c } {\partial p} = - \mu (\Pi^\top \Pi)^{-1} $$ +$(\Pi^\top \Pi)^{-1}$ is positive definite, so its diagonal elements are positive and the diagonal elements of $-\mu (\Pi^\top \Pi)^{-1}$ are negative. + +Each good's own-price demand curve slopes downward. + +The off-diagonal cross-price effects take either sign. + +A demand curve that holds $\mu$ fixed is a **Frisch** demand curve, named after [Ragnar Frisch](https://en.wikipedia.org/wiki/Ragnar_Frisch). + A consumer faces $p$ as a price taker and chooses $c$ to maximize the utility function $$ @@ -131,9 +157,9 @@ $$ \Pi c \ll b $$ (eq:bversusc) -This means that the consumer has much less of each good than he wants. +This means that the consumer has much less of each good than they want. -The deviation in {eq}`eq:bversusc` will ultimately assure us that competitive equilibrium prices are positive. +The deviation in {eq}`eq:bversusc` will ultimately assure us that competitive equilibrium prices are positive, provided that $\Pi$ has non-negative entries, as it does in all of our examples. +++ @@ -169,19 +195,71 @@ $$ (eq:old3) Substituting {eq}`eq:old3` into budget constraint {eq}`eq:old2` and solving for $\mu$ gives $$ - \mu(p,e) = \frac{p^\top ( \Pi^\top \Pi )^{-1} \Pi^\top b - p^\top e}{p^\top (\Pi^\top \Pi )^{-1} p}. + \mu(p,e) = \frac{p^\top ( \Pi^\top \Pi )^{-1} \Pi^\top b - p^\top e}{p^\top (\Pi^\top \Pi )^{-1} p} $$ (eq:old4) Equation {eq}`eq:old4` tells how marginal utility of wealth depends on the endowment vector $e$ and the price vector $p$. ```{note} -Equation {eq}`eq:old4` is a consequence of imposing that $p^\top (c - e) = 0$. +Equation {eq}`eq:old4` is a consequence of imposing $p^\top (c - e) = 0$. +``` + +## Marshallian, Hicksian, and Frisch demand curves + +Sometimes we'll use budget constraint {eq}`eq:old2` in situations in which a consumer's endowment vector $e$ is their **only** source of income. + +Other times we'll instead assume that the consumer has another source of income (positive or negative) and write their budget constraint as + +$$ +p ^\top (c -e ) = w +$$ (eq:old2p) + +where $w$ is measured in "dollars" (or some other **numeraire**) and component $p_i$ of the price vector is measured in dollars per unit of good $i$. + +Whether the consumer's budget constraint is {eq}`eq:old2` or {eq}`eq:old2p` and whether we take $w$ as a free parameter or instead as an endogenous variable will affect the consumer's marginal utility of wealth. -We could instead take $\mu$ as a parameter and use {eq}`eq:old3` and the budget constraint {eq}`eq:old2p` to solve for wealth. +Consequently, how we set $\mu$ determines which of the following three demand curves we are constructing: -Which way we proceed determines whether we are constructing a **Marshallian** or **Hicksian** demand curve. +* a **Marshallian** demand curve, as when we use {eq}`eq:old2` and solve for $\mu$ using equation {eq}`eq:old4` above + +* a **Frisch** demand curve, as when we treat $\mu$ as a fixed parameter and solve {eq}`eq:old2p` for $w$ + +* a **Hicksian** demand curve, as when we hold the consumer's *utility* fixed and let $w$ be whatever is required to attain it + +These three demand curves contemplate different mental experiments. + +For a Marshallian demand curve, hypothetical changes in a price vector have both **substitution** and **income** effects + +* income effects are consequences of changes in $p^\top e$ associated with the change in the price vector + +For a Frisch demand curve, the marginal utility of wealth $\mu$ is frozen while $w$ adjusts to finance the resulting consumption bundle + +* differentiating {eq}`eq:old3` while holding $\mu$ fixed gives the slopes $\frac{\partial c}{\partial p} = - \mu (\Pi^\top \Pi)^{-1}$ that we met above + +For a Hicksian demand curve, $w$ instead adjusts to keep **utility** constant, which is why a Hicksian demand curve is often called a **compensated** demand curve + +* the compensation is designed to disarm the income (or wealth) effect associated with a price change + +```{note} +Frisch and Hicksian demand curves are distinct objects. + +A Hicksian demand curve minimizes expenditure $p^\top c$ subject to attaining a given utility level, so scaling all prices by a common positive factor leaves it unchanged. + +Its matrix of slopes $S$ satisfies $S p = 0$. + +The Frisch slopes $-\mu (\Pi^\top \Pi)^{-1}$ do not. + +Freezing the marginal utility of wealth differs from freezing utility. ``` +In the endowment economy below, the budget constraint {eq}`eq:old2` holds and $\mu$ normalizes the price level. + +In the production economy below, no budget constraint restrains the consumer, so $\mu$ is a free parameter of a Frisch inverse demand curve. + +The planning problem there uses that free parameter as the weight that a planner attaches to the consumer. + ++++ + ## Endowment economy We now study a pure-exchange economy, or what is sometimes called an endowment economy. @@ -198,7 +276,7 @@ $$ p = \mu^{-1} (\Pi^\top b - \Pi^\top \Pi e) $$ -In the present case where we have imposed budget constraint in the form {eq}`eq:old2`, we are free to normalize the price vector by setting the marginal utility of wealth $\mu =1$ (or any other value for that matter). +In the present case, where we have imposed the budget constraint in the form {eq}`eq:old2`, we are free to normalize the price vector by setting the marginal utility of wealth $\mu =1$ (or any other value for that matter). This amounts to choosing a common unit (or numeraire) in which prices of all goods are expressed. @@ -213,6 +291,34 @@ Verify that setting $\mu=1$ in {eq}`eq:old3` implies that formula {eq}`eq:old4` ``` +```{solution-start} sdm_ex1 +:class: dropdown +``` + +Setting $\mu = 1$ in {eq}`eq:old3` and imposing the equilibrium condition $c = e$ gives the price vector + +$$ +p = \Pi^\top b - \Pi^\top \Pi e +$$ + +Multiplying this by $(\Pi^\top \Pi)^{-1}$ and rearranging yields the useful identity + +$$ +(\Pi^\top \Pi)^{-1} \Pi^\top b - e = (\Pi^\top \Pi)^{-1} p +$$ + +Now substitute this into the numerator of {eq}`eq:old4`: + +$$ +p^\top \left[ (\Pi^\top \Pi)^{-1} \Pi^\top b - e \right] + = p^\top (\Pi^\top \Pi)^{-1} p +$$ + +The numerator of {eq}`eq:old4` therefore equals its denominator, so $\mu(p,e) = 1$, as required. + +```{solution-end} +``` + ```{exercise} :label: sdm_ex2 @@ -221,8 +327,41 @@ Verify that setting $\mu=2$ in {eq}`eq:old3` also implies that formula ``` +```{solution-start} sdm_ex2 +:class: dropdown +``` + +Setting $\mu = 2$ in {eq}`eq:old3` and again imposing $c = e$ gives + +$$ +p = \frac{1}{2}\left(\Pi^\top b - \Pi^\top \Pi e\right) +$$ + +so that the identity used in the previous exercise becomes + +$$ +(\Pi^\top \Pi)^{-1} \Pi^\top b - e = 2 (\Pi^\top \Pi)^{-1} p +$$ + +The numerator of {eq}`eq:old4` is now $2 p^\top (\Pi^\top \Pi)^{-1} p$, which is twice the denominator, so $\mu(p,e) = 2$. + +The same argument works for any $\mu > 0$. + +Doubling $\mu$ halves the equilibrium price vector and leaves relative prices and the allocation $c = e$ unchanged. + +$\mu$ normalizes the price level. + +```{solution-end} +``` + Here is a class that computes competitive equilibria for our economy. +```{note} +Our code forms matrix inverses explicitly with `inv`, so that each line of code mirrors a line of algebra. + +For larger problems, solve the linear system directly with `numpy.linalg.solve`, as in {doc}`linear_equations`. +``` + ```{code-cell} ipython3 class ExchangeEconomy: @@ -238,7 +377,7 @@ class ExchangeEconomy: Π (np.array): shared matrix of substitution b (list): the consumer's bliss point e (list): the consumer's endowment - thres (float): a threshold to check p >> Π e condition + thres (float): a threshold to check the b >> Π e condition """ # check non-satiation @@ -270,41 +409,6 @@ class ExchangeEconomy: return p, c ``` -## Digression: Marshallian and Hicksian demand curves - -Sometimes we'll use budget constraint {eq}`eq:old2` in situations in which a consumer's endowment vector $e$ is his **only** source of income. - -Other times we'll instead assume that the consumer has another source of income (positive or negative) and write his budget constraint as - -$$ -p ^\top (c -e ) = w -$$ (eq:old2p) - -where $w$ is measured in "dollars" (or some other **numeraire**) and component $p_i$ of the price vector is measured in dollars per unit of good $i$. - -Whether the consumer's budget constraint is {eq}`eq:old2` or {eq}`eq:old2p` and whether we take $w$ as a free parameter or instead as an endogenous variable will affect the consumer's marginal utility of wealth. - -Consequently, how we set $\mu$ determines whether we are constructing - -* a **Marshallian** demand curve, as when we use {eq}`eq:old2` and solve for $\mu$ using equation {eq}`eq:old4` above, or -* a **Hicksian** demand curve, as when we treat $\mu$ as a fixed parameter and solve for $w$ from {eq}`eq:old2p`. - -Marshallian and Hicksian demand curves contemplate different mental experiments: - -For a Marshallian demand curve, hypothetical changes in a price vector have both **substitution** and **income** effects - -* income effects are consequences of changes in $p^\top e$ associated with the change in the price vector - -For a Hicksian demand curve, hypothetical price vector changes have only **substitution** effects - -* changes in the price vector leave $p^\top e + w$ unaltered because we freeze $\mu$ and solve for $w$ - -Sometimes a Hicksian demand curve is called a **compensated** demand curve in order to emphasize that, to disarm the income (or wealth) effect associated with a price change, the consumer's wealth $w$ is adjusted. - -We'll discuss these distinct demand curves more below. - -+++ - ## Dynamics and risk as special cases Special cases of our $n$-good pure exchange model can be created to represent @@ -362,6 +466,14 @@ $$ is the **gross interest rate** and $r$ is the **net interest rate**. +{doc}`pv` computes present values by discounting future payoffs with a discount factor $\delta \in (0,1)$. + +Here $p_2 / p_1 = R^{-1}$ is that discount factor, determined inside the model as the relative price of goods at two dates. + +{doc}`cons_smooth` studies a consumer who smooths consumption completely when $\beta R = 1$, a condition that Milton Friedman and Robert Hall assumed. + +An exercise below derives $R = \beta^{-1}$ from equilibrium when the endowment is the same at both dates. + Here is an example. ```{code-cell} ipython3 @@ -381,13 +493,91 @@ print('Competitive equilibrium price vector:', p) print('Competitive equilibrium allocation:', c) ``` +```{exercise} +:label: sdm_ex5 + +Consider the dynamic interpretation above, with $\Pi = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{\beta}\end{bmatrix}$, +$b = \begin{bmatrix} \bar b \\ \sqrt{\beta}\,\bar b \end{bmatrix}$ and $e = \begin{bmatrix} e_1 \\ e_2\end{bmatrix}$. + +a. Show analytically that the gross interest rate is + +$$ +R = \frac{p_1}{p_2} = \frac{1}{\beta} \cdot \frac{\bar b - e_1}{\bar b - e_2} +$$ + +and hence that $R = \beta^{-1}$ whenever the endowment is flat, that is, whenever $e_1 = e_2$. + +b. Let $e_2 = (1+g) e_1$ with $e_1 = 1$, $\bar b = 5$ and $\beta = 0.95$. + + Compute $R$ numerically for $g \in [-0.2, 0.2]$ and plot it against $g$, marking $\beta^{-1}$ with a dashed line. + +c. Explain, in terms of the consumer's desire to smooth consumption, why $R$ rises with $g$. + +``` + +```{solution-start} sdm_ex5 +:class: dropdown +``` + +For part a, the equilibrium price vector is $p = \Pi^\top b - \Pi^\top \Pi e$. + +With this $\Pi$ and $b$, + +$$ +\Pi^\top b = \begin{bmatrix} \bar b \cr \beta \bar b \end{bmatrix}, \qquad +\Pi^\top \Pi e = \begin{bmatrix} e_1 \cr \beta e_2 \end{bmatrix}, \qquad \text{so} \qquad +p = \begin{bmatrix} \bar b - e_1 \cr \beta (\bar b - e_2) \end{bmatrix} +$$ + +Taking the ratio of the two components gives the formula, and setting $e_1 = e_2$ gives $R = \beta^{-1}$. + +```{code-cell} ipython3 +beta, b_bar, e1 = 0.95, 5, 1 + +def R_of_g(g): + Π = np.array([[1, 0], + [0, np.sqrt(beta)]]) + b = np.array([b_bar, np.sqrt(beta) * b_bar]) + e = np.array([e1, (1 + g) * e1]) + p, c = ExchangeEconomy(Π, b, e).competitive_equilibrium() + return p[0] / p[1] + +gs = np.linspace(-0.2, 0.2, 41) +Rs = np.array([R_of_g(g) for g in gs]) +R_formula = np.array([(b_bar - e1) / (beta * (b_bar - (1 + g) * e1)) for g in gs]) + +print(f'max |numerical - formula| = {np.max(np.abs(Rs - R_formula)):.2e}') + +fig, ax = plt.subplots() +ax.plot(gs, Rs, label='$R = p_1 / p_2$') +ax.axhline(1 / beta, linestyle='--', color='red', label=r'$\beta^{-1}$') +ax.set_xlabel('endowment growth rate $g$') +ax.set_ylabel('gross interest rate $R$') +ax.legend() +plt.show() + +for g in [0, 0.1, 0.2]: + print(f'g = {g:>4}: R = {R_of_g(g):.6f}') +``` + +The numerical and analytical answers agree, and $R = \beta^{-1} = 1.052632$ when $g = 0$. + +For part c, $g > 0$ tilts the endowment toward period $2$, and the consumer wants a flat consumption path. + +At $R = \beta^{-1}$ the consumer would borrow against period $2$ income. + +A single consumer has nobody to borrow from, so $R$ rises until the consumer willingly consumes the endowment. + +```{solution-end} +``` + ### Risk and state-contingent claims We study risk in the context of a **static** environment, meaning that there is only one period. By **risk** we mean that an outcome is not known in advance, but that it is governed by a known probability distribution. -As an example, our consumer confronts **risk** means in particular that +That our consumer confronts **risk** means in particular that * there are two states of nature, $1$ and $2$. @@ -423,7 +613,7 @@ $$ b = \begin{bmatrix} \sqrt{\lambda}b_1 \cr \sqrt{1-\lambda}b_2 \end{bmatrix} $$ -A consumer's endowment vector is +A consumer's consumption vector is $$ c = \begin{bmatrix} c_1 \cr c_2 \end{bmatrix} @@ -439,16 +629,12 @@ where $p_i$ is the price of one unit of consumption in state $i \in \{1, 2\}$. The state-contingent goods being traded are often called **Arrow securities**. -Before the random state of the world $i$ is realized, the consumer sells his/her state-contingent endowment bundle and purchases a state-contingent consumption bundle. +Before the random state of the world $i$ is realized, the consumer sells their state-contingent endowment bundle and purchases a state-contingent consumption bundle. Trading such state-contingent goods is one way economists often model **insurance**. +++ -We use the tricks described above to interpret $c_1, c_2$ as "Arrow securities" that are state-contingent claims to consumption goods. - -+++ - Here is an instance of the risk economy: ```{code-cell} ipython3 @@ -479,7 +665,7 @@ Please numerically study how each of the following cases affects the equilibrium * they like the first good more, or * the probability that state $1$ occurs is higher. -Hints. For each case choose some parameter $e, b, \text{ or } \lambda$ different from the instance. +Hint: for each case, choose a value of $e$, $b$, or $\lambda$ that differs from the one used in the instance above. ``` @@ -489,48 +675,105 @@ Hints. For each case choose some parameter $e, b, \text{ or } \lambda$ different :class: dropdown ``` -First consider when the consumer is poorer. +A single-consumer endowment economy has no production and no trading partner, so the allocation equals the endowment. + +Only prices respond to the experiments below. -Here we just decrease the endowment. +We build a fresh economy for each experiment. ```{code-cell} ipython3 -risk.e = np.array([0.5, 0.5]) +def risk_economy(prob=0.2, b_scale=(5, 5), e=(1, 1)): + """ + Build the risk economy, allowing each element of the baseline to be changed + """ + Π = np.array([[np.sqrt(prob), 0], + [0, np.sqrt(1 - prob)]]) + b = np.array([np.sqrt(prob) * b_scale[0], + np.sqrt(1 - prob) * b_scale[1]]) + return ExchangeEconomy(Π, b, np.array(e)) -p, c = risk.competitive_equilibrium() -print('Competitive equilibrium price vector:', p) -print('Competitive equilibrium allocation:', c) +def show(economy, label): + p, c = economy.competitive_equilibrium() + print(f'{label}') + print(f' price vector: {p}') + print(f' allocation : {c}\n') + + +show(risk_economy(), 'baseline') +show(risk_economy(e=(0.5, 0.5)), 'the consumer is poorer') +show(risk_economy(b_scale=(6, 5)), 'the consumer likes the first good more') +show(risk_economy(prob=0.8), 'state 1 is more likely') ``` -If the consumer likes the first (or second) good more, then we can set a larger bliss value for good 1. +When the consumer is poorer, goods are scarcer relative to the bliss point, so **both** state-contingent prices rise. -```{code-cell} ipython3 -risk.b = np.array([np.sqrt(prob) * 6, np.sqrt(1 - prob) * 5]) -p, c = risk.competitive_equilibrium() +When the consumer likes the first good more, the price of a claim on state $1$ rises while the price of a claim on state $2$ is unchanged. -print('Competitive equilibrium price vector:', p) -print('Competitive equilibrium allocation:', c) +When state $1$ becomes more likely, a claim that pays in state $1$ becomes more valuable and a claim that pays in state $2$ becomes less valuable. + +```{solution-end} ``` -Increase the probability that state $1$ occurs. +```{exercise} +:label: sdm_ex6 -```{code-cell} ipython3 -prob = 0.8 +In the risk interpretation, $p_i$ is the price of one unit of consumption contingent on state $i$. -Π = np.array([[np.sqrt(prob), 0], - [0, np.sqrt(1 - prob)]]) +a. Show that, with $\Pi = \operatorname{diag}(\sqrt{\lambda}, \sqrt{1-\lambda})$ and + $b = (\sqrt{\lambda}\,\bar b, \ \sqrt{1-\lambda}\,\bar b)^\top$, -b = np.array([np.sqrt(prob) * 5, np.sqrt(1 - prob) * 5]) +$$ +\frac{p_1}{p_2} = \frac{\lambda}{1-\lambda} \cdot \frac{\bar b - e_1}{\bar b - e_2} +$$ -e = np.array([1, 1]) +b. Conclude that when the endowment is the same in both states, state prices are proportional to probabilities, so that claims trade at **actuarially fair odds**. -risk = ExchangeEconomy(Π, b, e) -p, c = risk.competitive_equilibrium() +c. Verify both claims numerically for $\lambda \in \{0.2, 0.5, 0.8\}$, first with $e = (1,1)$ and then with $e = (0.5, 1.5)$. -print('Competitive equilibrium price vector:', p) -print('Competitive equilibrium allocation:', c) + Explain the sign of the departure from fair odds in the second case. + +``` + +```{solution-start} sdm_ex6 +:class: dropdown +``` + +For part a, again $p = \Pi^\top b - \Pi^\top \Pi e$, and here + +$$ +p = \begin{bmatrix} \lambda (\bar b - e_1) \cr (1-\lambda)(\bar b - e_2) \end{bmatrix} +$$ + +from which the ratio follows immediately. + +Part b is then immediate too: if $e_1 = e_2$, the second factor equals $1$, so $p_1/p_2 = \lambda/(1-\lambda)$. + +```{code-cell} ipython3 +b_bar = 5 + +def price_ratio(λ, e): + Π = np.array([[np.sqrt(λ), 0], + [0, np.sqrt(1 - λ)]]) + b = np.array([np.sqrt(λ) * b_bar, np.sqrt(1 - λ) * b_bar]) + p, c = ExchangeEconomy(Π, b, np.array(e)).competitive_equilibrium() + return p[0] / p[1] + +print(f"{'λ':>5} | {'e':>12} | {'p1/p2':>9} | {'odds λ/(1-λ)':>13}") +print('-' * 48) +for λ in [0.2, 0.5, 0.8]: + for e in [[1, 1], [0.5, 1.5]]: + print(f'{λ:>5} | {str(e):>12} | {price_ratio(λ, e):>9.4f} | {λ / (1 - λ):>13.4f}') ``` +With $e = (1,1)$ the price ratio equals the odds ratio exactly. + +With $e = (0.5, 1.5)$ the good is scarcer in state $1$, and $p_1/p_2$ exceeds $\lambda/(1-\lambda)$ for every $\lambda$. + +State prices reflect probabilities and scarcity. + +Asset prices are expectations taken with respect to a probability distribution twisted toward states in which consumption is low. + ```{solution-end} ``` @@ -575,7 +818,7 @@ $$ H = \frac{1}{2} (J + J^\top) $$ -The firm maximizes total profits by setting **marginal revenue to marginal costs**. +The firm maximizes total profits by setting **marginal revenue equal to marginal costs**. An $n \times 1$ vector of marginal revenues for the price-taking firm is $\frac{\partial p^\top q} {\partial q} = p $. @@ -595,9 +838,11 @@ $$ ### Competitive equilibrium -To compute a competitive equilibrium for a production economy where demand curve is pinned down by the marginal utility of wealth $\mu$, we first compute an allocation by solving a planning problem. +We equate the inverse supply curve to the inverse demand curve and solve for the equilibrium quantity vector. + +We then compute the equilibrium price vector from either curve. -Then we compute the equilibrium price vector using the inverse demand or supply curve. +That quantity vector also solves a planning problem, as we show below. #### $\mu=1$ warmup @@ -615,7 +860,7 @@ $$ c = (\Pi^\top \Pi + H )^{-1} ( \Pi^\top b - h) $$ (eq:old5) -This equation is the counterpart of equilibrium quantity {eq}`eq:old1` for the scalar $n=1$ model with which we began. +This equation is the counterpart, for the scalar $n=1$ model of {doc}`intro_supply_demand`, of the equilibrium quantity derived there. #### General $\mu\neq 1$ case @@ -637,13 +882,78 @@ $$ (eq:old5p) +++ +### Multi-good welfare maximization problem + +Our welfare maximization problem -- also sometimes called a social planning problem -- is to choose $c$ to maximize + +$$ + - \frac{1}{2} \mu^{-1}(\Pi c -b) ^\top (\Pi c -b ) +$$ + +minus the area under the inverse supply curve, namely, + +$$ + h^\top c + \frac{1}{2} c^\top J c +$$ + +So the welfare criterion is + +$$ + - \frac{1}{2} \mu^{-1}(\Pi c -b)^\top (\Pi c -b ) -h^\top c + - \frac{1}{2} c^\top J c +$$ + +In this formulation, $\mu$ is a parameter that describes how the planner weighs interests of outside suppliers and our representative consumer. + +The first-order condition with respect to $c$ is + +$$ +- \mu^{-1} \Pi^\top \Pi c + \mu^{-1}\Pi^\top b - h - H c = 0 +$$ + +which implies {eq}`eq:old5p`. + +Thus, as for the single-good case, with multiple goods a competitive equilibrium quantity vector solves a planning problem. + +(This is another version of the first welfare theorem.) + +#### Welfare as consumer surplus plus producer surplus + +{doc}`intro_supply_demand` measured social welfare by consumer surplus plus producer surplus. + +Our welfare criterion equals that measure up to a constant. + +Consumer surplus is the area under the inverse demand curve minus expenditure. + +Producer surplus is revenue minus the area under the inverse supply curve. + +Adding them cancels revenue against expenditure: + +$$ +CS + PS = \mu^{-1} b^\top \Pi c - \frac{1}{2}\mu^{-1} c^\top \Pi^\top \Pi c + - h^\top c - \frac{1}{2} c^\top J c +$$ + +Expanding the quadratic form in the welfare criterion gives + +$$ +- \frac{1}{2} \mu^{-1}(\Pi c -b)^\top (\Pi c -b ) - h^\top c - \frac{1}{2} c^\top J c + = CS + PS - \frac{1}{2}\mu^{-1} b^\top b +$$ + +The constant $\frac{1}{2}\mu^{-1} b^\top b$ does not depend on $c$. + +Maximizing the welfare criterion and maximizing total surplus are therefore the same problem, and the competitive equilibrium quantity vector {eq}`eq:old5p` maximizes consumer surplus plus producer surplus. + +An exercise below computes both for a single good. + ### Implementation A Production Economy will consist of * a single **person** that we'll interpret as a representative consumer * a single set of **production costs** -* a multiplier $\mu$ that weights "consumers" versus "producers" in a planner's welfare function, as described above in the main text +* a multiplier $\mu$ that weights "consumers" versus "producers" in the planner's welfare function described above * an $n \times 1$ vector $p$ of competitive equilibrium prices * an $n \times 1$ vector $c$ of competitive equilibrium quantities * **consumer surplus** @@ -726,7 +1036,7 @@ def plot_competitive_equilibrium(PE): a single good production economy Args: - PE (class): A initialized production economy class + PE (class): An initialized production economy class """ # get singleton value J, h, Π, b, μ = PE.J.item(), PE.h.item(), PE.Π.item(), PE.b.item(), PE.μ @@ -771,7 +1081,7 @@ Now let's construct an example of a production economy with one good. To do this we - * specify a single **person** and a **cost curve** in a way that lets us replicate the simple single-good supply demand example with which we started + * specify a single **person** and a **cost curve** in a way that lets us replicate the simple single-good supply and demand example of {doc}`intro_supply_demand` * compute equilibrium $p$ and $c$ and consumer and producer surpluses @@ -823,6 +1133,18 @@ print('Consumer surplus:', c_surplus.item()) print('Producer surplus:', p_surplus.item()) ``` +Raising $\mu$ from $1$ to $2$ halves the consumer's willingness to pay for each unit, $\mu^{-1}(\Pi b - \Pi^2 c)$. + +The equilibrium quantity falls from $4.75$ to $3$ and the price falls from $5.25$ to $3.5$. + +Both surpluses fall. + +The two experiments hold $h$ and $J$ fixed, so both surpluses are measured in the same units. + +The two experiments weight the consumer differently, so their surpluses do not rank welfare across them. + +Within each experiment, consumer surplus plus producer surplus is maximized at the competitive quantity. + Now we change the bliss point so that the consumer derives more utility from consumption. ```{code-cell} ipython3 @@ -842,9 +1164,9 @@ This raises both the equilibrium price and quantity. #### Example: single agent two-good economy with production - * we'll do some experiments like those above +Now we do experiments like those above, but with two goods. - * we can do experiments with a **diagonal** $\Pi$ and also with a **non-diagonal** $\Pi$ matrix to study how cross-slopes affect responses of $p$ and $c$ to various shifts in $b$ (TODO) +We begin with a **diagonal** $\Pi$, so that the two goods are independent in preferences, together with a cost matrix $J$ whose off-diagonal element is positive, so that producing more of one good raises the marginal cost of the other. ```{code-cell} ipython3 Π = np.array([[1, 0], @@ -865,6 +1187,8 @@ print('Competitive equilibrium price:', p) print('Competitive equilibrium allocation:', c) ``` +Now let's raise the bliss point for the first good from $10$ to $12$. + ```{code-cell} ipython3 PE.b = np.array([12, 10]) @@ -874,9 +1198,15 @@ print('Competitive equilibrium price:', p) print('Competitive equilibrium allocation:', c) ``` +The quantity of good $1$ rises while the quantity of good $2$ **falls**, even though preferences for good $2$ have not changed. + +That cross-effect comes entirely from the cost side: producing more of good $1$ raises the marginal cost of good $2$. + +Next we make $\Pi$ **non-diagonal**, so that the two goods interact in preferences as well as in costs. + ```{code-cell} ipython3 -PE.Π = np.array([[1, 0.5], - [0.5, 1]]) +PE.Π = np.array([[1, 0.3], + [0.3, 1]]) PE.b = np.array([10, 10]) @@ -894,7 +1224,29 @@ print('Competitive equilibrium price:', p) print('Competitive equilibrium allocation:', c) ``` -### Digression: a supplier who is a monopolist +The same shift in $b_1$ now moves both quantities by more: good $1$ rises by $1.11$ rather than $1.07$, and good $2$ falls by $0.30$ rather than $0.27$. + +A non-diagonal $\Pi$ puts a positive off-diagonal element in $\Pi^\top \Pi$. + +The cross-partial derivative of utility becomes $\partial^2 u / \partial c_1 \partial c_2 = -0.6$, so the two goods substitute for each other in preferences. + +Preference substitution reinforces cost substitution and pushes $c_2$ down. + +A non-diagonal $\Pi$ also raises both components of $\Pi^\top b$ when $b_1$ rises, which pushes $c_2$ up. + +The first effect dominates. + +```{note} +The two effects can be separated in $\Delta c = (\Pi^\top \Pi + H)^{-1} \Pi^\top \Delta b$. + +Holding $\Pi^\top \Pi$ at $I$ and letting only $\Pi^\top b$ change gives $\Delta c = (0.99, 0.05)$. + +Holding $\Pi^\top \Delta b$ at $(2,0)$ and letting only $\Pi^\top \Pi$ change gives $\Delta c = (1.32, -0.70)$. + +The two together give $\Delta c = (1.11, -0.30)$. +``` + +### A monopolist supplier A competitive firm is a **price-taker** who regards the price and therefore its marginal revenue as being beyond its control. @@ -903,7 +1255,7 @@ setting quantity. A monopolist takes a **demand curve** and not the **price** as beyond its control. -Thus, instead of being a price-taker, a monopolist sets prices to maximize profits subject to the inverse demand curve +Thus, instead of being a price-taker, a monopolist chooses a quantity to maximize profits subject to the inverse demand curve {eq}`eq:old5pa`. So the monopolist's total profits as a function of its output $q$ is @@ -920,39 +1272,59 @@ $$ q = (H + 2 \mu^{-1} \Pi^\top \Pi)^{-1} (\mu^{-1} \Pi^\top b - h) $$ (eq:qmonop) -We'll soon see that a monopolist sets a **lower output** $q$ than does either a +```{exercise} +:label: sdm_ex4 - * planner who chooses $q$ to maximize social welfare +Please verify the monopolist's supply curve {eq}`eq:qmonop`. - * a competitive equilibrium +``` +```{solution-start} sdm_ex4 +:class: dropdown +``` +Write the monopolist's profits {eq}`eq:monopprof` as -```{exercise} -:label: sdm_ex4 +$$ +\mu^{-1} b^\top \Pi q - \mu^{-1} q^\top \Pi^\top \Pi q - h^\top q - \frac{1}{2} q^\top J q +$$ -Please verify the monopolist's supply curve {eq}`eq:qmonop`. +Now apply the formulas for differentiating an inner product and a quadratic form, recalling that $H = \frac{1}{2}(J + J^\top)$: -``` +$$ +\frac{\partial}{\partial q}\left(\mu^{-1} b^\top \Pi q\right) = \mu^{-1}\Pi^\top b, \qquad +\frac{\partial}{\partial q}\left(\mu^{-1} q^\top \Pi^\top \Pi q\right) = 2 \mu^{-1}\Pi^\top \Pi q +$$ -+++ +$$ +\frac{\partial}{\partial q}\left(h^\top q\right) = h, \qquad +\frac{\partial}{\partial q}\left(\frac{1}{2} q^\top J q\right) = H q +$$ -### A monopolist +The first-order condition is therefore -Let's consider a monopolist supplier. +$$ +\mu^{-1}\Pi^\top b - 2 \mu^{-1}\Pi^\top \Pi q - h - H q = 0 +$$ -We have included a method in our `ProductionEconomy` class to compute an equilibrium price and allocation when the supplier is a monopolist. +Collecting terms in $q$ gives -Since the supplier now has the price-setting power +$$ +\left(H + 2\mu^{-1}\Pi^\top\Pi\right) q = \mu^{-1}\Pi^\top b - h +$$ -- we first compute the optimal quantity that solves the monopolist's profit maximization problem. -- Then we back out an equilibrium price from the consumer's inverse demand curve. +which is {eq}`eq:qmonop`. -Next, we use a graph for the single good case to illustrate the difference between a competitive equilibrium and an equilibrium with a monopolist supplier. +The Hessian of profits with respect to $q$ is $-(H + 2\mu^{-1}\Pi^\top \Pi)$. -Recall that in a competitive equilibrium, a price-taking supplier equates marginal revenue $p$ to marginal cost $h + Hq$. +Because $H$ and $\Pi^\top \Pi$ are both positive definite, this Hessian is negative definite, so the first-order condition does indeed describe a maximum. + +```{solution-end} +``` + +Let's now compare a monopolist with a competitive supplier. -This yields a competitive producer's inverse supply curve. +Recall that in a competitive equilibrium, a price-taking supplier equates marginal revenue $p$ to marginal cost $h + Hq$. A monopolist's marginal revenue is not constant but instead is a non-trivial function of the quantity it sets. @@ -964,9 +1336,12 @@ $$ which the monopolist equates to its marginal cost. -The plot indicates that the monopolist sets output lower than the competitive equilibrium quantity. +Below we define a class `Monopoly` that inherits from `ProductionEconomy` and adds a method that computes an equilibrium price and allocation when the supplier is a monopolist. -In a single good case, this equilibrium is associated with a higher price of the good. +Since the supplier now has price-setting power + +- we first compute the optimal quantity that solves the monopolist's profit maximization problem +- then we back out an equilibrium price from the consumer's inverse demand curve ```{code-cell} ipython3 class Monopoly(ProductionEconomy): @@ -1013,7 +1388,7 @@ def plot_monopoly(M): equilibrium in a monopolist supplier economy with a single good Args: - M (class): A class inherits class ProductionEconomy with monopoly + M (class): An instance of a class that inherits from ProductionEconomy """ # get singleton value J, h, Π, b, μ = M.J.item(), M.h.item(), M.Π.item(), M.b.item(), M.μ @@ -1024,8 +1399,6 @@ def plot_monopoly(M): q, pm = M.equilibrium_with_monopoly() c, p, q, pm = c.item(), p.item(), q.item(), pm.item() - # compute - # inverse supply/demand curve marg_cost = lambda x: h + H * x marg_rev = lambda x: -2 * 1 / μ * Π * Π * x + 1 / μ * Π * b @@ -1062,37 +1435,54 @@ def plot_monopoly(M): plt.show() ``` -#### A multiple good example - -Let's compare competitive equilibrium and monopoly outcomes in a multiple goods economy. +#### A single-good example ```{code-cell} ipython3 -Π = np.array([[1, 0], - [0, 1.2]]) - -b = np.array([10, 10]) - -h = np.array([0.5, 0.5]) - -J = np.array([[1, 0.5], - [0.5, 1]]) +Π = np.array([[1]]) # the matrix now is a singleton +b = np.array([10]) +h = np.array([0.5]) +J = np.array([[1]]) μ = 1 M = Monopoly(Π, b, h, J, μ) c, p = M.competitive_equilibrium() q, pm = M.equilibrium_with_monopoly() -print('Competitive equilibrium price:', p) -print('Competitive equilibrium allocation:', c) +print('Competitive equilibrium price:', p.item()) +print('Competitive equilibrium allocation:', c.item()) -print('Equilibrium with monopolist supplier price:', pm) -print('Equilibrium with monopolist supplier allocation:', q) +print('Equilibrium with monopolist supplier price:', pm.item()) +print('Equilibrium with monopolist supplier allocation:', q.item()) + +# plot +plot_monopoly(M) ``` -#### A single-good example +The monopolist sets output below the competitive equilibrium quantity, and in this single-good economy that lower quantity is associated with a higher price. + +```{exercise} +:label: sdm_ex7 + +For the single-good economy just studied, with $\Pi = [1]$, $b = [10]$, $h = [0.5]$, $J = [[1]]$ and $\mu = 1$, define **total surplus** at quantity $x$ as the area under the inverse demand curve minus the area under the marginal cost curve: + +$$ +TS(x) = \mu^{-1}\left(\Pi b x - \frac{1}{2}\Pi^2 x^2\right) - \left(h x + \frac{1}{2} J x^2\right) +$$ + +a. Compute $TS$ at the competitive quantity and at the monopoly quantity, and report the **deadweight loss** caused by monopoly. + +b. Maximize $TS$ over a fine grid of values of $x$ and check that the maximizer is the *competitive* quantity rather than the monopoly quantity. + + Which welfare theorem does this illustrate? + +``` + +```{solution-start} sdm_ex7 +:class: dropdown +``` ```{code-cell} ipython3 -Π = np.array([[1]]) # the matrix now is a singleton +Π = np.array([[1]]) b = np.array([10]) h = np.array([0.5]) J = np.array([[1]]) @@ -1101,54 +1491,105 @@ J = np.array([[1]]) M = Monopoly(Π, b, h, J, μ) c, p = M.competitive_equilibrium() q, pm = M.equilibrium_with_monopoly() +c, p, q, pm = c.item(), p.item(), q.item(), pm.item() -print('Competitive equilibrium price:', p.item()) -print('Competitive equilibrium allocation:', c.item()) +Π_, b_, h_, J_ = Π.item(), b.item(), h.item(), J.item() -print('Equilibrium with monopolist supplier price:', pm.item()) -print('Equilibrium with monopolist supplier allocation:', q.item()) +def total_surplus(x): + return (Π_ * b_ * x - .5 * Π_**2 * x**2) / μ - (h_ * x + .5 * J_ * x**2) -# plot -plot_monopoly(M) +print(f'competitive: q = {c:.4f}, p = {p:.4f}, total surplus = {total_surplus(c):.4f}') +print(f'monopoly : q = {q:.4f}, p = {pm:.4f}, total surplus = {total_surplus(q):.4f}') +print(f'deadweight loss = {total_surplus(c) - total_surplus(q):.4f}') + +xs = np.linspace(0, 2 * c, 100001) +print(f'\nquantity that maximizes total surplus: {xs[np.argmax(total_surplus(xs))]:.4f}') ``` -## Multi-good welfare maximization problem +Let's draw the deadweight loss as the area between the demand curve and the marginal cost curve, over the output that the monopolist declines to produce. -Our welfare maximization problem -- also sometimes called a social planning problem -- is to choose $c$ to maximize +```{code-cell} ipython3 +:tags: [hide-input] -$$ - - \frac{1}{2} \mu^{-1}(\Pi c -b) ^\top (\Pi c -b ) -$$ +xs = np.linspace(0, 2 * c, 200) +demand_inv = lambda x: (Π_ * b_ - Π_**2 * x) / μ +marg_cost = lambda x: h_ + J_ * x -minus the area under the inverse supply curve, namely, +fig, ax = plt.subplots() +ax.plot(xs, demand_inv(xs), label='Demand', color='#600001') +ax.plot(xs, marg_cost(xs), label='Marginal cost', color='#020060') -$$ - h c + \frac{1}{2} c^\top J c -$$ +mask = (xs >= q) & (xs <= c) +ax.fill_between(xs[mask], marg_cost(xs[mask]), demand_inv(xs[mask]), + color='#BBBBBB', label='Deadweight loss') -So the welfare criterion is +ax.scatter(c, p, zorder=10, label='Competitive equilibrium', color='#600001') +ax.scatter(q, pm, zorder=10, label='Equilibrium with monopoly', color='#E55B13') -$$ - - \frac{1}{2} \mu^{-1}(\Pi c -b)^\top (\Pi c -b ) -h c - - \frac{1}{2} c^\top J c -$$ +ax.set_xlabel('Quantity') +ax.set_ylabel('Price') +ax.legend(loc='upper right') +plt.show() +``` -In this formulation, $\mu$ is a parameter that describes how the planner weighs interests of outside suppliers and our representative consumer. +The competitive quantity $4.75$ maximizes total surplus, while the monopolist restricts output to $3.1667$ and so destroys $2.5069$ of surplus, the shaded triangle between the demand curve and the marginal cost curve. -The first-order condition with respect to $c$ is +That the competitive quantity solves the planner's problem is the **first welfare theorem**, here in its single-good form. -$$ -- \mu^{-1} \Pi^\top \Pi c + \mu^{-1}\Pi^\top b - h - H c = 0 -$$ +The monopolist violates the hypothesis of that theorem because it is not a price taker. -which implies {eq}`eq:old5p`. +```{solution-end} +``` -Thus, as for the single-good case, with multiple goods a competitive equilibrium quantity vector solves a planning problem. +#### A multiple good example -(This is another version of the first welfare theorem.) +Let's compare competitive equilibrium and monopoly outcomes in a multiple goods economy. + +```{code-cell} ipython3 +Π = np.array([[1, 0], + [0, 1.2]]) + +b = np.array([10, 10]) + +h = np.array([0.5, 0.5]) + +J = np.array([[1, 0.5], + [0.5, 1]]) +μ = 1 + +M = Monopoly(Π, b, h, J, μ) +c, p = M.competitive_equilibrium() +q, pm = M.equilibrium_with_monopoly() + +print('Competitive equilibrium price:', p) +print('Competitive equilibrium allocation:', c) + +print('Equilibrium with monopolist supplier price:', pm) +print('Equilibrium with monopolist supplier allocation:', q) +``` + +Here the monopolist restricts output of both goods. + +```{note} +With a single good, a monopolist produces less than a competitive industry does. + +With several goods, off-diagonal elements of $\Pi$ or $J$ can lead a monopolist to produce more of one good than a competitive industry would. + +The welfare comparison survives. + +The monopoly quantity vector does not maximize the planner's criterion, so total surplus falls under monopoly. +``` + +## Concluding remarks + +This lecture studied competitive equilibria in an economy with many goods, first in pure exchange and then with production. + +The same mathematical structure describes **dynamics** and **risk**, once we index goods by dates or by states of the world. + +A competitive equilibrium quantity vector solves a planning problem, a version of the first welfare theorem. -We can deduce a competitive equilibrium price vector from either +A monopolist violates the hypothesis of that theorem and destroys surplus. - * the inverse demand curve, or +Our economy contained a single representative consumer, so no question about the distribution of wealth arose. - * the inverse supply curve +{doc}`supply_demand_heterogeneity` lets consumers differ in their preferences and endowments and studies how a competitive equilibrium distributes goods among them.