{
"cells": [
{
"cell_type": "markdown",
"id": "5e8df19f",
"metadata": {},
"source": [
"\n",
"<a id='jv'></a>"
]
},
{
"cell_type": "markdown",
"id": "a174632e",
"metadata": {},
"source": [
"# Job Search V: On-the-Job Search\n",
"\n",
"\n",
"<a id='index-1'></a>"
]
},
{
"cell_type": "markdown",
"id": "aefa2883",
"metadata": {},
"source": [
"## Contents\n",
"\n",
"- [Job Search V: On-the-Job Search](#Job-Search-V:-On-the-Job-Search) \n",
" - [Overview](#Overview) \n",
" - [Model](#Model) \n",
" - [Implementation](#Implementation) \n",
" - [Solving for Policies](#Solving-for-Policies) \n",
" - [Exercises](#Exercises) \n",
" - [Solutions](#Solutions) "
]
},
{
"cell_type": "markdown",
"id": "ba010ef9",
"metadata": {},
"source": [
"## Overview"
]
},
{
"cell_type": "markdown",
"id": "2544962b",
"metadata": {},
"source": [
"### Model features\n",
"\n",
"\n",
"<a id='index-2'></a>\n",
"- job-specific human capital accumulation combined with on-the-job search \n",
"- infinite horizon dynamic programming with one state variable and two controls "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d32feea",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"using LinearAlgebra, Statistics\n",
"using Distributions, Interpolations\n",
"using FastGaussQuadrature, SpecialFunctions\n",
"using LaTeXStrings, Plots, NLsolve, Random"
]
},
{
"cell_type": "markdown",
"id": "d1f90484",
"metadata": {},
"source": [
"## Model\n",
"\n",
"\n",
"<a id='index-3'></a>\n",
"Let\n",
"\n",
"- $ x_t $ denote the time-$ t $ job-specific human capital of a worker employed at a given firm \n",
"- $ w_t $ denote current wages \n",
"\n",
"\n",
"Let $ w_t = x_t(1 - s_t - \\phi_t) $, where\n",
"\n",
"- $ \\phi_t $ is investment in job-specific human capital for the current role \n",
"- $ s_t $ is search effort, devoted to obtaining new offers from other firms \n",
"\n",
"\n",
"For as long as the worker remains in the current job, evolution of\n",
"$ \\{x_t\\} $ is given by $ x_{t+1} = G(x_t, \\phi_t) $.\n",
"\n",
"When search effort at $ t $ is $ s_t $, the worker receives a new job\n",
"offer with probability $ \\pi(s_t) \\in [0, 1] $.\n",
"\n",
"Value of offer is $ U_{t+1} $, where $ \\{U_t\\} $ is iid with common distribution $ F $.\n",
"\n",
"Worker has the right to reject the current offer and continue with existing job.\n",
"\n",
"In particular, $ x_{t+1} = U_{t+1} $ if accepts and $ x_{t+1} = G(x_t, \\phi_t) $ if rejects.\n",
"\n",
"Letting $ b_{t+1} \\in \\{0,1\\} $ be binary with $ b_{t+1} = 1 $ indicating an offer, we can write\n",
"\n",
"\n",
"<a id='equation-jd'></a>\n",
"$$\n",
"x_{t+1}\n",
"= (1 - b_{t+1}) G(x_t, \\phi_t) + b_{t+1}\n",
" \\max \\{ G(x_t, \\phi_t), U_{t+1}\\} \\tag{33.1}\n",
"$$\n",
"\n",
"Agent’s objective: maximize expected discounted sum of wages via controls $ \\{s_t\\} $ and $ \\{\\phi_t\\} $.\n",
"\n",
"Taking the expectation of $ V(x_{t+1}) $ and using [(33.1)](#equation-jd),\n",
"the Bellman equation for this problem can be written as\n",
"\n",
"\n",
"<a id='equation-jvbell'></a>\n",
"$$\n",
"V(x)\n",
"= \\max_{s + \\phi \\leq 1}\n",
" \\left\\{\n",
" x (1 - s - \\phi) + \\beta (1 - \\pi(s)) V[G(x, \\phi)] +\n",
" \\beta \\pi(s) \\int V[G(x, \\phi) \\vee u] F(du)\n",
" \\right\\}. \\tag{33.2}\n",
"$$\n",
"\n",
"Here nonnegativity of $ s $ and $ \\phi $ is understood, while\n",
"$ a \\vee b := \\max\\{a, b\\} $."
]
},