Assignment_monday
Assignment_monday
Monday Assignment
Value Function Iteration
In this assignment you are asked to solve and simulate the stochastic growth model using
value function iteration on a discretised state space. You will be provided with an incomplete
Matlab script which you need to understand, and then program the blanks.
The model is summarized by the Bellman equation
X
v(k, z) = max
0
{u(zk α + (1 − δ)k − k 0 ) + β v(k 0 , z 0 )P (z 0 |z)}
k
z0
with associate decision rule k 0 = g(k, z). Productivity, z, can only take two values; “good”
and “bad”, and we will discretise the domain for capital, k, such that we will be analysing an
entirely discrete problem. The values of the parameters; the values for z; and the grid for k
are all provided in the code. All graphs in this document are generated setting N = 1, 000.1
To complete today’s assignment you should carry out the following steps:
(i) Iterate on the Bellman equation until2
(ii) Plot your decision rules in the (k, k 0 )-plane, and check that your grid was wide
enough to cover the ergodic set. The results are illustrated in Figure 1.
(iii) Simulate the model for t = 1, 2, . . . T periods, with T = 10, 000. In particular, make
10,000 draws from a uniform distribution on [0, 1] using the random seed 1979.
Call this T × 1 vector e. Let Zt be a variable taking on values in {1, 2}. Whenever
et < P (Zt , 1), then Zt+1 = 1, otherwise Zt+1 = 2. P refers to the transition matrix
for z. Plot your results for the last 100 periods. Figure 2 illustrates what your
results should look like.
(iv) Calculate the simulated series for productivity, z, output, y = zk α , investments
i = k 0 − (1 − δ)k, and consumption, c = y − i.3 Calculate their means. Take
logarithms and calculate the correlation matrix. Calculate the relative standard
deviation of the logarithm of each variable to output.
1As you experiment with the code, it is useful to run your code with N = 50 or so. Otherwise you will
number.
2
Policy function(s)
24
23.5
23
22.5
Capital tomorrow, k'
22
Good state
21.5 Bad state
45o line
21
20.5
20
19.5
19
19 20 21 22 23 24
Capital today,k
(v) Calculate the transition matrix T for (k, z). This matrix will be 2N × 2N , and it
will be sparse. Find the long run distribution as the eigenvector associated with
a unit eigenvalue normalised to sum to one. Compare this long run distribution
with its simulated counterpart in part (iv). If your calculations are correct, your
results should replicate the yellow and orange lines in Figure 3.4
(vi) Set γ = 1 and δ = 1. Under these conditions we know that k 0 = zαβk α . Does your
code confirm this result? (It should)
4The orange line is somewhat hidden behind the yellow, as they coincide very well.
3
1.03 2.6
1.02
Productivity, z
2.55
Output, y
1.01
1
2.5
0.99
0.98 2.45
0 50 100 0 50 100
0.6 2
1.99
Consumption, c
Investment, i
0.55
1.98
1.97
0.5
1.96
0.45 1.95
0 50 100 0 50 100
Time (quarters) Time (quarters)
12
Frequency/Probability
10