{
"cells": [
{
"cell_type": "markdown",
"id": "7ce3adb7",
"metadata": {},
"source": [
"\n",
""
]
},
{
"cell_type": "markdown",
"id": "77329eb3",
"metadata": {},
"source": [
"# Irrelevance of Capital Structures with Complete Markets"
]
},
{
"cell_type": "markdown",
"id": "48ffd410",
"metadata": {},
"source": [
"## Contents\n",
"\n",
"- [Irrelevance of Capital Structures with Complete Markets](#Irrelevance-of-Capital-Structures-with-Complete-Markets) \n",
" - [Introduction](#Introduction) \n",
" - [Competitive equilibrium](#Competitive-equilibrium) \n",
" - [Code](#Code) "
]
},
{
"cell_type": "markdown",
"id": "56e68a7a",
"metadata": {},
"source": [
"In addition to what’s in Anaconda, this lecture will need the following libraries:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f027b971",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"!pip install --upgrade quantecon\n",
"!pip install interpolation\n",
"!conda install -y -c plotly plotly plotly-orca"
]
},
{
"cell_type": "markdown",
"id": "dbba98be",
"metadata": {},
"source": [
"## Introduction\n",
"\n",
"This is a prolegomenon to another lecture [Equilibrium Capital Structures with Incomplete Markets](https://python-advanced.quantecon.org/BCG_incomplete_mkts.html) about a model with\n",
"incomplete markets authored by Bisin, Clementi, and Gottardi [[BCG18](https://python-advanced.quantecon.org/zreferences.html#id29)].\n",
"\n",
"We adopt specifications of preferences and technologies very close to\n",
"Bisin, Clemente, and Gottardi’s but unlike them assume that there are complete\n",
"markets in one-period Arrow securities.\n",
"\n",
"This simplification of BCG’s setup helps us by\n",
"\n",
"- creating a benchmark economy to compare with outcomes in BCG’s\n",
" incomplete markets economy \n",
"- creating a good guess for initial values of some equilibrium objects\n",
" to be computed in BCG’s incomplete markets economy via an iterative\n",
" algorithm \n",
"- illustrating classic complete markets outcomes that include \n",
" - indeterminacy of consumers’ portfolio choices \n",
" - indeterminacy of firms’ financial structures that underlies a\n",
" Modigliani-Miller theorem [[MM58](https://python-advanced.quantecon.org/zreferences.html#id30)] \n",
"- introducing `Big K, little k` issues in a simple context that will\n",
" recur in the BCG incomplete markets environment \n",
"\n",
"\n",
"A Big K, little k analysis also played roles in [this quantecon lecture](https://python.quantecon.org/cass_koopmans.html) as well as\n",
"[here](https://python.quantecon.org/rational_expectations.html) and [here](https://python-advanced.quantecon.org/dyn_stack.html)."
]
},
{
"cell_type": "markdown",
"id": "1c43ceec",
"metadata": {},
"source": [
"### Setup\n",
"\n",
"The economy lasts for two periods, $ t=0, 1 $.\n",
"\n",
"There are two types of consumers named $ i=1,2 $.\n",
"\n",
"A scalar random variable $ \\epsilon $ with probability density $ g(\\epsilon) $ affects both\n",
"\n",
"- the return in period $ 1 $ from investing\n",
" $ k \\geq 0 $ in physical capital in period $ 0 $. \n",
"- exogenous period $ 1 $ endowments of the consumption good for\n",
" agents of types $ i =1 $ and $ i=2 $. \n",
"\n",
"\n",
"Type $ i=1 $ and $ i=2 $ agents’ period $ 1 $ endowments are\n",
"correlated with the return on physical capital in different ways.\n",
"\n",
"We discuss two arrangements:\n",
"\n",
"- a command economy in which a benevolent planner chooses $ k $ and\n",
" allocates goods to the two types of consumers in each period and each random\n",
" second period state \n",
"- a competitive equilibrium with markets in claims on physical capital\n",
" and a complete set (possibly a continuum) of one-period Arrow\n",
" securities that pay period $ 1 $ consumption goods contingent on\n",
" the realization of random variable $ \\epsilon $. "
]
},
{
"cell_type": "markdown",
"id": "f136e742",
"metadata": {},
"source": [
"### Endowments\n",
"\n",
"There is a single consumption good in period $ 0 $ and at each\n",
"random state $ \\epsilon $ in period $ 1 $.\n",
"\n",
"Economy-wide endowments in periods $ 0 $ and $ 1 $ are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"w_0 & \\cr\n",
"w_1(\\epsilon) & \\textrm{ in state }\\epsilon\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Soon we’ll explain how aggregate endowments are divided between\n",
"type $ i=1 $ and type $ i=2 $ consumers.\n",
"\n",
"We don’t need to do that in order to describe a social planning problem."
]
},
{
"cell_type": "markdown",
"id": "113dbb6c",
"metadata": {},
"source": [
"### Technology:\n",
"\n",
"Where $ \\alpha \\in (0,1) $ and $ A >0 $\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
" c_0^1 + c_0^2 + k & = w_0^1 + w_0^2 \\cr\n",
" c_1^1(\\epsilon) + c_1^2(\\epsilon) & = w_1^1(\\epsilon) + w_1^2(\\epsilon) + e^\\epsilon A k^\\alpha, \\quad k \\geq 0\n",
"\\end{aligned}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "0e526f06",
"metadata": {},
"source": [
"### Preferences:\n",
"\n",
"A consumer of type $ i $ orders period $ 0 $ consumption\n",
"$ c_0^i $ and state $ \\epsilon $, period $ 1 $ consumption\n",
"$ c^i_1(\\epsilon) $ by\n",
"\n",
"$$\n",
"u^i = u(c_0^i) + \\beta \\int u(c_1^i(\\epsilon)) g (\\epsilon) d \\epsilon, \\quad i = 1,2\n",
"$$\n",
"\n",
"$ \\beta \\in (0,1) $ and the one-period utility function is\n",
"\n",
"$$\n",
"u(c) = \\begin{cases}\n",
"\\frac{c^{1 -\\gamma}} { 1 - \\gamma} & \\textrm{if } \\gamma \\neq 1 \\\\\n",
"\\log c & \\textrm{if } \\gamma = 1\n",
"\\end{cases}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "6843b1f8",
"metadata": {},
"source": [
"### Parameterizations\n",
"\n",
"Following BCG, we shall employ the following parameterizations:\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\epsilon & \\sim {\\mathcal N}(\\mu, \\sigma^2) \\cr\n",
"u(c) & = \\frac{c^{1-\\gamma}}{1 - \\gamma} \\cr\n",
"w_1^i(\\epsilon) & = e^{- \\chi_i \\mu - .5 \\chi_i^2 \\sigma^2 + \\chi_i \\epsilon} , \\quad \\chi_i \\in [0,1]\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Sometimes instead of asuming $ \\epsilon \\sim g(\\epsilon) = {\\mathcal N}(0,\\sigma^2) $,\n",
"we’ll assume that $ g(\\cdot) $ is a probability\n",
"mass function that serves as a discrete approximation to a standardized\n",
"normal density."
]
},