
{
"cell_type": "markdown",
"id": "fbea3dca",
"metadata": {},
"source": [
"### Parameterization\n",
"\n",
"\n",
"<a id='index-4'></a>\n",
"In the implementation below, we will focus on the parameterization.\n",
"\n",
"$$\n",
"G(x, \\phi) = A (x \\phi)^{\\alpha},\n",
"\\quad\n",
"\\pi(s) = \\sqrt s\n",
"\\quad \\text{and} \\quad\n",
"F = \\text{Beta}(2, 2)\n",
"$$\n",
"\n",
"with default parameter values\n",
"\n",
"- $ A = 1.4 $ \n",
"- $ \\alpha = 0.6 $ \n",
"- $ \\beta = 0.96 $ \n",
"\n",
"\n",
"The Beta(2,2) distribution is supported on $ (0,1) $. It has a unimodal, symmetric density peaked at 0.5."
]
},
{
"cell_type": "markdown",
"id": "83f09ab5",
"metadata": {},
"source": [
"### Quadrature\n",
"\n",
"In order to calculate expectations over the continuously valued $ F $ distribution, we need to either draw values\n",
"and use Monte Carlo integration, or discretize.\n",
"\n",
"[Gaussian Quadrature](https://en.wikipedia.org/wiki/Gaussian_quadrature) methods use orthogonal polynomials to generate $ N $ nodes, $ x $ and weights, $ w $, to calculate integrals of the form $ \\int f(x) dx \\approx \\sum_{n=1}^N w_n f(x_n) $ for various bounded domains.\n",
"\n",
"Here we will use [Gauss-Jacobi Quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Jacobi_quadrature) which is ideal for expectations over beta.\n",
"\n",
"See [general packages](https://julia.quantecon.org/../more_julia/general_packages.html) for details on the derivation in this particular case."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "69c4e67e",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"function gauss_jacobi(F::Beta, N)\n",
" s, wj = FastGaussQuadrature.gaussjacobi(N, F.β - 1, F.α - 1)\n",
" x = (s .+ 1) ./ 2\n",
" C = 2.0^(-(F.α + F.β - 1.0)) / SpecialFunctions.beta(F.α, F.β)\n",
" w = C .* wj\n",
" return x, w\n",
"end\n",
"f(x) = x^2\n",
"F = Beta(2, 2)\n",
"x, w = gauss_jacobi(F, 20)\n",
"# compare to monte-carlo integration\n",
"@show dot(w, f.(x)), mean(f.(rand(F, 1000)));"
]
},
{
"cell_type": "markdown",
"id": "74af22ac",
"metadata": {},
"source": [
"\n",
"<a id='jvboecalc'></a>"
]
},
{
"cell_type": "markdown",
"id": "64209864",
"metadata": {},
"source": [
"### Back-of-the-Envelope Calculations\n",
"\n",
"Before we solve the model, let’s make some quick calculations that\n",
"provide intuition on what the solution should look like.\n",
"\n",
"To begin, observe that the worker has two instruments to build\n",
"capital and hence wages:\n",
"\n",
"1. invest in capital specific to the current job via $ \\phi $ \n",
"1. search for a new job with better job-specific capital match via $ s $ \n",
"\n",
"\n",
"Since wages are $ x (1 - s - \\phi) $, marginal cost of investment via either $ \\phi $ or $ s $ is identical.\n",
"\n",
"Our risk neutral worker should focus on whatever instrument has the highest expected return.\n",
"\n",
"The relative expected return will depend on $ x $.\n",
"\n",
"For example, suppose first that $ x = 0.05 $\n",
"\n",
"- If $ s=1 $ and $ \\phi = 0 $, then since $ G(x,\\phi) = 0 $,\n",
" taking expectations of [(33.1)](#equation-jd) gives expected next period capital equal to $ \\pi(s) \\mathbb{E} U\n",
" = \\mathbb{E} U = 0.5 $. \n",
"- If $ s=0 $ and $ \\phi=1 $, then next period capital is $ G(x, \\phi) = G(0.05, 1) \\approx 0.23 $. \n",
"\n",
"\n",
"Both rates of return are good, but the return from search is better.\n",
"\n",
"Next suppose that $ x = 0.4 $\n",
"\n",
"- If $ s=1 $ and $ \\phi = 0 $, then expected next period capital is again $ 0.5 $ \n",
"- If $ s=0 $ and $ \\phi = 1 $, then $ G(x, \\phi) = G(0.4, 1) \\approx 0.8 $ \n",
"\n",
"\n",
"Return from investment via $ \\phi $ dominates expected return from search.\n",
"\n",
"Combining these observations gives us two informal predictions:\n",
"\n",
"1. At any given state $ x $, the two controls $ \\phi $ and $ s $ will function primarily as substitutes — worker will focus on whichever instrument has the higher expected return. \n",
"1. For sufficiently small $ x $, search will be preferable to investment in job-specific human capital. For larger $ x $, the reverse will be true. \n",
"\n",
"\n",
"Now let’s turn to implementation, and see if we can match our predictions."
]
},