Professional Documents
Culture Documents
ECON 809: Problem Set 1
ECON 809: Problem Set 1
1 Question 1
This problem can be represented by a dynamical system (P (S), M )., where P (S) is the
probability distribution over state space S, and M is a Markov operator that maps a
member of P (S), name it ψ, to ψM where:
P
ψM (y) = x∈S p(x, y)ψ(x)
In this assignment, P(S) is the probability distribution over state space of three mem-
bers: UN, EU and ES. ψ is the probability that a person falls in one of three states
described by x ∈ {U N, EU, ES} where UN: unemployed, EU: employed in an unskilled
firm, and ES: employed in a skilled firm. Note that p(x, y) is the stochastic kernel de-
scribing the probability that one changes/keeps their employment status when moving
to next period.
1−α α 0
p(x, y) =
δ 1−β−δ β
(1)
δ 1−δ−β β
1
0.8 0.2 0
p(x, y) =
0.01 0.89 0.1
(2)
0.01 0.89 0.1
Therefore:
0.8 0.2 0 UN
ψM (y) =
0.01 0.89 0.1
P r EU
(3)
0.01 0.89 0.1 ES
1.3.1 Simulate and plot a typical trajectory of 50 periods starting from each
of the three states.
The typical trajectory starting from state 1, state 2, and state 3 is as follow, respectively:
2
Code is as follows:
using QuantEcon
import Plots
3
alpha = 0.2
beta = 0.1
delta = 0.01
P=[1-alpha alpha 0
delta 1-beta-delta beta
delta 1-beta-delta beta]
X=simulate(mc,50,init=1)
xaxis = linspace(0, 50, 50)
Plots.plot(xaxis, X)
Y=simulate(mc,50,init=2)
xaxis = linspace(0, 50, 50)
Plots.plot(xaxis, Y)
Z=simulate(mc,50,init=3)
xaxis = linspace(0, 50, 50)
Plots.plot(xaxis, Z)
1-element Array{Array{Float64,1},1}:
[0.047619, 0.857143, 0.0952381]
They are the probability that a person is unemployed, employed in unskilled firm, and
employed in skilled firm, respectively.
Code is as follows:
stationary distributions(mc)
4
1.3.3 Compute the Dobrushin coefficient
It returns:
for v = 1:3
store = []
p iterate = pˆv
for i = 1:3
for j = 1:3
tri = zero(1)
for z = 1:3
tri = tri + min(p iterate[i,z],p iterate[j,z])
end
push!(store,tri)
end
end
dobrushin[v] = findmin(store)[1]
end
dobrushin
5
Then, we compute Dobrushin coefficient for different value of delta for kernel Q1
It returns the following graph:
Note that the vertical axis corresponds to the Dobrushin coefficient, and the horizontal
axis to the different values of δ
Code is as follows:
alpha = 0.2
beta = 0.1
dobrushin = []
deltas = linspace(0.01,1,100)
for delta in deltas
p = [1-alpha alpha 0;
delta 1-beta-delta beta;
delta 1-beta-delta beta]
store = []
for i = 1:3
for j = 1:3
tri = zero(1)
for z = 1:3
6
tri = tri + min(p[i,z],p[j,z])
end
push!(store,tri)
end
end
a = findmin(store)[1]
push!(dobrushin,a)
end
using Plots
plot(deltas,dobrushin, label = "Dobrushin cofficient")
2 Question 2
Z
w(yt ) = max {u(ct ) + β w(yt+1 )φ(dz))}
2. We solved for the fixed point of value function using the bellman operator. To get
the value function we used fitted value function iteration approach that is based
on linear interpolation. We carried out this step using the Julia function ”compute
fixed point”. Note that the expectation (or likewise, the integral) in the bellman
equation is handled by Monte Carlo.
3. Compute the policy function σ(yt ) = ct from the fixed point of bellman equation.
Apply linear interpolation to the policy function to evaluation the policy function
taking input in real number line.
7
4. From the definition of production function, we establish the following recursive
function
2.1
8
Most of mass points are clustered within (0, 10] interval.
The mean difference between distribution of capital in period 2000 and period 1999
is 0.034 and variance difference is 2.65. As number of simulation goes to infinity, these
two differences in moments should go to 0.
9
We observe that when the depreciate is higher, the mass points are dense to the left
of the distribution. Most of the mass points are in (0, 2] interval. It is intuitive since with
full depreciation rate we expect the capital stock to be lower than the case of non-full
depreciation rate.
2.2
When capital lasts for two periods, we simply set δ = 0 and go over the same procedure
above. We find that the distribution of capital moves to the right of real number line as
time goes by. This is due to the persistence of the capital stock and it accumulates more
as the economy goes into the future. The graphs below illustrate the idea
10
11
The shape of the distribution seems to be the same but the mass points when T =
2000 range from some 80000 to 120000 units of capital, while it ranges from some 20000
to 45000 units of capital where T = 1000. We conclude that the system is not stable and
also dependent on initial value, comparing to the case where δ = 0.2.
2.3
For part (c), we just need to redefine the utility function inside the bellman equation.
Assume full depreciation rate.
When σ = 0.5, the average capital stock is approximately 0.3 and it is 0.92 when σ = 2.
12
The mass points of distribution for capital stock shifts to the right when σ increases from
0.5 to 2. Also, in both cases, the global stability of capital stock distribution is achieved.
13
The reason behind this shift is that consumer is more risk averse though they tend to
invest more in capital in facing uncertainty future.
The code we use for question 2 is as following:
using QuantEcon
using Optim
14
Tw::Vector = similar(w);
compute policy::Bool = false)
w func = LinInterp(grid, w)
if compute policy
= similar(w)
end
if compute policy
sigma[i] = res.minimizer
end
Tw[i] = - res.minimum
end
if compute policy
return Tw, sigma
else
return Tw
end
end
alpha = 1/3
beta = 0.96
mu = 0
s = 1
## Different value of delta is used for different parts of question 2.
d = 0.2; 0 ; 1;
15
## In 2c we specify sigma;
sigma = 2; 0.5;
Tw = similar(grid y)
initial w = 5 * log.(grid y)
v star approx = compute fixed point(bellman operator,
initial w,
max iter=500,
verbose=2,
print skip=10,
err tol=1e-5);
ts length= 2000;
no simul = 10000;
y = Array{Float64}(ts length);
16
k = Array{Float64}(ts length);
y[1] = 0.1
using PyPlot
period = ts length
17
plot histogram(period)
18