
{
"cell_type": "markdown",
"id": "0296aaaf",
"metadata": {},
"source": [
"### Pareto criterion and planning problem\n",
"\n",
"The planner’s objective function is\n",
"\n",
"$$\n",
"\\textrm{obj} = \\phi_1 u^1 + \\phi_2 u^2 , \\quad \\phi_i \\geq 0, \\quad \\phi_1 + \\phi_2 = 1\n",
"$$\n",
"\n",
"where $ \\phi_i \\geq 0 $ is a Pareto weight that the planner attaches\n",
"to a consumer of type $ i $.\n",
"\n",
"We form the following Lagrangian for the planner’s problem:\n",
"\n",
"$$\n",
"\\begin{aligned} L & = \\sum_{i=1}^2 \\phi_i \\left[ u(c_0^i) + \\beta \\int u(c_1^i(\\epsilon)) g (\\epsilon) d \\epsilon \\right] \\cr\n",
" & + \\lambda_0 \\left[ w_0^1 + w_0^2 - k - c_0^1 - c_0^2 \\right] \\cr\n",
" & + \\beta \\int \\lambda_1(\\epsilon) \\left[ w_1^1(\\epsilon) + w_1^2(\\epsilon) + e^\\epsilon A k^\\alpha -\n",
" c_1^1(\\epsilon) - c_1^2(\\epsilon)\\right] g(\\epsilon) d\\epsilon\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"First-order necessary optimality conditions for the planning problem are:\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_0^1: \\quad & \\phi_1 u'(c_0^1) - \\lambda_0 = 0 \\cr\n",
"c_0^2: \\quad & \\phi_2 u'(c_0^2) - \\lambda_0 = 0 \\cr\n",
"c_1^1(\\epsilon): \\quad & \\phi_1 \\beta u'(c_1^1(\\epsilon)) g(\\epsilon) - \\beta \\lambda_1 (\\epsilon) g (\\epsilon) = 0 \\cr\n",
"c_1^2(\\epsilon):\\quad & \\phi_2 \\beta u'(c_1^2(\\epsilon)) g(\\epsilon) - \\beta \\lambda_1 (\\epsilon) g (\\epsilon) = 0 \\cr\n",
"k: \\quad & -\\lambda_0 + \\beta \\alpha A k^{\\alpha -1} \\int \\lambda_1(\\epsilon) e^\\epsilon g(\\epsilon) d \\epsilon = 0\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"The first four equations imply that\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\frac{u'(c_1^1(\\epsilon))}{u'(c_0^1))} & = \\frac{u'(c_1^2(\\epsilon))}{u'(c_0^2))} = \\frac{\\lambda_1(\\epsilon)}{\\lambda_0} \\cr\n",
"\\frac{u'(c_0^1)}{u'(c_0^2)} & = \\frac{u'(c_1^1(\\epsilon))}{u'(c_1^2(\\epsilon))} = \\frac{\\phi_2}{\\phi_1}\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"These together with the fifth first-order condition for the planner\n",
"imply the following equation that determines an optimal choice of\n",
"capital\n",
"\n",
"$$\n",
"1 = \\beta \\alpha A k^{\\alpha -1} \\int \\frac{u'(c_1^i(\\epsilon))}{u'(c_0^i)} e^\\epsilon g(\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"for $ i = 1,2 $."
]
},
{
"cell_type": "markdown",
"id": "7da15160",
"metadata": {},
"source": [
"### Helpful observations and bookkeeping\n",
"\n",
"Evidently,\n",
"\n",
"$$\n",
"u'(c) = c^{-\\gamma}\n",
"$$\n",
"\n",
"and\n",
"\n",
"$$\n",
"\\frac{u'(c^1)}{u'(c^2)} = \\left(\\frac{c^1}{c^2}\\right)^{-\\gamma} = \\frac{\\phi_2}{\\phi_1}\n",
"$$\n",
"\n",
"where it is to be understood that this equation holds for $ c^1 = c^1_0 $ and $ c^2 = c^2_0 $ and also\n",
"for $ c^1 = c^1(\\epsilon) $ and $ c^2 = c^2(\\epsilon) $ for all $ \\epsilon $.\n",
"\n",
"With the same understanding, it follows that\n",
"\n",
"$$\n",
"\\left(\\frac{c^1}{c^2}\\right) = \\left(\\frac{\\phi_2}{\\phi_1}\\right)^{- \\gamma^{-1}}\n",
"$$\n",
"\n",
"Let $ c= c^1 + c^2 $.\n",
"\n",
"It follows from the preceding equation that\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
" c^1 & = \\eta c \\cr\n",
" c^2 & = (1 -\\eta) c\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"where $ \\eta \\in [0,1] $ is a function of $ \\phi_1 $ and\n",
"$ \\gamma $.\n",
"\n",
"Consequently, we can write the planner’s first-order condition for\n",
"$ k $ as\n",
"\n",
"$$\n",
"1 = \\beta \\alpha A k^{\\alpha -1} \\int \\left( \\frac{w_1(\\epsilon) + A k^\\alpha e^\\epsilon}\n",
" {w_0 - k } \\right)^{-\\gamma} e^\\epsilon g(\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"which is one equation to be solved for $ k \\geq 0 $.\n",
"\n",
"Anticipating a `Big K, little k` idea widely used in macroeconomics,\n",
"to be discussed in detail below, let $ K $ be the value of $ k $\n",
"that solves the preceding equation so that\n",
"\n",
"\n",
"\n",
"$$\n",
"1 = \\beta \\alpha A K^{\\alpha -1} \\int \\left( \\frac{w_1(\\epsilon) + A K^\\alpha e^\\epsilon}\n",
" {w_0 - K } \\right)^{-\\gamma} g(\\epsilon) e^\\epsilon d \\epsilon \\tag{37.1}\n",
"$$\n",
"\n",
"The associated optimal consumption allocation is\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"C_0 & = w_0 - K \\cr\n",
"C_1(\\epsilon) & = w_1(\\epsilon) + A K^\\alpha e^\\epsilon \\cr\n",
"c_0^1 & = \\eta C_0 \\cr\n",
"c_0^2 & = (1 - \\eta) C_0 \\cr\n",
"c_1^1(\\epsilon) & = \\eta C_1 (\\epsilon) \\cr\n",
"c_1^2 (\\epsilon) & = (1 - \\eta) C_1(\\epsilon)\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"where $ \\eta \\in [0,1] $ is the consumption share parameter\n",
"mentioned above that is a function of the Pareto weight $ \\phi_1 $\n",
"and the utility curvature parameter $ \\gamma $."
]
},
{
"cell_type": "markdown",
"id": "c574ce4f",
"metadata": {},
"source": [
"#### Remarks\n",
"\n",
"The relative Pareto weight parameter $ \\eta $ does not appear in\n",
"equation [(37.1)](#equation-focke) that determines $ K $.\n",
"\n",
"Neither does it influence $ C_0 $ or $ C_1(\\epsilon) $, which\n",
"depend solely on $ K $.\n",
"\n",
"The role of $ \\eta $ is to determine how to allocate total\n",
"consumption between the two types of consumers.\n",
"\n",
"Thus, the planner’s choice of $ K $ does not interact with how it wants to allocate consumption."
]
},