forked from eirikbrandsaas/ContTimeHetAgentExample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcont_time_solve.jl
More file actions
27 lines (21 loc) · 1.07 KB
/
cont_time_solve.jl
File metadata and controls
27 lines (21 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Code to solve the benchmark Aiyagari-Bewley-Hugget model
# Written by Garrett Anstreicher, for ECON899 @ UW - Madison
using Parameters, LinearAlgebra, SparseArrays, Plots
cd(@__DIR__) # Navigate to the folder this file is located in
include("cont_time_model.jl")
res=Solve_model(delta=1000.0, imp=1, r = 0.01) #solve the model. flip imp=0 if you're a masochist
prim = Primitives() #initialize primtives
#graphing
#value functions
Plots.plot(prim.a_grid, res.val_func, legend=:bottomright, label=["Low Income" "High Income"],
xlabel="Assets", lw=2)
Plots.savefig("tabfig/cont_time_val_functions.png")
#stationary distribution
Plots.plot(prim.a_grid, res.stat_dist, ylims=(0, 2), label=["Low Income" "High Income"],
xlabel="Assets", ylabel="Conditional Distribution", lw=2)
Plots.savefig("tabfig/cont_time_stat_dist.png")
#asset drift
Plots.plot(prim.a_grid, [res.adot, zeros(prim.Na)], label=["Low Income" "High Income" "Zero Line"], xlabel="Assets",
ylabel="Change in Assets", lw=2, ls = [:solid :solid :dash])
Plots.savefig("tabfig/cont_time_a_dot.png")
#####