
{
"cell_type": "markdown",
"id": "49064cdb",
"metadata": {},
"source": [
"## Implementation\n",
"\n",
"\n",
"<a id='index-5'></a>\n",
"The following code solves the DP problem described above"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5e359a0a",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"function jv_worker(; A = 1.4,\n",
" alpha = 0.6,\n",
" beta = 0.96,\n",
" grid_size = 50,\n",
" quad_size = 30,\n",
" epsilon = 1e-4)\n",
" G(x, phi) = A .* (x .* phi) .^ alpha\n",
" pi_func = sqrt\n",
" F = Beta(2, 2)\n",
"\n",
" # Discretize the grid using Gauss-Jacobi quadrature\n",
" # u are nodes, w are weights.\n",
" u, w = gauss_jacobi(F, quad_size)\n",
"\n",
" # Set up grid over the state space for DP\n",
" # Max of grid is the max of a large quantile value for F and the\n",
" # fixed point y = G(y, 1).\n",
" grid_max = max(A^(1.0 / (1.0 - alpha)), quantile(F, 1 - epsilon))\n",
"\n",
" # range for range(epsilon, grid_max, grid_size). Needed for\n",
" # CoordInterpGrid below\n",
" x_grid = range(epsilon, grid_max, length = grid_size)\n",
"\n",
" return (; A, alpha, beta, x_grid, G,\n",
" pi_func, F, u, w, epsilon)\n",
"end\n",
"\n",
"function T!(jv, V, new_V)\n",
"\n",
" # simplify notation\n",
" (; G, pi_func, beta, u, w, epsilon) = jv\n",
"\n",
" # prepare interpoland of value function\n",
" Vf = LinearInterpolation(jv.x_grid, V, extrapolation_bc = Line())\n",
"\n",
" # instantiate the linesearch variables\n",
" max_val = -1.0\n",
" cur_val = 0.0\n",
" max_s = 1.0\n",
" max_phi = 1.0\n",
" search_grid = range(epsilon, 1.0, length = 15)\n",
"\n",
" # objective function\n",
" function w_x(x, s, phi)\n",
" h(u_val) = Vf(max(G(x, phi), u_val))\n",
" integral = dot(h.(u), w) # using quadrature weights/values\n",
" q = pi_func(s) * integral + (1.0 - pi_func(s)) * Vf(G(x, phi))\n",
" return -x * (1.0 - phi - s) - beta * q\n",
" end\n",
"\n",
" for (i, x) in enumerate(jv.x_grid)\n",
" for s in search_grid\n",
" for phi in search_grid\n",
" cur_val = ifelse(s + phi <= 1.0, -w_x(x, s, phi), -1.0)\n",
" if cur_val > max_val\n",
" max_val, max_s, max_phi = cur_val, s, phi\n",
" end\n",
" end\n",
" end\n",
"\n",
" new_V[i] = max_val\n",
" end\n",
"end\n",
"\n",
"function T!(jv, V, out::Tuple)\n",
"\n",
" # simplify notation\n",
" (; G, pi_func, beta, u, w, epsilon) = jv\n",
"\n",
" # prepare interpoland of value function\n",
" Vf = LinearInterpolation(jv.x_grid, V, extrapolation_bc = Line())\n",
"\n",
" # instantiate variables\n",
" s_policy, phi_policy = out[1], out[2]\n",
"\n",
" # instantiate the linesearch variables\n",
" max_val = -1.0\n",
" cur_val = 0.0\n",
" max_s = 1.0\n",
" max_phi = 1.0\n",
" search_grid = range(epsilon, 1.0, length = 15)\n",
"\n",
" # objective function\n",
" function w_x(x, s, phi)\n",
" h(u) = Vf(max(G(x, phi), u))\n",
" integral = dot(h.(u), w)\n",
" q = pi_func(s) * integral + (1.0 - pi_func(s)) * Vf(G(x, phi))\n",
" return -x * (1.0 - phi - s) - beta * q\n",
" end\n",
"\n",
" for (i, x) in enumerate(jv.x_grid)\n",
" for s in search_grid\n",
" for phi in search_grid\n",
" cur_val = ifelse(s + phi <= 1.0, -w_x(x, s, phi), -1.0)\n",
" if cur_val > max_val\n",
" max_val, max_s, max_phi = cur_val, s, phi\n",
" end\n",
" end\n",
" end\n",
"\n",
" s_policy[i], phi_policy[i] = max_s, max_phi\n",
" end\n",
"end\n",
"\n",
"function T(jv, V; ret_policies = false)\n",
" out = ifelse(ret_policies, (similar(V), similar(V)), similar(V))\n",
" T!(jv, V, out)\n",
" return out\n",
"end"
]
},