
{
"cell_type": "markdown",
"id": "79335802",
"metadata": {},
"source": [
"## Competitive equilibrium\n",
"\n",
"We now describe a competitive equilibrium for an economy that has\n",
"specifications of consumer preferences, technology, and aggregate\n",
"endowments that are identical to those in the preceding planning\n",
"problem.\n",
"\n",
"While prices do not appear in the planning problem – only quantities do –\n",
"prices play an important role in a competitive equilibrium.\n",
"\n",
"To understand how the planning economy is related to a competitive\n",
"equilibrium, we now turn to the `Big K, little k` distinction."
]
},
{
"cell_type": "markdown",
"id": "f718d0db",
"metadata": {},
"source": [
"### Measures of agents and firms\n",
"\n",
"We follow BCG in assuming that there are unit measures of\n",
"\n",
"- consumers of type $ i=1 $ \n",
"- consumers of type $ i=2 $ \n",
"- firms with access to the production technology that converts\n",
" $ k $ units of time $ 0 $ good into\n",
" $ A k^\\alpha e^\\epsilon $ units of the time $ 1 $ good in\n",
" random state $ \\epsilon $ \n",
"\n",
"\n",
"Thus, let $ \\omega \\in [0,1] $ index a particular consumer of type\n",
"$ i $.\n",
"\n",
"Then define Big $ C^i $ as\n",
"\n",
"$$\n",
"C^i = \\int_0^1 c^i(\\omega) d \\, \\omega\n",
"$$\n",
"\n",
"In the same spirit, let $ \\zeta \\in [0,1] $ index a particular firm.\n",
"Then define Big $ K $ as\n",
"\n",
"$$\n",
"K = \\int_0^1 k(\\zeta) d \\, \\zeta\n",
"$$\n",
"\n",
"The assumption that there are continua of our three types of\n",
"agents plays an important role making each individual agent into a\n",
"powerless **price taker**:\n",
"\n",
"- an individual consumer chooses its own (infinesimal) part\n",
" $ c^i(\\omega) $ of $ C^i $ taking prices as given \n",
"- an individual firm chooses its own (infinitesmimal) part\n",
" $ k(\\zeta) $ of $ K $ taking prices as \n",
"- equilibrium prices depend on the `Big K, Big C` objects\n",
" $ K $ and $ C $ \n",
"\n",
"\n",
"Nevertheless, in equilibrium, $ K = k, C^i = c^i $\n",
"\n",
"The assumption about measures of agents is thus a powerful device for\n",
"making a host of competitive agents take as given equilibrium prices\n",
"that are determined by the independent decisions of hosts of agents who behave just like they do."
]
},
{
"cell_type": "markdown",
"id": "65c4b023",
"metadata": {},
"source": [
"#### Ownership\n",
"\n",
"Consumers of type $ i $ own the following exogenous quantities of\n",
"the consumption good in periods $ 0 $ and $ 1 $:\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
" w_0^i, & \\quad i = 1,2 \\cr\n",
" w_1^i(\\epsilon) & \\quad i = 1,2\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"where\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\sum_i w_0^i & = w_0 \\cr\n",
"\\sum_i w_1^i(\\epsilon) & = w_1(\\epsilon)\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Consumers also own shares in a firm that operates the technology for converting\n",
"nonnegative amounts of the time $ 0 $ consumption good one-for-one\n",
"into a capital good $ k $ that produces\n",
"$ A k^\\alpha e^\\epsilon $ units of the time $ 1 $ consumption good\n",
"in time $ 1 $ state $ \\epsilon $.\n",
"\n",
"Consumers of types $ i=1,2 $ are endowed with $ \\theta_0^i $\n",
"shares of a firm and\n",
"\n",
"$$\n",
"\\theta_0^1 + \\theta_0^2 = 1\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "99f2dcf4",
"metadata": {},
"source": [
"#### Asset markets\n",
"\n",
"At time $ 0 $, consumers trade the following assets with other consumers\n",
"and with firms:\n",
"\n",
"- equities (also known as stocks) issued by firms \n",
"- one-period Arrow securities that pay one unit of consumption at time\n",
" $ 1 $ when the shock $ \\epsilon $ assumes a particular value \n",
"\n",
"\n",
"Later, we’ll allow the firm to issue bonds too, but\n",
"not now."
]
},
{
"cell_type": "markdown",
"id": "2481c563",
"metadata": {},
"source": [
"### Objects appearing in a competitive equilibrium\n",
"\n",
"Let\n",
"\n",
"- $ a^i(\\epsilon) $ be consumer $ i $ ’s purchases of claims\n",
" on time $ 1 $ consumption in state $ \\epsilon $ \n",
"- $ q(\\epsilon) $ be a pricing kernel for one-period Arrow\n",
" securities \n",
"- $ \\theta_0^i \\geq 0 $ be consumer $ i $’s intial share of\n",
" the firm, $ \\sum_i \\theta_0^i =1 $ \n",
"- $ \\theta^i $ be the fraction of a firm’s shares purchased by\n",
" consumer $ i $ at time $ t=0 $ \n",
"- $ V $ be the value of the representative firm \n",
"- $ \\tilde V $ be the value of equity issued by the representative\n",
" firm \n",
"- $ K, C_0 $ be two scalars and $ C_1(\\epsilon) $ a function\n",
" that we use to construct a guess about an equilibrium pricing kernel\n",
" for Arrow securities \n",
"\n",
"\n",
"We proceed to describe constrained optimum problems faced by\n",
"consumers and a representative firm in a competitive equilibrium."
]
},
{
"cell_type": "markdown",
"id": "75206d18",
"metadata": {},
"source": [
"### A representative firm’s problem\n",
"\n",
"A representative firm takes Arrow security prices $ q(\\epsilon) $ as\n",
"given.\n",
"\n",
"The firm purchases capital $ k \\geq 0 $ from consumers at time\n",
"$ 0 $ and finances itself by issuing equity at time $ 0 $.\n",
"\n",
"The firm produces time $ 1 $ goods $ A k^\\alpha e^\\epsilon $ in\n",
"state $ \\epsilon $ and pays all of these `earnings` to owners of its\n",
"equity.\n",
"\n",
"The value of a firm’s equity at time $ 0 $ can be computed by multiplying\n",
"its state-contingent earnings by their Arrow securities prices and then\n",
"adding over all contingencies:\n",
"\n",
"$$\n",
"\\tilde V = \\int A k^\\alpha e^\\epsilon q(\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"Owners of a firm want it to choose $ k $ to maximize\n",
"\n",
"$$\n",
"V = - k + \\int A k^\\alpha e^\\epsilon q(\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"The firm’s first-order necessary condition for an optimal $ k $ is\n",
"\n",
"$$\n",
"- 1 + \\alpha A k^{\\alpha -1} \\int e^\\epsilon q(\\epsilon) d \\epsilon = 0\n",
"$$\n",
"\n",
"The time $ 0 $ value of a representative firm is\n",
"\n",
"$$\n",
"V = - k + \\tilde V\n",
"$$\n",
"\n",
"The right side equals the value of equity minus the cost of the time $ 0 $ goods\n",
"that it purchases and uses as capital."
]
},