0% found this document useful (0 votes)
7 views

Assignment_monday

The assignment focuses on solving the stochastic growth model using value function iteration with a discretized state space in Matlab. Students are required to complete a provided script, iterate on the Bellman equation, simulate the model over 10,000 periods, and analyze the results through various calculations and plots. Additionally, they must calculate the transition matrix and verify specific conditions regarding capital and productivity.

Uploaded by

tianfei.lyu.163
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Assignment_monday

The assignment focuses on solving the stochastic growth model using value function iteration with a discretized state space in Matlab. Students are required to complete a provided script, iterate on the Bellman equation, simulate the model over 10,000 periods, and analyze the results through various calculations and plots. Additionally, they must calculate the transition matrix and verify specific conditions regarding capital and productivity.

Uploaded by

tianfei.lyu.163
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Numerical Methods Bootcamp

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

kvn (k, z) − vn−1 (k, z)k < 1(−6).

(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

spend too much time waiting for the iteration to converge.


2
1(−6) is scientific notation for 0.000001. In matlab you can declare such small numbers by 1e-6.
3I would discourage you from naming any variable “i” in matlab, as it can be interpreted as an irrational

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

Figure 1. Policy functions.

(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)

Figure 2. Simulated variables.


#10-3 Unconditional distribution of capital
18
Theoretical distribution
16 Simulated frequency (T=1,000)
Simulated frequency (T=10,000)
14

12
Frequency/Probability

10

20 20.5 21 21.5 22 22.5 23


Capital stock

Figure 3. Probability distributions.

You might also like