Undergraduate Computational Macro
In this economy, output is produced by combining labor and capital
Labor
Capital,
In addition, total factor productivity (TFP),
The physical output from operating the technology is:
Note that land, etc. are NOT a factor of production
We will assume
Assume
Define output per worker as
Take
Consider production function of
In this case,
g_N = 0.02
delta = 0.05
s = 0.2
z = 1.0
alpha = 0.5
k_ss = (s * z / (g_N + delta))^(1/(1-alpha))
k_values = 0.1:0.01:10.0
lhs = (g_N + delta) * k_values
rhs = s * z .* k_values.^alpha
plot(k_values, lhs, label=L"Growth-adjusted depreciation: $(\delta + g_N)k$",
xlabel=L"Capital per capita ($k$)")
plot!(k_values, rhs, label=L"Investment per capita: $s \bar{z} f(k)$")
vline!([k_ss], label=L"Steady State Capital: $\bar{k}$", linestyle=:dash)
Exogenous
Population growth
Wages
Steady state capital
function plot45(f, xmin, xmax, x0, T; num_points = 100, label = L"h(k)",
xlabel = "k", size = (600, 500))
# Plot the function and the 45 degree line
x_grid = range(xmin, xmax, num_points)
plt = plot(x_grid, f.(x_grid); xlim = (xmin, xmax), ylim = (xmin, xmax),
linecolor = :black, lw = 2, label, size)
plot!(x_grid, x_grid; linecolor = :blue, lw = 2, label = nothing)
# Iterate map and add ticks
x = iterate_map(f, x0, T)
if !isnothing(xlabel) && T > 1
xticks!(x, [L"%$(xlabel)_{%$i}" for i in 0:T])
yticks!(x, [L"%$(xlabel)_{%$i}" for i in 0:T])
end
# Plot arrows and dashes
for i in 1:T
plot!([x[i], x[i]], [x[i], x[i + 1]], arrow = :closed, linecolor = :black,
alpha = 0.5, label = nothing)
plot!([x[i], x[i + 1]], [x[i + 1], x[i + 1]], arrow = :closed,
linecolor = :black, alpha = 0.5, label = nothing)
plot!([x[i + 1], x[i + 1]], [0, x[i + 1]], linestyle = :dash,
linecolor = :black, alpha = 0.5, label = nothing)
end
plot!([x[1], x[1]], [0, x[1]], linestyle = :dash, linecolor = :black,
alpha = 0.5, label = nothing)
end
plot45 (generic function with 1 method)
k_bar(p) = 1.7846741842265788
h(k_bar(p); p) = 1.7846741842265788
h(0.0; p) = 0.0
h_k(k; p) = (1 / (1 + p.g_N)) * (
p.alpha * p.s * p.z_bar * k^(p.alpha-1)
+ 1 - p.delta)
k_vals = range(0.0, 10.0; length=100)
plot(k_vals, h_k.(k_vals; p);
label = L"\nabla h(k)",
xlabel = "k",
title=L"Gradient of $h(k)$",
size=(600, 500), ylim=(0.0, 2.0))
vline!([k_bar(p)];label=L"h(\bar{k})=\bar{k}",
linestyle=:dash)
vline!([0.0];label=L"h(0)=0", linestyle=:dash)
hline!([1.0];linestyle=:dot, label=nothing,
alpha=0.5, lw=1)
function h_multi(k;s=0.95, delta=0.99)
return s*(-k^3/3 + k^2 + k/3) + (1 - delta)*k
end
k_min = 0.0
k_max = 2.2
k_vals = range(k_min, k_max; length=100)
plot(k_vals, h_multi.(k_vals);
label = L"h(k)",
xlabel = "k",
title="Multiple Crossings",
size=(600, 500))
plot!(k_vals, k_vals; label=nothing,
style=:dash)
h_multi_vec(k_vec) = [h_multi(k_vec[1])] # pack/unpack as vector
k_star_1 = fixedpoint(h_multi_vec, [0.0]).zero[1]
k_star_2 = fixedpoint(h_multi_vec, [1.0]).zero[1]
k_star_3 = fixedpoint(h_multi_vec, [2.0]).zero[1]
@show k_star_1, k_star_2, k_star_3;
(k_star_1, k_star_2, k_star_3) = (0.0, 1.1483123394919963, 1.8516876604860064)
h_multi_k(k;s=0.95, delta=0.99) = s*(-k^2 + 2 * k + 1/3) + (1 - delta)
@show k_star_1, h_multi_k(k_star_1)
@show k_star_2, h_multi_k(k_star_2)
@show k_star_3, h_multi_k(k_star_3);
(k_star_1, h_multi_k(k_star_1)) = (0.0, 0.32666666666666666)
(k_star_2, h_multi_k(k_star_2)) = (1.1483123394919963, 1.2557699441233567)
(k_star_3, h_multi_k(k_star_3)) = (1.8516876604860064, 0.5875633891937458)
Consumption per capital is
Subsistence consumption per capita is
Population growth rate for some
Note:
Production is
Then following CRS logic, we see that consumption per capital is
N_0 = N_bar(p) # old steady state
p = merge(p, (; z_bar = 2.0)) # changes a field
N_vals = iterate_map(N -> h(N; p), N_0, T)
c_vals = c.(N_vals; p)
plot(0:T, c_vals; label =[L"c_t" nothing],
title="Consumption-per-capita",
seriestype = [:scatter, :line],
xlabel = "t", size=(600, 400))
hline!([p.c_star];linestyle=:dash,
label=L"c^*", alpha=0.5)