
{
"cell_type": "markdown",
"id": "fc9a7ad1",
"metadata": {},
"source": [
"### A consumer’s problem\n",
"\n",
"We now pose a consumer’s problem in a competitive equilibrium.\n",
"\n",
"As a price taker, each consumer faces a given Arrow securities pricing kernel\n",
"$ q(\\epsilon) $, a given value of a firm $ V $ that has chosen capital stock $ k $, a price of\n",
"equity $ \\tilde V $, and prospective next period random dividends $ A k^\\alpha e^\\epsilon $.\n",
"\n",
"If we evaluate consumer $ i $’s time $ 1 $ budget constraint at zero consumption $ c^i_1(\\epsilon) = 0 $ and solve for $ -a^i(\\epsilon) $\n",
"we obtain\n",
"\n",
"\n",
"\n",
"$$\n",
"-\\bar a^i(\\epsilon;\\theta^i) = w_1^i(\\epsilon) +\\theta^i A k^\\alpha e^\\epsilon \\tag{37.2}\n",
"$$\n",
"\n",
"The quantity $ - \\bar a^i(\\epsilon;\\theta^i) $ is the maximum amount that it is feasible for consumer $ i $ to repay to\n",
"his Arrow security creditors at time $ 1 $ in state $ \\epsilon $.\n",
"\n",
"Notice that $ -\\bar a^i(\\epsilon;\\theta^i) $ defined in [(37.2)](#equation-debtlimit) depends on\n",
"\n",
"- his endowment $ w_1^i(\\epsilon) $ at time $ 1 $ in state $ \\epsilon $ \n",
"- his share $ \\theta^i $ of a representive firm’s dividends \n",
"\n",
"\n",
"These constitute two sources of **collateral** that back the consumer’s issues of Arrow securities that pay off in state $ \\epsilon $\n",
"\n",
"Consumer $ i $ chooses a scalar $ c_0^i $ and a function\n",
"$ c_1^i(\\epsilon) $ to maximize\n",
"\n",
"$$\n",
"u(c_0^i) + \\beta \\int u(c_1^i(\\epsilon)) g (\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"subject to time $ 0 $ and time $ 1 $ budget constraints\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_0^i & \\leq w_0^i +\\theta_0^i V - \\int q(\\epsilon) a^i(\\epsilon) d \\epsilon - \\theta^i \\tilde V \\cr\n",
"c_1^i(\\epsilon) & \\leq w_1^i(\\epsilon) +\\theta^i A k^\\alpha e^\\epsilon + a^i(\\epsilon)\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Attach Lagrange multiplier $ \\lambda_0^i $ to the budget constraint\n",
"at time $ 0 $ and scaled Lagrange multiplier\n",
"$ \\beta \\lambda_1^i(\\epsilon) g(\\epsilon) $ to the budget constraint\n",
"at time $ 1 $ and state $ \\epsilon $,\n",
"then form the Lagrangian\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"L^i & = u(c_0^i) + \\beta \\int u(c^i_1(\\epsilon)) g(\\epsilon) d \\epsilon \\cr\n",
" & + \\lambda_0^i [ w_0^i + \\theta_0^i - \\int q(\\epsilon) a^i(\\epsilon) d \\epsilon -\n",
" \\theta^i \\tilde V - c_0^i ] \\cr\n",
" & + \\beta \\int \\lambda_1^i(\\epsilon) [ w_1^i(\\epsilon) + \\theta^i A k^\\alpha e^\\epsilon\n",
" + a^i(\\epsilon) c_1^i(\\epsilon) ] g(\\epsilon) d \\epsilon\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Off corners, first-order necessary conditions for an optimum with respect to\n",
"$ c_0^i, c_1^i(\\epsilon), $ and $ a^i(\\epsilon) $ are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_0^i: \\quad & u'(c_0^i) - \\lambda_0^i = 0 \\cr\n",
"c_1^i(\\epsilon): \\quad & \\beta u'(c_1^i(\\epsilon)) g(\\epsilon) - \\beta \\lambda_1^i(\\epsilon) g(\\epsilon) = 0 \\cr\n",
"a^i(\\epsilon): \\quad & -\\lambda_0^i q(\\epsilon) + \\beta \\lambda_1^i(\\epsilon) = 0\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"These equations imply that consumer $ i $ adjusts its consumption\n",
"plan to satisfy\n",
"\n",
"\n",
"\n",
"$$\n",
"q(\\epsilon) = \\beta \\left( \\frac{u'(c_1^i(\\epsilon))}{u'(c_0^i)} \\right) g(\\epsilon) \\tag{37.3}\n",
"$$\n",
"\n",
"To deduce a restriction on equilibrium prices, we\n",
"solve the period $ 1 $ budget constraint to express\n",
"$ a^i(\\epsilon) $ as\n",
"\n",
"$$\n",
"a^i(\\epsilon) = c_1^i(\\epsilon) - w_1^i(\\epsilon) - \\theta^i A k^\\alpha e^\\epsilon\n",
"$$\n",
"\n",
"then substitute the expression on the right side into the time $ 0 $\n",
"budget constraint and rearrange to get the single intertemporal budget\n",
"constraint\n",
"\n",
"\n",
"\n",
"$$\n",
"w_0^i + \\theta_0^i V + \\int w_1^i(\\epsilon) q(\\epsilon) d \\epsilon + \\theta^i \\left[ A k^\\alpha \\int e^\\epsilon q(\\epsilon) d \\epsilon - \\tilde V \\right]\n",
"\\geq c_0^i + \\int c_1^i(\\epsilon) q(\\epsilon) d \\epsilon \\tag{37.4}\n",
"$$\n",
"\n",
"The right side of inequality [(37.4)](#equation-noarb) is the present value\n",
"of consumer $ i $’s consumption while the left side is the present\n",
"value of consumer $ i $’s endowment when consumer $ i $ buys\n",
"$ \\theta^i $ shares of equity.\n",
"\n",
"From inequality [(37.4)](#equation-noarb), we deduce two\n",
"findings.\n",
"\n",
"**1. No arbitrage profits condition:**\n",
"\n",
"Unless\n",
"\n",
"\n",
"\n",
"$$\n",
"\\tilde V = A k^\\alpha \\int e^\\epsilon q (\\epsilon) d \\epsilon \\tag{37.5}\n",
"$$\n",
"\n",
"an **arbitrage** opportunity would be open.\n",
"\n",
"If\n",
"\n",
"$$\n",
"\\tilde V > A k^\\alpha \\int e^\\epsilon q (\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"the consumer could afford an arbitrarily high present value of consumption by setting $ \\theta^i $ to an arbitrarily large **negative**\n",
"number.\n",
"\n",
"If\n",
"\n",
"$$\n",
"\\tilde V < A k^\\alpha \\int e^\\epsilon q (\\epsilon) d \\epsilon\n",
"$$\n",
"\n",
"the consumer could afford an arbitrarily high present value of\n",
"consumption by setting $ \\theta^i $ to be arbitrarily large **positive**\n",
"number.\n",
"\n",
"Since resources are finite, there can exist no such arbitrage\n",
"opportunity in a competitive equilibrium.\n",
"\n",
"Therefore, it must be true\n",
"that the following no arbitrage condition prevails:\n",
"\n",
"\n",
"\n",
"$$\n",
"\\tilde V = \\int A k^\\alpha e^\\epsilon q(\\epsilon;K) d \\epsilon \\tag{37.6}\n",
"$$\n",
"\n",
"Equation [(37.6)](#equation-tildev20) asserts that the value of equity\n",
"equals the value of the state-contingent dividends\n",
"$ Ak^\\alpha e^\\epsilon $ evaluated at the Arrow security prices\n",
"$ q(\\epsilon; K) $ that we have expressed as a function of $ K $.\n",
"\n",
"We’ll say more about this equation later.\n",
"\n",
"**2. Indeterminacy of portfolio**\n",
"\n",
"When the no-arbitrage pricing equation [(37.6)](#equation-tildev20)\n",
"prevails, a consumer of type $ i $’s choice $ \\theta^i $ of equity is\n",
"indeterminate.\n",
"\n",
"Consumer of type $ i $ can offset any choice of\n",
"$ \\theta^i $ by setting an appropriate schedule $ a^i(\\epsilon) $ for purchasing state-contingent\n",
"securities."
]
},