{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Solving Growth Models" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Contents:\n", "\n", "- [Solving Growth Models](#Solving-Growth-Models) \n", " - [A Basic Growth Model](#A-Basic-Growth-Model) \n", " - [Transition Equations](#Transition-Equations)\n", " - [Steady State](#Steady-State) \n", " - [Solving the Model](#Solving-the-Model) \n", " - [Generating Optimal Paths](#Generating-Optimal-Paths)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This lab includes:\n", "\n", "(1) An overview of a basic non-stochastic growth model;\n", "\n", "(2) Finding the transition equations of a growth model using dynamic programming;\n", "\n", "(3) Solving for the policy functions of a growth model using value function iteration;\n", "\n", "(4) Generating the optimal paths of variables using policy functions." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A Basic Growth Model" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider the following economy.\n", "\n", "There is a representative agent who has preferences given by \n", "\n", "\\begin{align*}\n", " \\sum_{t=0}^\\infty \\beta^t u(c_t) \\, ,\n", "\\end{align*}\n", "\n", "where $u(c_t) = \\log(c_t)$ and $\\beta \\in (0,1)$ is the discount factor." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The technology in this economy is given by \n", "\n", "\\begin{align*}\n", " c_t + i_t &= y_t \\, , \\\\\n", " y_t &= A k_{t}^\\alpha \\, , \\\\\n", " k_{t+1} &= i_t + (1-\\delta) k_t \\, ,\n", "\\end{align*}\n", "\n", "where $c_t$ is consumption, $i_t$ is investment, $y_t$ is output, $k_t$ is capital, $\\alpha \\in (0,1)$, $A \\in \\mathbb{R}_+$ is the productivity factor, and $\\delta \\in (0,1)$ is the depreciation rate." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The social planner's problem may be expressed by the following Bellman equation:\n", "\n", "\\begin{align*}\n", " V(k) = \\max_{c,i,k'} \\left\\{ \\log(c) + \\beta V(k') \\right\\}\n", "\\end{align*}\n", "\n", "subject to \n", "\n", "\\begin{align}\n", " c + i &= A k^\\alpha \\, , \\label{eq:flow_constraint} \\\\\n", " k' &= (1-\\delta) k + i \\, . \\label{eq:capital_accumulation} \n", "\\end{align}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Transition Equations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can simplify this system by using the first constraint to solve for $i$:\n", "\n", "\\begin{align*}\n", " i = A k^\\alpha - c \\, ,\n", "\\end{align*}\n", "\n", "which can be substituted into the second constraint to yield \n", "\n", "\\begin{align*}\n", " k' = (1-\\delta) k + A k^\\alpha - c \\, .\n", "\\end{align*}\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The above equation for $k'$ can be substituted into the Bellman equation to yield \n", "\n", "\\begin{align*}\n", " V(k) = \\max_{c} \\left\\{ \\log(c) + \\beta V\\left[ (1-\\delta)k + Ak^\\alpha - c \\right] \\right\\} \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using the Bellman equation we may derive the following first-order condition for $c$:\n", "\n", "\\begin{align*}\n", " 0 = \\frac{1}{c} + \\beta V'(k')(-1) \\, ,\n", "\\end{align*}\n", "\n", "which is equivalent to \n", "\n", "\\begin{align}\n", "\\label{eq:foc}\n", " \\beta V'(k') = \\frac{1}{c} \\, .\n", "\\end{align}" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-05-01T21:50:52.391000-07:00", "start_time": "2021-05-02T04:50:50.811Z" } }, "source": [ "We may also use the Bellman eqation to obtain the following envelope condition:\n", "\n", "\\begin{align*}\n", "V'(k) = \\beta V'(k') (1 - \\delta + \\alpha A k^{\\alpha - 1} ) \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Eq. \\eqref{eq:foc} can then be substituted into the RHS of the envelope condition to yield \n", "\n", "\\begin{align*}\n", " V'(k) = \\frac{1}{c} \\left( 1 - \\delta + \\alpha A k^{\\alpha-1} \\right) \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This equation can now be \"stepped-up\" by a period ($k'$ and $c'$ instead of $k$ and $c$) to give us\n", "\n", "\\begin{align*}\n", " V'(k') = \\frac{1}{c'} \\left( 1 - \\delta + \\alpha A k'^{\\alpha-1} \\right) \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We once again substitute Eq. \\eqref{eq:foc} into the LHS of the above equation to obtain \n", "\n", "\\begin{align*}\n", " \\frac{1}{\\beta c} = \\frac{1}{c'} \\left( 1 - \\delta + \\alpha A k'^{\\alpha-1} \\right) \\, ,\n", "\\end{align*}\n", "\n", "which can be used to solve for $c'$:\n", "\n", "\\begin{align*}\n", " c' = c \\beta \\left( 1 - \\delta + \\alpha A k'^{\\alpha - 1} \\right) \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now attach time indices to the above equation to obtain the Euler equation:\n", "\n", "\\begin{align}\n", "\\label{eq:euler}\n", " c_{t+1} = c_t \\beta \\left(1 - \\delta + \\alpha A k_{t+1}^{\\alpha-1} \\right) \\, .\n", "\\end{align}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Therefore, the economy is governed by the system of transition equations made up by Eqs. \\eqref{eq:flow_constraint}, \\eqref{eq:capital_accumulation}, and \\eqref{eq:euler}." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "I repeat all equations below for easy reference.\n", "\n", "**Capital accumulation:** \n", "\n", "\\begin{align*}\n", "k_{t+1} = (1-\\delta) k_t + Ak_t^{\\alpha} - c_t\n", "\\end{align*}\n", "\n", "**Euler equation:** \n", "\n", "\\begin{align*}\n", "c_{t+1} = c_t \\beta \\left( 1 - \\delta + \\alpha A k_{t+1}^{\\alpha-1} \\right)\n", "\\end{align*}\n", "\n", "**Output:**\n", "\n", "\\begin{align*}\n", "y_t = A k_t^\\alpha \n", "\\end{align*}\n", "\n", "\n", "**Flow budget constraint / Investment:** \n", "\n", "\\begin{align*}\n", "i_t = A k_t^{\\alpha} - c_t\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Steady State" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the steady state (SS), we have $c_{t+1} = c_t = \\overline{c}$ and $k_{t+1} = k_t = \\overline{k}$, which also implies SS output \n", "\n", "\\begin{align*}\n", "\\overline{y} = A \\overline{k}^\\alpha\n", "\\end{align*}\n", "\n", "and SS investment \n", "\n", "\\begin{align*}\n", "\\overline{i} = \\overline{y} - \\overline{c} \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We now need to solve for $\\overline{c}$ and $\\overline{k}$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Applying a bit of algebra to the Euler and capital accumulation equations yields \n", "\n", "\\begin{align*}\n", " \\overline{k} = \\left( \\frac{\\alpha A}{\\beta^{-1} - 1 + \\delta} \\right)^\\frac{1}{1-\\alpha} \\, ,\n", "\\end{align*}\n", "\n", "along with \n", "\n", "\\begin{align*}\n", " \\overline{c} = A \\overline{k}^\\alpha - \\delta \\overline{k} \\, .\n", "\\end{align*}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's write a function named `steadyState` that will output all model parameters and steady state values:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:12.734000-07:00", "start_time": "2021-05-03T10:01:11.948Z" } }, "outputs": [ { "data": { "text/plain": [ "steadyState" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"\"\"\n", " steadyState(α, β, δ, A)\n", "\n", "Solves for the steady state of the growth model.\n", "\n", "# Arguments\n", "* `α` -- production function parameter\n", "* `β` -- discount factor \n", "* `δ` -- depreciation rate \n", "* `A` -- productivity factor\n", "\n", "\"\"\"\n", "function steadyState(α = 0.3, β = 0.98, δ = 0.02, A = 1)\n", " \n", " # Solve for k̄\n", " k̄ = ( (α * A) / (β^(-1) - 1 + δ) )^(1/(1-α))\n", " \n", " # Solve for ȳ\n", " ȳ = A * k̄^α\n", " \n", " # Solve for c̄\n", " c̄ = ȳ - δ * k̄\n", " \n", " # Solve for ī\n", " ī = ȳ - c̄\n", " \n", " # Return model parameters and steady state variables\n", " return (α = α, β = β, δ = δ, A = A, c̄ = c̄, k̄ = k̄, ȳ = ȳ, ī = ī)\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We run the function and store all outputs:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:14.687000-07:00", "start_time": "2021-05-03T10:01:14.533Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "c̄ = 2.0106154404398704\n", "k̄ = 17.53027697180669\n", "ȳ = 2.361220979876004\n", "ī = 0.3506055394361338\n" ] } ], "source": [ "# Generate and save steady state objects\n", "α, β, δ, A, c̄, k̄, ȳ, ī = steadyState()\n", "\n", "# Print steady state values\n", "@show c̄\n", "@show k̄\n", "@show ȳ\n", "@show ī;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Solving the Model" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's load the packages we might need." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:31.808000-07:00", "start_time": "2021-05-03T10:01:17.064Z" } }, "outputs": [], "source": [ "# Load all packages we might need\n", "using LinearAlgebra, Plots, LaTeXStrings" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Our goal now is to computationally solve for the policy function using value function iteration.\n", "\n", "We start by constructing a function named `growthBellmanMap` that applies a single iteration of the Bellman map." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:34.393000-07:00", "start_time": "2021-05-03T10:01:18.524Z" } }, "outputs": [ { "data": { "text/plain": [ "growthBellmanMap" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"\"\"\n", " growthBellmanMap(V, kgrid, α, β, δ, A)\n", "\n", "Applies a single iteration of the Bellman map to the model.\n", "Returns a new iteration of the value and policy functions.\n", "\n", "# Arguments\n", "* `V` -- An initial value function\n", "* `kgrid` -- A grid of k values over some interval\n", "* `α` -- production function parameter\n", "* `β` -- discount factor \n", "* `δ` -- depreciation rate \n", "* `A` -- productivity factor\n", "\n", "\"\"\"\n", "function growthBellmanMap(V, kgrid, α, β, δ, A)\n", " \n", " N = length(kgrid) #k grid length\n", " V_out = zeros(N) #new value function\n", " n_pol = zeros(Int,N) #policy rule for grid points\n", " k_pol = zeros(N) #policy rule for capital\n", " c_pol = zeros(N) #consumption rule\n", " obj = zeros(N) #objective to be maximized wrt k′\n", " \n", " for n in 1:N #iterate for each initial capital\n", " \n", " for nprime in 1:N #iterate for choice of capital this period\n", " \n", " # Compute optimal consumption level\n", " c = (1-δ) * kgrid[n] + A * kgrid[n]^(α) - kgrid[nprime]\n", " \n", " if c <= 0\n", " obj[nprime] = -Inf #penalty if consumption <0\n", " else\n", " obj[nprime] = log(c) + β * V[nprime] #otherwise RHS of bellman equation\n", " end\n", " end\n", " \n", " V_out[n], n_pol[n] = findmax(obj) #find optimal value and the choice that gives it\n", " k_pol[n] = kgrid[n_pol[n]] #record capital policy\n", " c_pol[n] =(1-δ) * kgrid[n] + A * kgrid[n]^(α) - k_pol[n] #record consumption policy\n", " \n", " end\n", " \n", " return V_out, n_pol, k_pol, c_pol\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we create a function named `solveGrowthBellman` that iteratively applies `growthBellmanMap` until reaching convergence.\n", "\n", "The output of the function will contain a vector representing the value function, the policy functions for $k$ and $c$, as well as an index representing the policy map from $k_t$ to $k_{t+1}$ on a given grid for $k$." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:34.400000-07:00", "start_time": "2021-05-03T10:01:19.842Z" } }, "outputs": [ { "data": { "text/plain": [ "solveGrowthBellman" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"\"\"\n", " solveGrowthBellman(V0, kgrid, α, β, δ, A, ϵ)\n", "\n", "Applies the Bellman map until convergence.\n", "Returns final iterations of the value and policy functions.\n", "\n", "# Arguments\n", "* `V` -- initial value function\n", "* `kgrid` -- grid of k values over some interval\n", "* `α` -- production function parameter\n", "* `β` -- discount factor \n", "* `δ` -- depreciation rate \n", "* `A` -- productivity factor\n", "* `ϵ` -- convergence condition\n", "\n", "\"\"\"\n", "function solveGrowthBellman(V0, kgrid, α, β, δ, A, ϵ=1e-6)\n", " \n", " # Initialize the convergence metric\n", " diff = 0.1\n", " \n", " # Apply the first iteration of the Bellman map\n", " V, n_pol, k_pol, c_pol = growthBellmanMap(V0, kgrid, α, β, δ, A)\n", " \n", " # Apply the Bellman map until convergence\n", " while diff > ϵ\n", " \n", " V_new, n_pol, k_pol, c_pol = growthBellmanMap(V, kgrid, α, β, δ, A)\n", " \n", " diff = norm(V_new-V,Inf) #update convergence metric\n", " \n", " V = V_new #update value function\n", " end\n", " \n", " # Return final value function, policy function map indexes, \n", " # and policy functions for k and c\n", " return V, n_pol, k_pol, c_pol\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We now have everything we need to solve the model using value function iteration:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:38.490000-07:00", "start_time": "2021-05-03T10:01:21.053Z" } }, "outputs": [], "source": [ "# Create a grid for k\n", "N = 501\n", "kgrid = LinRange(k̄-10,k̄+10,N) #center grid on k̄\n", "\n", "# Generate value function iteration solutions\n", "V, n_pol, k_pol, c_pol = solveGrowthBellman(zeros(N), kgrid, α, β, δ, A);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can plot the policy function for $k$:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:52.210000-07:00", "start_time": "2021-05-03T10:01:22.218Z" }, "scrolled": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plot(kgrid, kgrid, label = \"45° line\", color = \"black\")\n", "plot!(kgrid, fill(k̄, length(kgrid)), label = \"k̄\", color = \"gray\", lw = 2, linestyle = :dash)\n", "vline!([k̄], label = \"\", color = \"gray\",lw = 2, linestyle = :dash)\n", "plot!(kgrid, k_pol, label = \"Optimal k'\", color = \"orange\", lw = 3)\n", "title!(\"\\$ \\\\textrm{Policy Function for } k_{t+1} \\$\")\n", "xlabel!(\"\\$k_{t}\\$\")\n", "ylabel!(\"\\$k_{t+1}\\$\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We may also plot the policy function for $c$:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:52.286000-07:00", "start_time": "2021-05-03T10:01:25.140Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plot(title = \"\\$ \\\\textrm{Policy Function for } c_t \\$\")\n", "plot!(kgrid, fill(c̄, length(kgrid)), label = \"c̄\", color = \"green\", lw = 2, linestyle = :dash)\n", "vline!([k̄], label = \"k̄\", color = \"gray\", lw = 2, linestyle = :dash)\n", "plot!(kgrid, c_pol, label = \"Optimal c\", color = \"green\", lw = 3)\n", "xlabel!(\"\\$k_t\\$\")\n", "ylabel!(\"\\$c_t\\$\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Generating Optimal Paths" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's create a function that generates the path of the economy over $T$ time periods given the relevant policy functions and $k_0$ ." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:01:52.300000-07:00", "start_time": "2021-05-03T10:01:27.506Z" } }, "outputs": [ { "data": { "text/plain": [ "growthBellmanPath" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"\"\"\n", " growthBellmanPath(kgrid, n_pol, k_pol, c_pol, grid_initial, T)\n", "\n", "Applies the Bellman map until convergence.\n", "Returns final iterations of the value and policy functions.\n", "\n", "# Arguments\n", "* `kgrid` -- grid of k values over some interval\n", "* `n_pol` -- capital policy grid index map\n", "* `k_pol` -- capital policy function\n", "* `c_pol` -- consumption policy function\n", "* `grid_initial` -- initial index of k\n", "* `T` -- length of time interval\n", "\n", "\"\"\"\n", "function growthBellmanPath(kgrid, n_pol, k_pol, c_pol, grid_initial::Int64, T::Int64)\n", "\n", " index = fill(0,T+1) # capital grid index path\n", " c = zeros(T) # empty vector to store consumption path\n", " k = zeros(T+1) # empty vector to store capital path\n", " \n", " index[1] = grid_initial # store t=0 capital index\n", " \n", " k[1] = kgrid[index[1]] # store capital at t=0\n", " \n", " for t in 1:T\n", " c[t] = c_pol[index[t]] # store consumption at t\n", " k[t+1] = k_pol[index[t]] # store capital t+1\n", " index[t+1] = n_pol[index[t]] # store t+1 capital index\n", " end \n", " \n", " k = k[1:T] # cut the last entry of k path \n", " grid_pts = index[1:T] # cut the last entry of capital index path\n", " \n", " # Return capital, consumption, and capital index paths\n", " return k, c, grid_pts\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we plot the paths of $k$ and $c$ given the lowest possible $k_0$ from our grid." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:03:27.771000-07:00", "start_time": "2021-05-03T10:03:27.711Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T = 100\n", "k_path, c_path, grid_path = growthBellmanPath(kgrid, n_pol, k_pol, c_pol, 1, T)\n", "time = 1:T\n", "plot(time, c_path./c̄, label = \"Consumption\", lw=3)\n", "plot!(time, k_path./k̄, label = \"Capital\", lw =3, title = \"\\$ \\\\textrm{Optimal Path Given Low } k_0 \\$\")\n", "plot!(time, (A.*k_path.^α)./ȳ, label = \"Output\", lw=3)\n", "plot!(time, (A.*k_path.^α - c_path)/ī, label = \"Investment\", lw=3)\n", "xlabel!(\"Time\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice that a low initial capital implies a low initial consumption level.\n", "\n", "Over time, both variable seem to grow uniformly and ultimately convergence to their respective steady states." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we plot the paths of $k$ and $c$ once again, but this time given the highest possible value for $k_0$ from our grid." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2021-05-03T03:02:57.703000-07:00", "start_time": "2021-05-03T10:02:57.621Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T = 100\n", "k_path, c_path, grid_path = growthBellmanPath(kgrid, n_pol, k_pol, c_pol, length(kgrid), T)\n", "time = 1:T\n", "plot(time, c_path./c̄, label = \"Consumption\", lw = 3)\n", "plot!(time, k_path./k̄, label = \"Capital\", lw = 3, title = \"\\$ \\\\textrm{Optimal Path Given High } k_0 \\$\")\n", "plot!(time, (A.*k_path.^α)./ȳ, label = \"Output\", lw=3)\n", "plot!(time, (A.*k_path.^α - c_path)/ī, label = \"Investment\", lw=3)\n", "xlabel!(\"Time\")" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-05-02T14:57:33.720000-07:00", "start_time": "2021-05-02T21:57:33.708Z" } }, "source": [ "Notice that a high initial capital implies a high initial consumption level.\n", "\n", "Over time, both variable seem to experience uniform negative growth until they convergence to their respective steady states." ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.5.4", "language": "julia", "name": "julia-1.5" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.5.4" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autoclose": false, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false } }, "nbformat": 4, "nbformat_minor": 4 }