
{
"cell_type": "markdown",
"id": "d61bbd5f",
"metadata": {},
"source": [
"The code is written to be relatively generic—and hence reusable.\n",
"\n",
"- For example, we use generic $ G(x,\\phi) $ instead of specific $ A (x \\phi)^{\\alpha} $. \n",
"\n",
"\n",
"Regarding the imports\n",
"\n",
"- `fixed_quad` is a simple non-adaptive integration routine \n",
"- `fmin_slsqp` is a minimization routine that permits inequality constraints \n",
"\n",
"\n",
"Next we write a constructor called `jv_worker` that\n",
"\n",
"- packages all the parameters and other basic attributes of a given model \n",
"- implements the method `T` for value function iteration \n",
"\n",
"\n",
"The `T` method\n",
"takes a candidate value function $ V $ and updates it to $ TV $ via\n",
"\n",
"$$\n",
"TV(x)\n",
"= - \\min_{s + \\phi \\leq 1} w(s, \\phi)\n",
"$$\n",
"\n",
"where\n",
"\n",
"\n",
"<a id='equation-defw'></a>\n",
"$$\n",
"w(s, \\phi)\n",
" := - \\left\\{\n",
" x (1 - s - \\phi) + \\beta (1 - \\pi(s)) V[G(x, \\phi)] +\n",
" \\beta \\pi(s) \\int V[G(x, \\phi) \\vee u] F(du)\n",
"\\right\\} \\tag{33.3}\n",
"$$\n",
"\n",
"Here we are minimizing instead of maximizing to fit with optimization routines.\n",
"\n",
"When we represent $ V $, it will be with a Julia array `V` giving values on grid `x_grid`.\n",
"\n",
"But to evaluate the right-hand side of [(33.3)](#equation-defw), we need a function, so\n",
"we replace the arrays `V` and `x_grid` with a function `Vf` that gives linear\n",
"interpolation of `V` on `x_grid`.\n",
"\n",
"Hence in the preliminaries of `T`\n",
"\n",
"- from the array `V` we define a linear interpolation `Vf` of its values \n",
" - `c1` is used to implement the constraint $ s + \\phi \\leq 1 $ \n",
" - `c2` is used to implement $ s \\geq \\epsilon $, a numerically stable \n",
" alternative to the true constraint $ s \\geq 0 $ \n",
" - `c3` does the same for $ \\phi $ \n",
"\n",
"\n",
"Inside the `for` loop, for each `x` in the grid over the state space, we\n",
"set up the function $ w(z) = w(s, \\phi) $ defined in [(33.3)](#equation-defw).\n",
"\n",
"The function is minimized over all feasible $ (s, \\phi) $ pairs, either by brute-force search over a grid, or specialized solver routines.\n",
"\n",
"The latter is much faster, but convergence to the global optimum is not\n",
"guaranteed. Grid search is a simple way to check results.\n",
"\n",
"\n",
"<a id='jv-solve'></a>"
]
},
{
"cell_type": "markdown",
"id": "330daba2",
"metadata": {},
"source": [
"## Solving for Policies\n",
"\n",
"\n",
"<a id='index-6'></a>\n",
"Let’s plot the optimal policies and see what they look like.\n",
"\n",
"The code is as follows"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ad977d7a",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"wp = jv_worker(; grid_size = 25)\n",
"v_init = collect(wp.x_grid) .* 0.5\n",
"\n",
"f(x) = T(wp, x)\n",
"V = fixedpoint(f, v_init)\n",
"sol_V = V.zero\n",
"\n",
"s_policy, phi_policy = T(wp, sol_V, ret_policies = true)\n",
"\n",
"# plot solution\n",
"p = plot(wp.x_grid, [phi_policy s_policy sol_V],\n",
" title = [L\"$\\phi$ policy\" L\"$s$ policy\" \"value function\"],\n",
" color = [:orange :blue :green],\n",
" xaxis = (L\"x\", (0.0, maximum(wp.x_grid))),\n",
" yaxis = ((-0.1, 1.1)), size = (800, 800),\n",
" legend = false, layout = (3, 1),\n",
" bottom_margin = Plots.PlotMeasures.Length(:mm, 20))"
]
},