{ "cells": [ { "cell_type": "markdown", "id": "3cb74f44", "metadata": {}, "source": [ "# Optimal Unemployment Insurance" ] }, { "cell_type": "markdown", "id": "50b70962", "metadata": {}, "source": [ "## Overview\n", "\n", "This lecture describes a model of optimal unemployment\n", "insurance created by Shavell and Weiss (1979) [[SW79](https://python-advanced.quantecon.org/zreferences.html#id6)].\n", "\n", "We use recursive techniques of\n", "Hopenhayn and Nicolini (1997) [[HN97](https://python-advanced.quantecon.org/zreferences.html#id5)] to\n", "compute optimal insurance plans for Shavell and\n", "Weiss’s model.\n", "\n", "Hopenhayn and Nicolini’s model is a generalization of Shavell and Weiss’s along dimensions that we’ll soon describe." ] }, { "cell_type": "markdown", "id": "1352a07f", "metadata": {}, "source": [ "## Shavell and Weiss’s Model\n", "\n", "An unemployed worker orders stochastic processes of\n", "consumption and search effort $\\{c_t , a_t\\}_{t=0}^\\infty$\n", "according to\n", "\n", "\n", "\n", "$$\n", "E \\sum_{t=0}^\\infty \\beta^t \\left[ u(c_t) - a_t \\right] \\tag{39.1}\n", "$$\n", "\n", "where $\\beta \\in (0,1)$ and $u(c)$ is strictly increasing, twice differentiable,\n", "and strictly concave.\n", "\n", "We assume that $u(0)$ is well defined.\n", "\n", "We require that $c_t \\geq 0$ and $a_t \\geq 0$.\n", "\n", "All jobs are alike and pay wage\n", "$w >0$ units of the consumption good each period forever.\n", "\n", "An unemployed\n", "worker searches with effort $a$ and with probability\n", "$p(a)$ receives a permanent job at the beginning\n", "of the next period.\n", "\n", "Furthermore, $a=0$ when the worker is\n", "employed.\n", "\n", "The probability\n", "of finding a job is $p(a)$ where $p$ is an increasing, strictly concave,\n", "and twice differentiable function of $a$ that satisfies\n", "$p(a) \\in [0,1]$ for $a \\geq 0$, $p(0)=0$.\n", "\n", "The consumption good is nonstorable.\n", "\n", "An unemployed worker has no savings and cannot borrow or lend.\n", "\n", "An **insurance agency** or **planner** is the unemployed worker’s only source of consumption\n", "smoothing over time and across states.\n", "\n", "Once a worker has found a job, he is beyond the planner’s grasp.\n", "\n", "- This is Shavell and Weiss’s assumption, but not Hopenhayn and Nicolini’s. \n", "- Hopenhayn and Nicolini allow the unemployment insurance agency to\n", " impose history-dependent taxes on previously unemployed workers. \n", "- Since there is no incentive problem after the worker has found\n", " a job, it is optimal for the agency to provide an employed worker with\n", " a constant level of consumption. \n", "- Hence, Hopenhayn and Nicolini’s insurance agency imposes\n", " a permanent per-period history-dependent tax on a previously\n", " unemployed but presently employed worker. " ] }, { "cell_type": "markdown", "id": "911fcf3f", "metadata": {}, "source": [ "### Autarky\n", "\n", "As a benchmark, we first study the fate of an unemployed worker\n", "who has no access to unemployment insurance.\n", "\n", "Because employment\n", "is an absorbing state for the worker, we work backward from that\n", "state.\n", "\n", "Let $V^e$ be the expected sum of discounted one-period utilities of an employed worker.\n", "\n", "Once the worker is employed, $a=0$, making his period utility\n", "be $u(c)-a = u(w)$ forever.\n", "\n", "Therefore,\n", "\n", "\n", "\n", "$$\n", "V^e = {u(w) \\over (1-\\beta)} . \\tag{39.2}\n", "$$\n", "\n", "Now let $V^u$ be the expected discounted present value of utility for an\n", "unemployed worker who chooses consumption, effort pair $(c,a)$\n", "optimally.\n", "\n", "It satisfies the Bellman equation\n", "\n", "\n", "\n", "$$\n", "V^u = \\max_{a \\geq 0} \\biggl\\{ u(0) - a + \\beta \\left[\n", " p(a) V^e + (1-p(a)) V^u \\right] \\biggr\\} . \\tag{39.3}\n", "$$\n", "\n", "The first-order condition for a maximum is\n", "\n", "\n", "\n", "$$\n", "\\beta p'(a) \\left[V^e - V^u \\right] \\leq 1 , \\tag{39.4}\n", "$$\n", "\n", "with equality if $a>0$.\n", "\n", "Since there is no state variable in this\n", "infinite horizon problem, there is a time-invariant optimal\n", "search intensity $a$ and an associated value of being unemployed $V^u$.\n", "\n", "Let $V_{\\rm aut} = V^u$ solve Bellman equation [(39.3)](#equation-eq-hugo3).\n", "\n", "Equations [(39.3)](#equation-eq-hugo3)\n", "and [(39.4)](#equation-eq-hugo4)\n", "form the basis for\n", "an iterative algorithm for computing $V^u = V_{\\rm aut}$.\n", "\n", "- Let $V^u_j$ be\n", " the estimate of $V_{\\rm aut}$ at the $j$th iteration. \n", "- Use this value\n", " in equation [(39.4)](#equation-eq-hugo4) and solve\n", " for an estimate of effort $a_j$. \n", "- Use this value in a version of equation\n", " [(39.3)](#equation-eq-hugo3) with $V^u_j$ on the right side\n", " to compute $V^u_{j+1}$. \n", "- Iterate to convergence. " ] }, { "cell_type": "markdown", "id": "b1db863c", "metadata": {}, "source": [ "### Full Information\n", "\n", "Another benchmark model helps set the stage for the model with private information that we ultimately want to study.\n", "\n", "In this model, the unemployment agency has full information about the unemployed work.\n", "\n", "We study optimal provision of insurance with\n", "full information.\n", "\n", "An insurance agency can set both\n", "the consumption and search effort of an unemployed person.\n", "\n", "The\n", "agency wants to design an unemployment insurance contract to give\n", "the unemployed worker expected discounted utility $V > V_{\\rm aut}$.\n", "\n", "The planner wants to deliver value $V$ efficiently,\n", "meaning in a way that minimizes expected\n", "discounted cost, using $\\beta$ as the discount factor.\n", "\n", "We formulate the optimal insurance problem\n", "recursively.\n", "\n", "Let $C(V)$ be the expected discounted cost of giving\n", "the worker expected discounted utility\n", "$V$.\n", "\n", "The cost function is strictly convex because\n", "a higher $V$ implies a lower marginal utility of the worker;\n", "that is, additional expected utils can be awarded to the worker\n", "only at an increasing marginal cost in terms of the consumption good.\n", "\n", "Given $V$, the planner assigns first-period pair $(c,a)$ and promised\n", "continuation value $V^u$, should the worker be unlucky\n", "and not find a job.\n", "\n", "$(c, a, V^u)$ are chosen to be functions of $V$ and to\n", "satisfy the Bellman equation\n", "\n", "\n", "\n", "$$\n", "C(V) = \\min_{c, a, V^u} \\biggl\\{ c + \\beta [1 - p(a)] C(V^u) \\biggr\\} , \\tag{39.5}\n", "$$\n", "\n", "where minimization is subject to the promise-keeping constraint\n", "\n", "\n", "\n", "$$\n", "V \\leq u(c) - a + \\beta\n", "\\left\\{ p(a) V^e + [1-p(a)] V^u \\right\\}. \\tag{39.6}\n", "$$\n", "\n", "Here $V^e$ is given by equation [(39.2)](#equation-eq-hugo2), which reflects the\n", "assumption that once the worker is employed, he is beyond the\n", "reach of the unemployment insurance agency.\n", "\n", "The right side of Bellman equation [(39.5)](#equation-eq-hugo5) is attained by\n", "policy functions $c=c(V), a=a(V)$, and $V^u=V^u(V)$.\n", "\n", "The promise-keeping constraint,\n", "equation [(39.6)](#equation-eq-hugo6),\n", "asserts that the 3-tuple $(c, a, V^u)$ attains\n", "at least $V$.\n", "\n", "Let $\\theta$ be a Lagrange multiplier\n", "on constraint [(39.6)](#equation-eq-hugo6).\n", "\n", "At an interior solution, the first-order\n", "conditions with\n", "respect to $c, a$, and $V^u$, respectively, are\n", "\n", "\n", "\n", "\n", "\\begin{aligned} \\theta & = {1 \\over u'(c)}\\,, \\cr\n", " C(V^u) & = \\theta \\left[ {1 \\over \\beta p'(a)} -\n", " (V^e - V^u) \\right]\\,, \\cr\n", " C'(V^u) & = \\theta\\,. \n", "\\end{aligned} \\tag{39.7}\n", "\n", "\n", "The envelope condition $C'(V) = \\theta$ and the third equation\n", "of [(39.7)](#equation-eq-hugo7) imply that $C'(V^u) =C'(V)$.\n", "\n", "Strict convexity of $C$ then\n", "implies that $V^u =V$\n", "\n", "Applied repeatedly over time,\n", "$V^u=V$ makes\n", "the continuation value remain constant during the entire\n", "spell of unemployment.\n", "\n", "The first equation of [(39.7)](#equation-eq-hugo7)\n", "determines $c$, and the second equation of [(39.7)](#equation-eq-hugo7) determines\n", "$a$, both as functions of promised value $V$.\n", "\n", "That $V^u = V$ then\n", "implies that $c$ and $a$ are held constant during the unemployment\n", "spell.\n", "\n", "Thus, the unemployed worker’s consumption $c$ and search effort $a$ are both fully smoothed\n", "during the unemployment spell.\n", "\n", "But the worker’s consumption is not smoothed across states of\n", "employment and unemployment unless $V=V^e$." ] }, { "cell_type": "markdown", "id": "a6e754a0", "metadata": {}, "source": [ "### Incentive Problem\n", "\n", "The preceding efficient insurance scheme requires that the insurance agency\n", "control both $c$ and $a$.\n", "\n", "It will not do for the insurance agency\n", "simply to announce $c$ and then allow the worker to choose $a$.\n", "\n", "Here is why.\n", "\n", "The agency delivers a value $V^u$ higher than\n", "the autarky value $V_{\\rm aut}$ by doing two things.\n", "\n", "It **increases** the unemployed worker’s consumption $c$ and **decreases** his search\n", "effort $a$.\n", "\n", "But the prescribed\n", "search effort is **higher** than what the worker would choose\n", "if he were to be guaranteed consumption level $c$ while he\n", "remains unemployed.\n", "\n", "This follows from the first two equations of [(39.7)](#equation-eq-hugo7) and the\n", "fact that the insurance scheme is costly, $C(V^u)>0$, which imply\n", "$[ \\beta p'(a) ]^{-1} > (V^e - V^u)$.\n", "\n", "But look at the worker’s\n", "first-order condition [(39.4)](#equation-eq-hugo4) under autarky.\n", "\n", "It implies that if search effort $a>0$, then\n", "$[\\beta p'(a)]^{-1} = [V^e - V^u]$, which is inconsistent\n", "with the preceding inequality\n", "$[ \\beta p'(a) ]^{-1} > (V^e - V^u)$ that prevails when $a >0$ under\n", "the social\n", "insurance arrangement.\n", "\n", "If he were free to choose $a$, the worker would therefore want to\n", "fulfill [(39.4)](#equation-eq-hugo4), either at equality so long as $a >0$, or by setting\n", "$a=0$ otherwise.\n", "\n", "Starting from the $a$ associated with\n", "the social insurance scheme,\n", "he would establish the desired equality\n", "in [(39.4)](#equation-eq-hugo4) by *lowering* $a$, thereby decreasing\n", "the term $[ \\beta p'(a) ]^{-1}$ (which also lowers $(V^e - V^u)$\n", "when the value of being\n", "unemployed $V^u$ increases).\n", "\n", "If an equality can be established before\n", "$a$ reaches zero, this would be the worker’s preferred search effort;\n", "otherwise the worker would find it optimal to accept the insurance\n", "payment, set $a=0$, and never work again.\n", "\n", "Thus, since the worker does not take the\n", "cost of the insurance scheme into account, he would choose a search\n", "effort below the socially optimal one.\n", "\n", "The efficient contract\n", "relies on the agency’s ability to control *both* the unemployed\n", "worker’s consumption *and* his search effort." ] }, { "cell_type": "markdown", "id": "a6faca4e", "metadata": {}, "source": [ "## Private Information\n", "\n", "Following Shavell and Weiss (1979) [[SW79](https://python-advanced.quantecon.org/zreferences.html#id6)] and\n", "Hopenhayn and Nicolini (1997) [[HN97](https://python-advanced.quantecon.org/zreferences.html#id5)], now assume that the unemployment insurance agency cannot\n", "observe or enforce $a$, though it can observe and control $c$.\n", "\n", "The worker is free to choose $a$, which puts expression [(39.4)](#equation-eq-hugo4), the worker’s first-order condition under autarky,\n", "back in the picture.\n", "\n", "- We are assuming that the worker’s\n", " best response to the unemployment insurance arrangement is\n", " completely characterized by the first-order condition [(39.4)](#equation-eq-hugo4),\n", " an instance of the so-called first-order approach to incentive problems. \n", "\n", "\n", "Given a contract, the individual will choose search effort according to\n", "first-order condition [(39.4)](#equation-eq-hugo4).\n", "\n", "This fact leads the insurance agency\n", "to design the unemployment insurance contract to respect this restriction.\n", "\n", "Thus, the recursive contract design problem is now to minimize the right side of equation\n", "[(39.5)](#equation-eq-hugo5) subject to expression [(39.6)](#equation-eq-hugo6) and the incentive constraint [(39.4)](#equation-eq-hugo4).\n", "\n", "Since the restrictions [(39.4)](#equation-eq-hugo4) and [(39.6)](#equation-eq-hugo6) are not linear\n", "and generally do not define a convex set, it becomes difficult\n", "to provide conditions under which the solution to the dynamic\n", "programming problem results in a convex function $C(V)$.\n", "\n", "- Sometimes this complication can be handled by convexifying\n", " the constraint set through the introduction of lotteries. \n", "- A common finding is that optimal plans do not involve\n", " lotteries, because convexity of the constraint set is a sufficient\n", " but not necessary condition for convexity of the cost function. \n", "- Following Hopenhayn and Nicolini (1997) [[HN97](https://python-advanced.quantecon.org/zreferences.html#id5)], we therefore proceed under the assumption that $C(V)$ is strictly convex in order to characterize the optimal solution. \n", "\n", "\n", "Let $\\eta$ be the multiplier on constraint [(39.4)](#equation-eq-hugo4), while\n", "$\\theta$ continues to denote the multiplier on constraint [(39.6)](#equation-eq-hugo6).\n", "\n", "But now we replace the weak inequality in [(39.6)](#equation-eq-hugo6) by an equality.\n", "\n", "The unemployment insurance agency cannot award a higher utility than\n", "$V$ because that might violate an incentive-compatibility constraint\n", "for exerting the proper search effort in earlier periods.\n", "\n", "At an interior solution, first-order conditions with\n", "respect to $c, a$, and $V^u$, respectively, are\n", "\n", "\n", "\n", "\n", "\\begin{aligned} \\theta & = {1 \\over u'(c)}\\,, \\cr\n", " C(V^u) & = \\theta \\left[ {1 \\over \\beta p'(a)} - (V^e - V^u) \\right]\n", " \\,-\\, \\eta {p''(a) \\over p'(a)} (V^e - V^u) \\cr\n", " & = \\,- \\eta {p''(a) \\over p'(a)} (V^e - V^u) \\,, \\cr\n", " C'(V^u) & = \\theta \\,-\\, \\eta {p'(a) \\over 1-p(a)}\\, , \n", "\\end{aligned} \\tag{39.8}\n", "\n", "\n", "where the second equality in the second equation in [(39.8)](#equation-eq-hugo8) follows from strict equality\n", "of the incentive constraint [(39.4)](#equation-eq-hugo4) when $a>0$.\n", "\n", "As long as the\n", "insurance scheme is associated with costs, so that $C(V^u)>0$, first-order\n", "condition in the second equation of [(39.8)](#equation-eq-hugo8) implies that the multiplier $\\eta$ is strictly\n", "positive.\n", "\n", "The first-order condition in the second equation of the third equality in [(39.8)](#equation-eq-hugo8) and the\n", "envelope condition $C'(V) = \\theta$ together allow us to conclude that\n", "$C'(V^u) < C'(V)$.\n", "\n", "Convexity of $C$ then implies that $V^u < V$.\n", "\n", "After we have also used the first equation of [(39.8)](#equation-eq-hugo8), it follows that\n", "in order to provide the proper incentives, the consumption\n", "of the unemployed worker must decrease as the duration of the unemployment\n", "spell lengthens.\n", "\n", "It also follows from [(39.4)](#equation-eq-hugo4) at equality that\n", "search effort $a$ rises as $V^u$ falls, i.e., it rises with the duration\n", "of unemployment.\n", "\n", "The duration dependence of benefits is designed to provide\n", "incentives to search.\n", "\n", "To see this, from the third equation of [(39.8)](#equation-eq-hugo8), notice how\n", "the conclusion that consumption falls with the duration of\n", "unemployment depends on the assumption that more search effort\n", "raises the prospect of finding a job, i.e., that $p'(a) > 0$.\n", "\n", "If\n", "$p'(a) =0$, then the third equation of [(39.8)](#equation-eq-hugo8) and the strict convexity of $C$ imply that\n", "$V^u =V$.\n", "\n", "Thus, when $p'(a) =0$, there is no reason for the\n", "planner to make consumption fall with the duration of\n", "unemployment." ] }, { "cell_type": "markdown", "id": "fd2b5308", "metadata": {}, "source": [ "### Computational Details\n", "\n", "It is useful to note that there\n", "are natural lower and upper bounds to the set\n", "of continuation values $V^u$.\n", "\n", "The lower bound is\n", "the expected lifetime utility in autarky,\n", "$V_{\\rm aut}$.\n", "\n", "To compute the upper bound,\n", "represent condition [(39.4)](#equation-eq-hugo4) as\n", "\n", "$$\n", "V^u \\geq V^e - [\\beta p'(a)]^{-1},\n", "$$\n", "\n", "with equality if $a > 0$.\n", "\n", "If there is zero search effort, then $V^u \\geq V^e -[\\beta p'(0)]^{-1}$.\n", "\n", "Therefore, to rule out zero search effort we require\n", "\n", "$$\n", "V^u < V^e - [\\beta p'(0)]^{-1} .\n", "$$\n", "\n", "(Remember that $p''(a) < 0$.)\n", "\n", "This step gives our upper bound\n", "for $V^u$.\n", "\n", "To formulate the Bellman equation numerically,\n", "we suggest using the constraints to eliminate $c$ and $a$ as choice\n", "variables, thereby reducing the Bellman equation to\n", "a minimization over the one choice variable $V^u$.\n", "\n", "First express the promise-keeping constraint [(39.6)](#equation-eq-hugo6) at equality as\n", "\n", "$$\n", "u(c) = V + a - \\beta \\{p(a) V^e +[1-p(a)] V^u \\}\n", "$$\n", "\n", "so that consumption is\n", "\n", "\n", "\n", "$$\n", "c = u^{-1}\\left(\n", " V+a -\\beta [p(a)V^e + (1-p(a))V^u] \\right). \\tag{39.9}\n", "$$\n", "\n", "Similarly, solving the inequality [(39.4)](#equation-eq-hugo4) for $a$ leads to\n", "\n", "\n", "\n", "$$\n", "a = \\max\\left\\{0, p'^{-1} \\left({ 1 \\over \\beta (V^e - V^u) } \\right) \\right\\}. \\tag{39.10}\n", "$$\n", "\n", "When we specialize [(39.10)](#equation-eq-hugo22a) to the functional\n", "form for $p(a)$ used by Hopenhayn and Nicolini, we obtain\n", "\n", "\n", "\n", "$$\n", "a = \\max\\left\\{0, {\\log[r \\beta (V^e - V^u)] \\over r } \\right\\}. \\tag{39.11}\n", "$$\n", "\n", "Formulas [(39.9)](#equation-eq-hugo21) and [(39.11)](#equation-eq-hugo22) express $(c,a)$ as functions\n", "of $V$ and the continuation value $V^u$.\n", "\n", "Using these functions\n", "allows us to write the Bellman equation in $C(V)$ as\n", "\n", "\n", "\n", "$$\n", "C(V) = \\min_{V^u} \\left\\{ c + \\beta [1 - p(a)] C(V^u) \\right\\} \\tag{39.12}\n", "$$\n", "\n", "where $c$ and $a$ are given by equations [(39.9)](#equation-eq-hugo21) and [(39.11)](#equation-eq-hugo22)." ] }, { "cell_type": "markdown", "id": "659650a2", "metadata": {}, "source": [ "### Python Computations\n", "\n", "We’ll approximate the planner’s optimal cost function with cubic splines.\n", "\n", "To do this, we’ll load some useful modules" ] }, { "cell_type": "code", "execution_count": null, "id": "7461641d", "metadata": { "hide-output": false }, "outputs": [], "source": [ "import numpy as np\n", "import scipy as sp\n", "from scipy import optimize\n", "import matplotlib.pyplot as plt\n", "from scipy.interpolate import interp1d" ] }, { "cell_type": "markdown", "id": "84371cf4", "metadata": {}, "source": [ "We first create a class to set up a particular parametrization." ] }, { "cell_type": "code", "execution_count": null, "id": "68f4c179", "metadata": { "hide-output": false }, "outputs": [], "source": [ "class params_instance:\n", " \n", " def __init__(self,\n", " r,\n", " β = 0.999,\n", " σ = 0.500,\n", " w = 100,\n", " n_grid = 50):\n", "\n", " self.β,self.σ,self.w,self.r = β,σ,w,r\n", " self.n_grid = n_grid\n", " uw = self.w**(1-self.σ)/(1-self.σ) #Utility from consuming all wage\n", " self.Ve = uw/(1-β)" ] }, { "cell_type": "markdown", "id": "072b4e09", "metadata": {}, "source": [ "### Parameter Values\n", "\n", "For the other parameters we have just loaded in the above Python code, we’ll set brate the net interest rate $r$ to match the hazard rate – the probability of finding a job in one period – in US data.\n", "\n", "In particular, we seek an $r$ so that in autarky p(a(r)) = 0.1, where a is the optimal search effort.\n", "\n", "First, we create some helper functions." ] }, { "cell_type": "code", "execution_count": null, "id": "443c1183", "metadata": { "hide-output": false }, "outputs": [], "source": [ "# The probability of finding a job given search effort, a and interest rate r.\n", "def p(a,r):\n", " return 1-np.exp(-r*a)\n", "\n", "def invp_prime(x,r):\n", " return -np.log(x/r)/r\n", "\n", "def p_prime(a,r):\n", " return r*np.exp(-r*a)\n", "\n", "# The utiliy function\n", "def u(self,c): \n", " return (c**(1-self.σ))/(1-self.σ)\n", "\n", "def u_inv(self,x):\n", " return ((1-self.σ)*x)**(1/(1-self.σ)) " ] }, { "cell_type": "markdown", "id": "0e9e11b3", "metadata": {}, "source": [ "Recall that under autarky the value for an unemployed worker\n", "satisfies the Bellman equation\n", "\n", "\n", "\n", "$$\n", "V^u = \\max_{a} \\{u(0) - a + \\beta\\left[p_{r}(a)V^e + (1-p_{r}(a))V^u\\right]\\} \\tag{39.13}\n", "$$\n", "\n", "At the optimal choice of $a$, we have the first order condition for this problem as:\n", "\n", "\n", "\n", "$$\n", "\\beta p_{r}'(a)[V^e - V^u] \\leq 1 \\tag{39.14}\n", "$$\n", "\n", "with equality when a >0.\n", "\n", "Given an interest rate $\\bar{r}$, we can solve the autarky problem as follows:\n", "\n", "1. Guess $V^u \\in \\mathbb{R}^{+}$ \n", "1. Given $V^u$, use the FOC [(39.14)](#equation-eq-yad2) to calculate the implied optimal search effort $a$ \n", "1. Evaluate the difference between the LHS and RHS of the Bellman equation [(39.13)](#equation-eq-yad1) \n", "1. Update guess for $V^u$ accordingly, then return to 2) and repeat until the Bellman equation is satisfied. \n", "\n", "\n", "For a given $r$ and guess $V^u$,\n", "the function Vu_error calculates the error in the Bellman equation under the optimal search intensity.\n", "\n", "We’ll soon use this as an input to computing $V^u$." ] }, { "cell_type": "code", "execution_count": null, "id": "aedad162", "metadata": { "hide-output": false }, "outputs": [], "source": [ "# The error in the Bellman equation that requires equality at \n", "# the optimal choices.\n", "def Vu_error(self,Vu,r):\n", " β= self.β\n", " Ve = self.Ve\n", "\n", " a = invp_prime(1/(β*(Ve-Vu)),r)\n", " error = u(self,0) -a + β*(p(a,r)*Ve + (1-p(a,r))*Vu) - Vu\n", " return error" ] }, { "cell_type": "markdown", "id": "2ac7cbe3", "metadata": {}, "source": [ "Since the calibration exercise is to match the hazard rate under autarky to the data, we must find an interest rate $r$ to match p(a,r) = 0.1.\n", "\n", "The function below r_error calculates, for a given guess of $r$ the difference between the model implied equilibrium hazard rate and 0.1.\n", "\n", "This will be used to solve for the a calibrated $r^*$." ] }, { "cell_type": "code", "execution_count": null, "id": "12d98a53", "metadata": { "hide-output": false }, "outputs": [], "source": [ "# The error of our p(a^*) relative to our calibration target\n", "def r_error(self,r):\n", " β = self.β\n", " Ve = self.Ve\n", "\n", " Vu_star = sp.optimize.fsolve(Vu_error_Λ,15000,args = (r))\n", " a_star = invp_prime(1/(β*(Ve-Vu_star)),r) # Assuming a>0\n", " return p(a_star,r) - 0.1" ] }, { "cell_type": "markdown", "id": "d731da9e", "metadata": {}, "source": [ "Now, let us create an instance of the model with our parametrization" ] }, { "cell_type": "code", "execution_count": null, "id": "5a1b6161", "metadata": { "hide-output": false }, "outputs": [], "source": [ "params = params_instance(r = 1e-2) \n", "# Create some lambda functions useful for fsolve function\n", "Vu_error_Λ = lambda Vu,r: Vu_error(params,Vu,r)\n", "r_error_Λ = lambda r: r_error(params,r)" ] }, { "cell_type": "markdown", "id": "fcbe934a", "metadata": {}, "source": [ "We want to compute an $r$ that is consistent with the hazard rate 0.1 in autarky.\n", "\n", "To do so, we will use a bisection strategy." ] }, { "cell_type": "code", "execution_count": null, "id": "4fbc7e65", "metadata": { "hide-output": false }, "outputs": [], "source": [ "r_calibrated = sp.optimize.brentq(r_error_Λ,1e-10,1-1e-10)\n", "print(f\"Interest rate to match 0.1 hazard rate: r = {r_calibrated}\")\n", "\n", "Vu_aut = sp.optimize.fsolve(Vu_error_Λ,15000,args = (r_calibrated))\n", "a_aut = invp_prime(1/(params.β*(params.Ve-Vu_aut)),r_calibrated)\n", "\n", "print(f\"Check p at r: {p(a_aut,r_calibrated)}\")" ] }, { "cell_type": "markdown", "id": "138f00bf", "metadata": {}, "source": [ "Now that we have calibrated our interest rate $r$, we can continue with solving the model with private information." ] }, { "cell_type": "markdown", "id": "9bf83c89", "metadata": {}, "source": [ "### Computation under Private Information\n", "\n", "Our approach to solving the full model is a variant on Judd (1998) [[Jud98](https://python-advanced.quantecon.org/zreferences.html#id166)], who uses a polynomial to approximate the value function and a numerical optimizer to perform the optimization at each iteration.\n", "\n", "In contrast, we will use cubic splines to interpolate across a pre-set grid of points to approximate the value function. For further details of the Judd (1998) [[Jud98](https://python-advanced.quantecon.org/zreferences.html#id166)] method, see [[LS18](https://python-advanced.quantecon.org/zreferences.html#id173)], Section 5.7.\n", "\n", "Our strategy involves finding a function $C(V)$ – the expected cost of giving the worker value $V$ – that satisfies the Bellman equation:\n", "\n", "\n", "\n", "$$\n", "C(V) = \\min_{c,a,V^u} \\{c + \\beta\\left[1-p(a)\\right]C(V^u)\\} \\tag{39.15}\n", "$$\n", "\n", "To solve this model, notice that in equations [(39.9)](#equation-eq-hugo21) and [(39.11)](#equation-eq-hugo22), we have analytical solutions of $c$ and $a$ in terms of (at most) promised value $V$ and $V^u$ (and other parameters).\n", "\n", "We can substitute these equations for $c$ and $a$ and obtain the functional equation [(39.12)](#equation-eq-hugo23) that we want to solve." ] }, { "cell_type": "code", "execution_count": null, "id": "ed28425a", "metadata": { "hide-output": false }, "outputs": [], "source": [ "def calc_c(self,Vu,V,a):\n", " '''\n", " Calculates the optimal consumption choice coming from the constraint of the insurer's problem \n", " (which is also a Bellman equation)\n", " ''' \n", " β,Ve,r = self.β,self.Ve,self.r\n", "\n", " c = u_inv(self,V + a - β*(p(a,r)*Ve + (1-p(a,r))*Vu))\n", " return c\n", "\n", "def calc_a(self,Vu):\n", " '''\n", " Calculates the optimal effort choice coming from the worker's effort optimality condition.\n", " '''\n", "\n", " r,β,Ve = self.r,self.β,self.Ve\n", " \n", " a_temp = np.log(r*β*(Ve - Vu))/r\n", " a = max(0,a_temp)\n", " return a" ] }, { "cell_type": "markdown", "id": "08667c15", "metadata": {}, "source": [ "With these analytical solutions for optimal $c$ and $a$ in hand, we can reduce the minimization to [(39.12)](#equation-eq-hugo23) in the single variable\n", "$V^u$.\n", "\n", "With this in hand, we have our algorithm." ] }, { "cell_type": "markdown", "id": "e272682f", "metadata": {}, "source": [ "### Algorithm\n", "\n", "1. Fix a set of grid points $grid_V$ for $V$ and $Vu_{grid}$ for $V^u$ \n", "1. Guess a function $C_0(V)$ that is evaluated at a grid $grid_V$. \n", "1. For each point in $grid_V$ find the $V^u$ that minimizes the expression on right side of [(39.12)](#equation-eq-hugo23). We find the minimum by evaluating the right side of [(39.12)](#equation-eq-hugo23) at each point in $Vu_{grid}$ and then finding the minimum using cubic splines. \n", "1. Evaluating the minimum across all points in $grid_V$ gives you another function $C_1(V)$. \n", "1. If $C_0(V)$ and $C_1(V)$ are sufficiently different, then repeat steps 3-4 again. Otherwise, we are done. \n", "1. Thus, the iterations are $C_{j+1}(V) = \\min_{c,a, V^u} \\{c - \\beta [1 - p(a) ] C_j(V)\\}$. \n", "\n", "\n", "The function iterate_C below executes step 3 in the above algorithm." ] }, { "cell_type": "code", "execution_count": null, "id": "34738372", "metadata": { "hide-output": false }, "outputs": [], "source": [ "# Operator iterate_C that calculates the next iteration of the cost function.\n", "def iterate_C(self,C_old,Vu_grid):\n", "\n", " '''\n", " We solve the model by minimising the value function across a grid of possible promised values.\n", " '''\n", " β,r,n_grid = self.β,self.r,self.n_grid\n", "\n", " C_new = np.zeros(n_grid)\n", " cons_star = np.zeros(n_grid)\n", " a_star = np.zeros(n_grid)\n", " V_star = np.zeros(n_grid)\n", "\n", " C_new2 = np.zeros(n_grid)\n", " V_star2 = np.zeros(n_grid) \n", "\n", " for V_i in range(n_grid):\n", " C_Vi_temp = np.zeros(n_grid)\n", " cons_Vi_temp = np.zeros(n_grid)\n", " a_Vi_temp = np.zeros(n_grid)\n", "\n", " for Vu_i in range(n_grid):\n", " a_i = calc_a(self,Vu_grid[Vu_i])\n", " c_i = calc_c(self,Vu_grid[Vu_i],Vu_grid[V_i],a_i)\n", "\n", " C_Vi_temp[Vu_i] = c_i + β*(1-p(a_i,r))*C_old[Vu_i] \n", " cons_Vi_temp[Vu_i] = c_i\n", " a_Vi_temp[Vu_i] = a_i\n", "\n", " # Interpolate across the grid to get better approximation of the minimum\n", " C_Vi_temp_interp = sp.interpolate.interp1d(Vu_grid,C_Vi_temp, kind = 'cubic')\n", " cons_Vi_temp_interp = sp.interpolate.interp1d(Vu_grid,cons_Vi_temp, kind = 'cubic')\n", " a_Vi_temp_interp = sp.interpolate.interp1d(Vu_grid,a_Vi_temp, kind = 'cubic')\n", "\n", " res = sp.optimize.minimize_scalar(C_Vi_temp_interp,method='bounded',bounds = (Vu_min,Vu_max))\n", " V_star[V_i] = res.x\n", " C_new[V_i] = res.fun\n", " \n", " # Save the associated consumpton and search policy functions as well\n", " cons_star[V_i] = cons_Vi_temp_interp(V_star[V_i])\n", " a_star[V_i] = a_Vi_temp_interp(V_star[V_i]) \n", "\n", " return C_new,V_star,cons_star,a_star" ] }, { "cell_type": "markdown", "id": "517efcf3", "metadata": {}, "source": [ "The below code executes steps 4 and 5 in the Algorithm until convergence to a function $C^*(V)$." ] }, { "cell_type": "code", "execution_count": null, "id": "8e3bf46a", "metadata": { "hide-output": false }, "outputs": [], "source": [ "def solve_incomplete_info_model(self,Vu_grid,Vu_aut,tol = 1e-6,max_iter = 10000):\n", " iter = 0\n", " error = 1\n", "\n", " C_init = np.ones(self.n_grid)*0\n", " C_old = np.copy(C_init)\n", "\n", " while itertol:\n", " C_new,V_new,cons_star,a_star = iterate_C(self,C_old,Vu_grid)\n", " error = np.max(np.abs(C_new - C_old))\n", " \n", " #Only print the iterations every 50 steps\n", " if iter % 50 ==0:\n", " print(f\"Iteration: {iter}, error:{error}\")\n", " C_old = np.copy(C_new)\n", " iter+=1\n", "\n", " return C_new,V_new,cons_star,a_star" ] }, { "cell_type": "markdown", "id": "215c2a61", "metadata": {}, "source": [ "## Outcomes\n", "\n", "Using the above functions, we create another instance of the parameters with the correctly calibrated interest rate, $r$." ] }, { "cell_type": "code", "execution_count": null, "id": "6cd9b240", "metadata": { "hide-output": false }, "outputs": [], "source": [ "##? Create another instance with the correct r now\n", "params = params_instance(r = r_calibrated) \n", "\n", "#Set up grid\n", "Vu_min = Vu_aut\n", "Vu_max = params.Ve - 1/(params.β*p_prime(0,params.r))\n", "Vu_grid = np.linspace(Vu_min,Vu_max,params.n_grid)\n", "\n", "#Solve model\n", "C_star,V_star,cons_star,a_star = solve_incomplete_info_model(params,Vu_grid,Vu_aut,tol = 1e-6,max_iter = 10000) #,cons_star,a_star\n", "\n", "# Since we have the policy functions in grid form, we will interpolate them to be able to\n", "# evaluate any promised value\n", "cons_star_interp = sp.interpolate.interp1d(Vu_grid,cons_star)\n", "a_star_interp = sp.interpolate.interp1d(Vu_grid,a_star)\n", "V_star_interp = sp.interpolate.interp1d(Vu_grid,V_star)" ] }, { "cell_type": "markdown", "id": "c5dac40c", "metadata": {}, "source": [ "### Replacement Ratios and Continuation Values\n", "\n", "We want to graph the replacement ratio ($c/w$) and search effort $a$ as functions of the duration of unemployment.\n", "\n", "We’ll do this for three levels of $V_0$, the lowest being the autarky value $V_{\\rm aut}$.\n", "\n", "We accomplish this by using the optimal policy functions V_star, cons_star and a_star computed above as well the following iterative procedure:" ] }, { "cell_type": "code", "execution_count": null, "id": "afb65953", "metadata": { "hide-output": false }, "outputs": [], "source": [ "# Replacement ratio and effort as a function of unemployment duration\n", "T_max = 52\n", "Vu_t = np.empty((T_max,3))\n", "cons_t = np.empty((T_max-1,3))\n", "a_t = np.empty((T_max-1,3))\n", "\n", "# Calculate the replacement ratios depending on different initial\n", "# promised values\n", "Vu_0_hold = np.array([Vu_aut,16942,17000])" ] }, { "cell_type": "code", "execution_count": null, "id": "e978b0ca", "metadata": { "hide-output": false }, "outputs": [], "source": [ "for i,Vu_0, in enumerate(Vu_0_hold):\n", " Vu_t[0,i] = Vu_0 \n", " for t in range(1,T_max):\n", " cons_t[t-1,i] = cons_star_interp(Vu_t[t-1,i])\n", " a_t[t-1,i] = a_star_interp(Vu_t[t-1,i])\n", " Vu_t[t,i] = V_star_interp(Vu_t[t-1,i])" ] }, { "cell_type": "code", "execution_count": null, "id": "c0c2b941", "metadata": { "hide-output": false }, "outputs": [], "source": [ "fontSize = 10\n", "plt.rc('font', size=fontSize) # controls default text sizes\n", "plt.rc('axes', titlesize=fontSize) # fontsize of the axes title\n", "plt.rc('axes', labelsize=fontSize) # fontsize of the x and y labels\n", "plt.rc('xtick', labelsize=fontSize) # fontsize of the tick labels\n", "plt.rc('ytick', labelsize=fontSize) # fontsize of the tick labels\n", "plt.rc('legend', fontsize=fontSize) # legend fontsize\n", "\n", "f1 = plt.figure(figsize = (8,8))\n", "plt.subplot(2,1,1)\n", "plt.plot(range(T_max-1),cons_t[:,0]/params.w,label = '$V^u_0$ = 16759 (aut)',color = 'red')\n", "plt.plot(range(T_max-1),cons_t[:,1]/params.w,label = '$V^u_0$ = 16942',color = 'blue')\n", "plt.plot(range(T_max-1),cons_t[:,2]/params.w,label = '$V^u_0$ = 17000',color = 'green')\n", "plt.ylabel(\"Replacement ratio (c/w)\")\n", "plt.legend()\n", "plt.title(\"Optimal replacement ratio\")\n", "\n", "plt.subplot(2,1,2)\n", "plt.plot(range(T_max-1),a_t[:,0],color = 'red')\n", "plt.plot(range(T_max-1),a_t[:,1],color = 'blue')\n", "plt.plot(range(T_max-1),a_t[:,2],color = 'green')\n", "plt.ylim(0,320)\n", "plt.ylabel(\"Optimal search effort (a)\")\n", "plt.xlabel(\"Duration of unemployment\")\n", "plt.title(\"Optimal search effort\")\n", "plt.show()" ] }, { "cell_type": "markdown", "id": "dc3e474c", "metadata": {}, "source": [ "For an initial promised value $V^u = V_{\\rm aut}$, the planner chooses the autarky level of $0$ for the replacement ratio and instructs the worker to search at the autarky search intensity, regardless of the duration of unemployment\n", "\n", "But for $V^u > V_{\\rm aut}$, the planner makes the replacement ratio decline and search effort increase with the duration of unemployment." ] }, { "cell_type": "markdown", "id": "49c5307c", "metadata": {}, "source": [ "### Interpretations\n", "\n", "The downward slope of the replacement ratio when $V^u > V_{\\rm aut}$ is a consequence of the\n", "the planner’s limited information about the worker’s search effort.\n", "\n", "By providing the worker with a duration-dependent schedule of replacement ratios, the planner induces the worker in effect to reveal\n", "his/her search effort to the planner.\n", "\n", "We saw earlier that with full information, the\n", "planner would smooth consumption\n", "over an unemployment spell by\n", "keeping the replacement ratio constant.\n", "\n", "With private information, the planner can’t observe the worker’s search effort\n", "and therefore makes the replacement ratio fall.\n", "\n", "Evidently, search\n", "effort rise as the duration of unemployment increases, especially\n", "early in an unemployment spell.\n", "\n", "There is a **carrot-and-stick**\n", "aspect to the replacement rate and search effort schedules:\n", "\n", "- the **carrot** occurs in the forms of high compensation and low search\n", " effort early in an unemployment spell. \n", "- the **stick** occurs in the low compensation and high effort later in\n", " the spell. \n", "\n", "\n", "We shall encounter a related carrot-and-stick feature in our other lectures about dynamic programming squared.\n", "\n", "The planner offers declining benefits and induces increased search\n", "effort as the duration of an unemployment spell rises in order to provide an\n", "unemployed worker with proper incentives, not to punish an unlucky worker\n", "who has been unemployed for a long time.\n", "\n", "The planner believes that a worker who has been unemployed a long time is unlucky, not that he has\n", "done anything wrong (i.e., has not lived up to the contract).\n", "\n", "Indeed, the\n", "contract is designed to induce the unemployed workers to search in\n", "the way the planner expects.\n", "\n", "The falling consumption and rising\n", "search effort of the unlucky ones with long unemployment spells are\n", "simply costs that have to be paid in order to provide\n", "proper incentives." ] } ], "metadata": { "date": 1672634196.4386618, "filename": "un_insure.md", "kernelspec": { "display_name": "Python", "language": "python3", "name": "python3" }, "title": "Optimal Unemployment Insurance" }, "nbformat": 4, "nbformat_minor": 5 }