
{
"cell_type": "markdown",
"id": "07e21dd1",
"metadata": {},
"source": [
"### Computing competitive equilibrium prices and quantities\n",
"\n",
"Having computed an allocation that solves the planning problem, we can\n",
"readily compute a competitive equilibrium via the following steps that,\n",
"as we’ll see, relies heavily on the `Big K, little k`,\n",
"`Big C, little c` logic mentioned earlier:\n",
"\n",
"- a competitive equilbrium allocation equals the allocation chosen by\n",
" the planner \n",
"- competitive equilibrium prices and the value of a firm’s equity are encoded in shadow prices from the planning problem that\n",
" depend on Big $ K $ and Big $ C $. \n",
"\n",
"\n",
"To substantiate that this procedure is valid, we proceed as follows.\n",
"\n",
"With $ K $ in hand, we make the following guess for competitive\n",
"equilibrium Arrow securities prices\n",
"\n",
"\n",
"\n",
"$$\n",
"q(\\epsilon;K) = \\beta \\left( \\frac{u'\\left( w_1(\\epsilon) + A K^\\alpha e^\\epsilon\\right)} {u'(w_0 - K )} \\right)^{-\\gamma} \\tag{37.7}\n",
"$$\n",
"\n",
"To confirm the guess, we begin by considering its consequences for the firm’s choice of $ k $.\n",
"\n",
"With Arrow securities prices [(37.7)](#equation-arrowprices), the firm’s\n",
"first-order necessary condition for choosing $ k $ becomes\n",
"\n",
"\n",
"\n",
"$$\n",
"-1 + \\alpha A k^{\\alpha -1} \\int e^\\epsilon q(\\epsilon;K) d \\epsilon = 0 \\tag{37.8}\n",
"$$\n",
"\n",
"which can be verified to be satisfied if the firm sets\n",
"\n",
"$$\n",
"k = K\n",
"$$\n",
"\n",
"because by setting $ k=K $ equation [(37.8)](#equation-kk) becomes\n",
"equivalent with the planner’s first-order condition\n",
"[(37.1)](#equation-focke) for setting $ K $.\n",
"\n",
"To pose a consumer’s problem in a competitive equilibrium, we require\n",
"not only the above guess for the Arrow securities pricing kernel\n",
"$ q(\\epsilon) $ but the value of equity $ \\tilde V $:\n",
"\n",
"\n",
"\n",
"$$\n",
"\\tilde V = \\int A K^\\alpha e^\\epsilon q(\\epsilon;K) d \\epsilon \\tag{37.9}\n",
"$$\n",
"\n",
"Let $ \\tilde V $ be the value of equity implied by Arrow securities\n",
"price function [(37.7)](#equation-arrowprices) and formula\n",
"[(37.9)](#equation-tildev2).\n",
"\n",
"At the Arrow securities prices $ q(\\epsilon) $ given by [(37.7)](#equation-arrowprices)\n",
"and equity value $ \\tilde V $ given by [(37.9)](#equation-tildev2),\n",
"consumer $ i=1,2 $ choose consumption allocations and portolios\n",
"that satisfy the first-order necessary conditions\n",
"\n",
"$$\n",
"\\beta \\left( \\frac{u'(c_1^i(\\epsilon))}{u'(c_0^i)} \\right) g(\\epsilon) = q(\\epsilon;K)\n",
"$$\n",
"\n",
"It can be verified directly that the following choices satisfy these\n",
"equations\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_0^1 + c_0^2 & = C_0 = w_0 - K \\cr\n",
"c_0^1(\\epsilon) + c_0^2(\\epsilon) & = C_1(\\epsilon) = w_1(\\epsilon) + A k^\\alpha e ^\\epsilon \\cr\n",
"\\frac{c_1^2(\\epsilon)}{c_1^1(\\epsilon)} & = \\frac{c_0^2}{c_0^1} = \\frac{1-\\eta}{\\eta}\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"for an $ \\eta \\in (0,1) $ that depends on consumers’\n",
"endowments\n",
"$ [w_0^1, w_0^2, w_1^1(\\epsilon), w_1^2(\\epsilon), \\theta_0^1, \\theta_0^2 ] $.\n",
"\n",
"**Remark:** Multiple arrangements of endowments\n",
"$ [w_0^1, w_0^2, w_1^1(\\epsilon), w_1^2(\\epsilon), \\theta_0^1, \\theta_0^2 ] $\n",
"associated with the same distribution of wealth $ \\eta $. Can you explain why?\n",
"**Hint:** Think about the portfolio indeterminacy finding above."
]
},