
{
"cell_type": "markdown",
"id": "ad3b12dd",
"metadata": {},
"source": [
"The horizontal axis is the state $ x $, while the vertical axis gives $ s(x) $ and $ \\phi(x) $.\n",
"\n",
"Overall, the policies match well with our predictions from [section](#jvboecalc).\n",
"\n",
"- Worker switches from one investment strategy to the other depending on relative return. \n",
"- For low values of $ x $, the best option is to search for a new job. \n",
"- Once $ x $ is larger, worker does better by investing in human capital specific to the current position. "
]
},
{
"cell_type": "markdown",
"id": "3a7f1d20",
"metadata": {},
"source": [
"## Exercises\n",
"\n",
"\n",
"<a id='jv-ex1'></a>"
]
},
{
"cell_type": "markdown",
"id": "0c3bb99a",
"metadata": {},
"source": [
"### Exercise 1\n",
"\n",
"Let’s look at the dynamics for the state process $ \\{x_t\\} $ associated with these policies.\n",
"\n",
"The dynamics are given by [(33.1)](#equation-jd) when $ \\phi_t $ and $ s_t $ are\n",
"chosen according to the optimal policies, and $ \\mathbb{P}\\{b_{t+1} = 1\\}\n",
"= \\pi(s_t) $.\n",
"\n",
"Since the dynamics are random, analysis is a bit subtle.\n",
"\n",
"One way to do it is to plot, for each $ x $ in a relatively fine grid\n",
"called `plot_grid`, a\n",
"large number $ K $ of realizations of $ x_{t+1} $ given $ x_t =\n",
"x $. Plot this with one dot for each realization, in the form of a 45 degree\n",
"diagram. Set"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a538be08",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"K = 50\n",
"plot_grid_max, plot_grid_size = 1.2, 100\n",
"plot_grid = range(0, plot_grid_max, length = plot_grid_size)\n",
"plot(plot_grid, plot_grid, color = :black, linestyle = :dash,\n",
" lims = (0, plot_grid_max), legend = :none)"
]
},
{
"cell_type": "markdown",
"id": "54b941f9",
"metadata": {},
"source": [
"By examining the plot, argue that under the optimal policies, the state\n",
"$ x_t $ will converge to a constant value $ \\bar x $ close to unity.\n",
"\n",
"Argue that at the steady state, $ s_t \\approx 0 $ and $ \\phi_t \\approx 0.6 $.\n",
"\n",
"\n",
"<a id='jv-ex2'></a>"
]
},
{
"cell_type": "markdown",
"id": "090e6e53",
"metadata": {},
"source": [
"### Exercise 2\n",
"\n",
"In the preceding exercise we found that $ s_t $ converges to zero\n",
"and $ \\phi_t $ converges to about 0.6.\n",
"\n",
"Since these results were calculated at a value of $ \\beta $ close to\n",
"one, let’s compare them to the best choice for an *infinitely* patient worker.\n",
"\n",
"Intuitively, an infinitely patient worker would like to maximize steady state\n",
"wages, which are a function of steady state capital.\n",
"\n",
"You can take it as given—it’s certainly true—that the infinitely patient worker does not\n",
"search in the long run (i.e., $ s_t = 0 $ for large $ t $).\n",
"\n",
"Thus, given $ \\phi $, steady state capital is the positive fixed point\n",
"$ x^*(\\phi) $ of the map $ x \\mapsto G(x, \\phi) $.\n",
"\n",
"Steady state wages can be written as $ w^*(\\phi) = x^*(\\phi) (1 - \\phi) $.\n",
"\n",
"Graph $ w^*(\\phi) $ with respect to $ \\phi $, and examine the best\n",
"choice of $ \\phi $.\n",
"\n",
"Can you give a rough interpretation for the value that you see?"
]
},
{
"cell_type": "markdown",
"id": "f39c7a85",
"metadata": {},
"source": [
"## Solutions"
]
},