
{
"cell_type": "markdown",
"id": "7e0881da",
"metadata": {},
"source": [
"### Modigliani-Miller theorem\n",
"\n",
"We now allow a firm to issue both bonds and equity.\n",
"\n",
"Payouts from equity and bonds, respectively, are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"d^e(k,b;\\epsilon) &= \\max \\left\\{ e^\\epsilon A k^\\alpha - b, 0 \\right\\} \\\\\n",
"d^b(k,b;\\epsilon) &= \\min \\left\\{ \\frac{e^\\epsilon A k^\\alpha}{b}, 1 \\right\\}\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Thus, one unit of the bond pays one unit of consumption at time\n",
"$ 1 $ in state $ \\epsilon $ if\n",
"$ A k^\\alpha e^\\epsilon - b \\geq 0 $, which is true when\n",
"$ \\epsilon \\geq \\epsilon^* = \\log \\frac{b}{Ak^\\alpha} $, and pays\n",
"$ \\frac{A k^\\alpha e^\\epsilon}{b} $ units of time $ 1 $\n",
"consumption in state $ \\epsilon $ when\n",
"$ \\epsilon < \\epsilon^* $.\n",
"\n",
"The value of the firm is now the sum of equity plus the value of bonds,\n",
"which we denote\n",
"\n",
"$$\n",
"\\tilde V + b p(k,b)\n",
"$$\n",
"\n",
"where $ p(k,b) $ is the price of one unit of the bond when a firm\n",
"with $ k $ units of physical capital issues $ b $ bonds.\n",
"\n",
"We continue to assume that there are complete markets in Arrow\n",
"securities with pricing kernel $ q(\\epsilon) $.\n",
"\n",
"A version of the no-arbitrage-in-equilibrium argument that we presented\n",
"earlier implies that the value of equity and the price of bonds are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\tilde V & = A k^\\alpha \\int_{\\epsilon^*}^\\infty e^\\epsilon q(\\epsilon) d \\epsilon - b \\int_{\\epsilon^*}^\\infty q(\\epsilon) d \\epsilon\\cr\n",
"p(k, b) & = \\frac{A k^\\alpha}{b} \\int_{-\\infty}^{\\epsilon^*} e^\\epsilon q(\\epsilon) d \\epsilon\n",
" + \\int_{\\epsilon^*}^\\infty q(\\epsilon) d \\epsilon\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Consequently, the value of the firm is\n",
"\n",
"$$\n",
"\\tilde V + p(k,b) b = A k^\\alpha \\int_{-\\infty}^\\infty e^\\epsilon q(\\epsilon) d \\epsilon,\n",
"$$\n",
"\n",
"which is the same expression that we obtained above when we assumed that\n",
"the firm issued only equity.\n",
"\n",
"We thus obtain a version of the celebrated Modigliani-Miller theorem [[MM58](https://python-advanced.quantecon.org/zreferences.html#id30)]\n",
"about firms’ finance:\n",
"\n",
"**Modigliani-Miller theorem:**\n",
"\n",
"- The value of a firm is independent the mix of equity and bonds that\n",
" it uses to finance its physical capital. \n",
"- The firms’s decision about how much physical capital to purchase does\n",
" not depend on whether it finances those purchases by issuing bonds\n",
" or equity \n",
"- The firm’s choice of whether to finance itself by issuing equity or\n",
" bonds is indeterminant \n",
"\n",
"\n",
"Please note the role of the assumption of complete markets in Arrow\n",
"securities in substantiating these claims.\n",
"\n",
"In [Equilibrium Capital Structures with Incomplete Markets](https://python-advanced.quantecon.org/BCG_incomplete_mkts.html), we will assume that markets are (very)\n",
"incomplete – we’ll shut down markets in almost all Arrow securities.\n",
"\n",
"That will pull the rug from underneath the Modigliani-Miller theorem."
]
},
{
"cell_type": "markdown",
"id": "349f2760",
"metadata": {},
"source": [
"## Code\n",
"\n",
"We create a class object `BCG_complete_markets` to compute\n",
"equilibrium allocations of the complete market BCG model given a list\n",
"of parameter values.\n",
"\n",
"It consists of 4 functions that do the following things:\n",
"\n",
"- `opt_k` computes the planner’s optimal capital $ K $ \n",
" - First, create a grid for capital. \n",
" - Then for each value of capital stock in the grid, compute the left side of the planner’s\n",
" first-order necessary condition for $ k $, that is, \n",
" $$\n",
" \\beta \\alpha A K^{\\alpha -1} \\int \\left( \\frac{w_1(\\epsilon) + A K^\\alpha e^\\epsilon}{w_0 - K } \\right)^{-\\gamma} e^\\epsilon g(\\epsilon) d \\epsilon - 1 =0\n",
" $$\n",
" - Find $ k $ that solves this equation. \n",
"- `q` computes Arrow security prices as a function of the productivity shock $ \\epsilon $ and capital $ K $: \n",
" $$\n",
" q(\\epsilon;K) = \\beta \\left( \\frac{u'\\left( w_1(\\epsilon) + A K^\\alpha e^\\epsilon\\right)} {u'(w_0 - K )} \\right)\n",
" $$\n",
"- `V` solves for the firm value given capital $ k $: \n",
" $$\n",
" V = - k + \\int A k^\\alpha e^\\epsilon q(\\epsilon; K) d \\epsilon\n",
" $$\n",
"- `opt_c` computes optimal consumptions $ c^i_0 $, and $ c^i(\\epsilon) $: \n",
" - The function first computes weight $ \\eta $ using the\n",
" budget constraint for agent 1: \n",
" $$\n",
" w_0^1 + \\theta_0^1 V + \\int w_1^1(\\epsilon) q(\\epsilon) d \\epsilon\n",
" = c_0^1 + \\int c_1^1(\\epsilon) q(\\epsilon) d \\epsilon\n",
" = \\eta \\left( C_0 + \\int C_1(\\epsilon) q(\\epsilon) d \\epsilon \\right)\n",
" $$\n",
" where \n",
" $$\n",
" \\begin{aligned}\n",
" C_0 & = w_0 - K \\cr\n",
" C_1(\\epsilon) & = w_1(\\epsilon) + A K^\\alpha e^\\epsilon \\cr\n",
" \\end{aligned}\n",
" $$\n",
" - It computes consumption for each agent as \n",
" $$\n",
" \\begin{aligned}\n",
" c_0^1 & = \\eta C_0 \\cr\n",
" c_0^2 & = (1 - \\eta) C_0 \\cr\n",
" c_1^1(\\epsilon) & = \\eta C_1 (\\epsilon) \\cr\n",
" c_1^2 (\\epsilon) & = (1 - \\eta) C_1(\\epsilon)\n",
" \\end{aligned}\n",
" $$\n",
"\n",
"\n",
"The list of parameters includes:\n",
"\n",
"- $ \\chi_1 $, $ \\chi_2 $: Correlation parameters for agents 1\n",
" and 2. Default values are 0 and 0.9, respectively. \n",
"- $ w^1_0 $, $ w^2_0 $: Initial endowments. Default values are 1. \n",
"- $ \\theta^1_0 $, $ \\theta^2_0 $: Consumers’ initial shares of\n",
" a representative firm. Default values are 0.5. \n",
"- $ \\psi $: CRRA risk parameter. Default value is 3. \n",
"- $ \\alpha $: Returns to scale production function parameter.\n",
" Default value is 0.6. \n",
"- $ A $: Productivity of technology. Default value is 2.5. \n",
"- $ \\mu $, $ \\sigma $: Mean and standard deviation of the log of the shock.\n",
" Default values are -0.025 and 0.4, respectively. \n",
"- $ \\beta $: time preference discount factor. Default value is .96. \n",
"- `nb_points_integ`: number of points used for integration through\n",
" Gauss-Hermite quadrature: default value is 10 "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab794c47",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from scipy.stats import norm\n",
"from numba import njit, prange\n",
"from quantecon.optimize import root_finding\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf24ea99",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"#=========== Class: BCG for complete markets ===========#\n",
"class BCG_complete_markets:\n",
"\n",
" # init method or constructor\n",
" def __init__(self,\n",
" 𝜒1 = 0,\n",
" 𝜒2 = 0.9,\n",
" w10 = 1,\n",
" w20 = 1,\n",
" 𝜃10 = 0.5,\n",
" 𝜃20 = 0.5,\n",
" 𝜓 = 3,\n",
" 𝛼 = 0.6,\n",
" A = 2.5,\n",
" 𝜇 = -0.025,\n",
" 𝜎 = 0.4,\n",
" 𝛽 = 0.96,\n",
" nb_points_integ = 10):\n",
"\n",
" #=========== Setup ===========#\n",
" # Risk parameters\n",
" self.𝜒1 = 𝜒1\n",
" self.𝜒2 = 𝜒2\n",
"\n",
" # Other parameters\n",
" self.𝜓 = 𝜓\n",
" self.𝛼 = 𝛼\n",
" self.A = A\n",
" self.𝜇 = 𝜇\n",
" self.𝜎 = 𝜎\n",
" self.𝛽 = 𝛽\n",
"\n",
" # Utility\n",
" self.u = lambda c: (c**(1-𝜓)) / (1-𝜓)\n",
"\n",
" # Production\n",
" self.f = njit(lambda k: A * (k ** 𝛼))\n",
" self.Y = lambda 𝜖, k: np.exp(𝜖) * self.f(k)\n",
"\n",
" # Initial endowments\n",
" self.w10 = w10\n",
" self.w20 = w20\n",
" self.w0 = w10 + w20\n",
"\n",
" # Initial holdings\n",
" self.𝜃10 = 𝜃10\n",
" self.𝜃20 = 𝜃20\n",
"\n",
" # Endowments at t=1\n",
" w11 = njit(lambda 𝜖: np.exp(-𝜒1*𝜇 - 0.5*(𝜒1**2)*(𝜎**2) + 𝜒1*𝜖))\n",
" w21 = njit(lambda 𝜖: np.exp(-𝜒2*𝜇 - 0.5*(𝜒2**2)*(𝜎**2) + 𝜒2*𝜖))\n",
" self.w11 = w11\n",
" self.w21 = w21\n",
"\n",
" self.w1 = njit(lambda 𝜖: w11(𝜖) + w21(𝜖))\n",
"\n",
" # Normal PDF\n",
" self.g = lambda x: norm.pdf(x, loc=𝜇, scale=𝜎)\n",
"\n",
" # Integration\n",
" x, self.weights = np.polynomial.hermite.hermgauss(nb_points_integ)\n",
" self.points_integral = np.sqrt(2) * 𝜎 * x + 𝜇\n",
"\n",
" self.k_foc = k_foc_factory(self)\n",
"\n",
" #=========== Optimal k ===========#\n",
" # Function: solve for optimal k\n",
" def opt_k(self, plot=False):\n",
" w0 = self.w0\n",
"\n",
" # Grid for k\n",
" kgrid = np.linspace(1e-4, w0-1e-4, 100)\n",
"\n",
" # get FONC values for each k in the grid\n",
" kfoc_list = [];\n",
" for k in kgrid:\n",
" kfoc = self.k_foc(k, self.𝜒1, self.𝜒2)\n",
" kfoc_list.append(kfoc)\n",
"\n",
" # Plot FONC for k\n",
" if plot:\n",
" fig, ax = plt.subplots(figsize=(8,7))\n",
" ax.plot(kgrid, kfoc_list, color='blue', label=r'FONC for k')\n",
" ax.axhline(0, color='red', linestyle='--')\n",
" ax.legend()\n",
" ax.set_xlabel(r'k')\n",
" plt.show()\n",
"\n",
" # Find k that solves the FONC\n",
" kk = root_finding.newton_secant(self.k_foc, 1e-2, args=(self.𝜒1, self.𝜒2)).root\n",
"\n",
" return kk\n",
"\n",
" #=========== Arrow security price ===========#\n",
" # Function: Compute Arrow security price\n",
" def q(self,𝜖,k):\n",
" 𝛽 = self.𝛽\n",
" 𝜓 = self.𝜓\n",
" w0 = self.w0\n",
" w1 = self.w1\n",
" fk = self.f(k)\n",
" g = self.g\n",
"\n",
" return 𝛽 * ((w1(𝜖) + np.exp(𝜖)*fk) / (w0 - k))**(-𝜓)\n",
"\n",
"\n",
" #=========== Firm value V ===========#\n",
" # Function: compute firm value V\n",
" def V(self, k):\n",
" q = self.q\n",
" fk = self.f(k)\n",
" weights = self.weights\n",
" integ = lambda 𝜖: np.exp(𝜖) * fk * q(𝜖, k)\n",
"\n",
" return -k + np.sum(weights * integ(self.points_integral)) / np.sqrt(np.pi)\n",
"\n",
" #=========== Optimal c ===========#\n",
" # Function: Compute optimal consumption choices c\n",
" def opt_c(self, k=None, plot=False):\n",
" w1 = self.w1\n",
" w0 = self.w0\n",
" w10 = self.w10\n",
" w11 = self.w11\n",
" 𝜃10 = self.𝜃10\n",
" Y = self.Y\n",
" q = self.q\n",
" V = self.V\n",
" weights = self.weights\n",
"\n",
" if k is None:\n",
" k = self.opt_k()\n",
"\n",
" # Solve for the ratio of consumption 𝜂 from the intertemporal B.C.\n",
" fk = self.f(k)\n",
"\n",
" c1 = lambda 𝜖: (w1(𝜖) + np.exp(𝜖)*fk)*q(𝜖,k)\n",
" denom = np.sum(weights * c1(self.points_integral)) / np.sqrt(np.pi) + (w0 - k)\n",
"\n",
" w11q = lambda 𝜖: w11(𝜖)*q(𝜖,k)\n",
" num = w10 + 𝜃10 * V(k) + np.sum(weights * w11q(self.points_integral)) / np.sqrt(np.pi)\n",
"\n",
" 𝜂 = num / denom\n",
"\n",
" # Consumption choices\n",
" c10 = 𝜂 * (w0 - k)\n",
" c20 = (1-𝜂) * (w0 - k)\n",
" c11 = lambda 𝜖: 𝜂 * (w1(𝜖)+Y(𝜖,k))\n",
" c21 = lambda 𝜖: (1-𝜂) * (w1(𝜖)+Y(𝜖,k))\n",
"\n",
" return c10, c20, c11, c21\n",
"\n",
"\n",
"def k_foc_factory(model):\n",
" 𝜓 = model.𝜓\n",
" f = model.f\n",
" 𝛽 = model.𝛽\n",
" 𝛼 = model.𝛼\n",
" A = model.A\n",
" 𝜓 = model.𝜓\n",
" w0 = model.w0\n",
" 𝜇 = model.𝜇\n",
" 𝜎 = model.𝜎\n",
"\n",
" weights = model.weights\n",
" points_integral = model.points_integral\n",
"\n",
" w11 = njit(lambda 𝜖, 𝜒1, : np.exp(-𝜒1*𝜇 - 0.5*(𝜒1**2)*(𝜎**2) + 𝜒1*𝜖))\n",
" w21 = njit(lambda 𝜖, 𝜒2: np.exp(-𝜒2*𝜇 - 0.5*(𝜒2**2)*(𝜎**2) + 𝜒2*𝜖))\n",
" w1 = njit(lambda 𝜖, 𝜒1, 𝜒2: w11(𝜖, 𝜒1) + w21(𝜖, 𝜒2))\n",
"\n",
" @njit\n",
" def integrand(𝜖, 𝜒1, 𝜒2, k=1e-4):\n",
" fk = f(k)\n",
" return (w1(𝜖, 𝜒1, 𝜒2) + np.exp(𝜖) * fk) ** (-𝜓) * np.exp(𝜖)\n",
"\n",
" @njit\n",
" def k_foc(k, 𝜒1, 𝜒2):\n",
" int_k = np.sum(weights * integrand(points_integral, 𝜒1, 𝜒2, k=k)) / np.sqrt(np.pi)\n",
"\n",
" mul = 𝛽 * 𝛼 * A * k ** (𝛼 - 1) / ((w0 - k) ** (-𝜓))\n",
" val = mul * int_k - 1\n",
"\n",
" return val\n",
"\n",
" return k_foc"
]
},