
{
"cell_type": "markdown",
"id": "d31a10f3",
"metadata": {},
"source": [
"### Exercise 1\n",
"\n",
"Here’s code to produce the 45 degree diagram"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1edeaa8e",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"wp = jv_worker(grid_size = 25)\n",
"# simplify notation\n",
"(; G, pi_func, F) = wp\n",
"\n",
"v_init = collect(wp.x_grid) * 0.5\n",
"f2(x) = T(wp, x)\n",
"V2 = fixedpoint(f2, v_init)\n",
"sol_V2 = V2.zero\n",
"s_policy, phi_policy = T(wp, sol_V2, ret_policies = true)\n",
"\n",
"# Turn the policy function arrays into CoordInterpGrid objects for interpolation\n",
"s = LinearInterpolation(wp.x_grid, s_policy, extrapolation_bc = Line())\n",
"phi = LinearInterpolation(wp.x_grid, phi_policy, extrapolation_bc = Line())\n",
"\n",
"h_func(x, b, U) = (1 - b) * G(x, phi(x)) + b * max(G(x, phi(x)), U)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3b46ccac",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"using Random\n",
"Random.seed!(42)\n",
"K = 50\n",
"\n",
"plot_grid_max, plot_grid_size = 1.2, 100\n",
"plot_grid = range(0, plot_grid_max, length = plot_grid_size)\n",
"ticks = [0.25, 0.5, 0.75, 1.0]\n",
"\n",
"xs = []\n",
"ys = []\n",
"for x in plot_grid\n",
" for i in 1:K\n",
" b = rand() < pi_func(s(x)) ? 1 : 0\n",
" U = rand(wp.F)\n",
" y = h_func(x, b, U)\n",
" push!(xs, x)\n",
" push!(ys, y)\n",
" end\n",
"end\n",
"\n",
"plot(plot_grid, plot_grid, color = :black, linestyle = :dash, legend = :none)\n",
"scatter!(xs, ys, alpha = 0.25, color = :green, lims = (0, plot_grid_max),\n",
" ticks = ticks)\n",
"plot!(xlabel = L\"x_t\", ylabel = L\"x_{t+1}\", guidefont = font(16))"
]
},
{
"cell_type": "markdown",
"id": "f545f62c",
"metadata": {},
"source": [
"Looking at the dynamics, we can see that\n",
"\n",
"- If $ x_t $ is below about 0.2 the dynamics are random, but\n",
" $ x_{t+1} > x_t $ is very likely \n",
"- As $ x_t $ increases the dynamics become deterministic, and\n",
" $ x_t $ converges to a steady state value close to 1 \n",
"\n",
"\n",
"Referring back to the figure here.\n",
"\n",
"[ref]`section <jv_solve>`\n",
"\n",
"we see that $ x_t \\approx 1 $ means that\n",
"$ s_t = s(x_t) \\approx 0 $ and\n",
"$ \\phi_t = \\phi(x_t) \\approx 0.6 $."
]
},
{
"cell_type": "markdown",
"id": "bbe1724e",
"metadata": {},
"source": [
"### Exercise 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "faeb57a2",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"wp = jv_worker(grid_size = 25)\n",
"\n",
"xbar(phi) = (wp.A * phi^wp.alpha)^(1.0 / (1.0 - wp.alpha))\n",
"\n",
"phi_grid = range(0, 1, length = 100)\n",
"\n",
"plot(phi_grid, [xbar(phi) * (1 - phi) for phi in phi_grid], color = :blue,\n",
" label = L\"w^\\phi\", legendfont = font(12), xlabel = L\"\\phi\",\n",
" guidefont = font(16), grid = false, legend = :topleft)"
]
},
{
"cell_type": "markdown",
"id": "9ca28a22",
"metadata": {},
"source": [
"Observe that the maximizer is around 0.6.\n",
"\n",
"This this is similar to the long run value for $ \\phi $ obtained in\n",
"exercise 1.\n",
"\n",
"Hence the behaviour of the infinitely patent worker is similar to that\n",
"of the worker with $ \\beta = 0.96 $.\n",
"\n",
"This seems reasonable, and helps us confirm that our dynamic programming\n",
"solutions are probably correct."
]
}
],
"metadata": {
"date": 1763972240.2735198,
"filename": "jv.md",
"kernelspec": {
"display_name": "Julia",
"language": "julia",
"name": "julia-1.11"
},
"title": "Job Search V: On-the-Job Search"
},
"nbformat": 4,
"nbformat_minor": 5
}