
{
"cell_type": "markdown",
"id": "dfbd3c73",
"metadata": {},
"source": [
"### Examples\n",
"\n",
"Below we provide some examples of how to use `BCG_complete markets`."
]
},
{
"cell_type": "markdown",
"id": "d1b0b77a",
"metadata": {},
"source": [
"#### 1st example\n",
"\n",
"In the first example, we set up instances of BCG complete markets\n",
"models.\n",
"\n",
"We can use either default parameter values or set parameter values as we\n",
"want.\n",
"\n",
"The two instances of the BCG complete markets model, `mdl1` and\n",
"`mdl2`, represent the model with default parameter settings and with agent 2’s income correlation altered to be $ \\chi_2 = -0.9 $,\n",
"respectively."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1043ecf8",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Example: BCG model for complete markets\n",
"mdl1 = BCG_complete_markets()\n",
"mdl2 = BCG_complete_markets(𝜒2=-0.9)"
]
},
{
"cell_type": "markdown",
"id": "3f4eeace",
"metadata": {},
"source": [
"Let’s plot the agents’ time-1 endowments with respect to shocks to see\n",
"the difference in the two models:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "284f85a3",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"#==== Figure 1: HH endowments and firm productivity ====#\n",
"# Realizations of innovation from -3 to 3\n",
"epsgrid = np.linspace(-1,1,1000)\n",
"\n",
"\n",
"fig, ax = plt.subplots(1,2,figsize=(14,6))\n",
"ax[0].plot(epsgrid, mdl1.w11(epsgrid), color='black', label='Agent 1\\'s endowment')\n",
"ax[0].plot(epsgrid, mdl1.w21(epsgrid), color='blue', label='Agent 2\\'s endowment')\n",
"ax[0].plot(epsgrid, mdl1.Y(epsgrid,1), color='red', label=r'Production with $k=1$')\n",
"ax[0].set_xlim([-1,1])\n",
"ax[0].set_ylim([0,7])\n",
"ax[0].set_xlabel(r'$\\epsilon$',fontsize=12)\n",
"ax[0].set_title(r'Model with $\\chi_1 = 0$, $\\chi_2 = 0.9$')\n",
"ax[0].legend()\n",
"ax[0].grid()\n",
"\n",
"ax[1].plot(epsgrid, mdl2.w11(epsgrid), color='black', label='Agent 1\\'s endowment')\n",
"ax[1].plot(epsgrid, mdl2.w21(epsgrid), color='blue', label='Agent 2\\'s endowment')\n",
"ax[1].plot(epsgrid, mdl2.Y(epsgrid,1), color='red', label=r'Production with $k=1$')\n",
"ax[1].set_xlim([-1,1])\n",
"ax[1].set_ylim([0,7])\n",
"ax[1].set_xlabel(r'$\\epsilon$',fontsize=12)\n",
"ax[1].set_title(r'Model with $\\chi_1 = 0$, $\\chi_2 = -0.9$')\n",
"ax[1].legend()\n",
"ax[1].grid()\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "b3b86a37",
"metadata": {},
"source": [
"Let’s also compare the optimal capital stock, $ k $, and optimal\n",
"time-0 consumption of agent 2, $ c^2_0 $, for the two models:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "548b74ae",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Print optimal k\n",
"kk_1 = mdl1.opt_k()\n",
"kk_2 = mdl2.opt_k()\n",
"\n",
"print('The optimal k for model 1: {:.5f}'.format(kk_1))\n",
"print('The optimal k for model 2: {:.5f}'.format(kk_2))\n",
"\n",
"# Print optimal time-0 consumption for agent 2\n",
"c20_1 = mdl1.opt_c(k=kk_1)[1]\n",
"c20_2 = mdl2.opt_c(k=kk_2)[1]\n",
"\n",
"print('The optimal c20 for model 1: {:.5f}'.format(c20_1))\n",
"print('The optimal c20 for model 2: {:.5f}'.format(c20_2))"
]
},
{
"cell_type": "markdown",
"id": "1ccb515f",
"metadata": {},
"source": [
"#### 2nd example\n",
"\n",
"In the second example, we illustrate how the optimal choice of $ k $\n",
"is influenced by the correlation parameter $ \\chi_i $.\n",
"\n",
"We will need to install the `plotly` package for 3D illustration. See\n",
"[https://plotly.com/python/getting-started/](https://plotly.com/python/getting-started/) for further instructions."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5efff4e8",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Mesh grid of 𝜒\n",
"N = 30\n",
"𝜒1grid, 𝜒2grid = np.meshgrid(np.linspace(-1,1,N),\n",
" np.linspace(-1,1,N))\n",
"\n",
"k_foc = k_foc_factory(mdl1)\n",
"\n",
"# Create grid for k\n",
"kgrid = np.zeros_like(𝜒1grid)\n",
"\n",
"w0 = mdl1.w0\n",
"\n",
"@njit(parallel=True)\n",
"def fill_k_grid(kgrid):\n",
" # Loop: Compute optimal k and\n",
" for i in prange(N):\n",
" for j in prange(N):\n",
" X1 = 𝜒1grid[i, j]\n",
" X2 = 𝜒2grid[i, j]\n",
" k = root_finding.newton_secant(k_foc, 1e-2, args=(X1, X2)).root\n",
" kgrid[i, j] = k"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a72651b1",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"%%time\n",
"fill_k_grid(kgrid)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "27b0eb94",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"%%time\n",
"# Second-run\n",
"fill_k_grid(kgrid)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ec00ffd4",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"#=== Example: Plot optimal k with different correlations ===#\n",
"\n",
"from IPython.display import Image\n",
"# Import plotly\n",
"import plotly.graph_objs as go\n",
"\n",
"# Plot optimal k\n",
"fig = go.Figure(data=[go.Surface(x=𝜒1grid, y=𝜒2grid, z=kgrid)])\n",
"fig.update_layout(scene = dict(xaxis_title='x - 𝜒1',\n",
" yaxis_title='y - 𝜒2',\n",
" zaxis_title='z - k',\n",
" aspectratio=dict(x=1,y=1,z=1)))\n",
"fig.update_layout(width=500,\n",
" height=500,\n",
" margin=dict(l=50, r=50, b=65, t=90))\n",
"fig.update_layout(scene_camera=dict(eye=dict(x=2, y=-2, z=1.5)))\n",
"\n",
"# Export to PNG file\n",
"Image(fig.to_image(format=\"png\"))\n",
"# fig.show() will provide interactive plot when running\n",
"# notebook locally"
]
}
],
"metadata": {
"date": 1648773334.9017708,
"filename": "BCG_complete_mkts.md",
"kernelspec": {
"display_name": "Python",
"language": "python3",
"name": "python3"
},
"title": "Irrelevance of Capital Structures with Complete Markets"
},
"nbformat": 4,
"nbformat_minor": 5
}