Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Problem Set 7: Value Function Iteration

Programming for Economics – ECNM10106

Spring 2023

Due Friday, March 24, 2023

Problem 1. Consider the neoclassical growth model with endogenous labor supply.1    A representative household starts the period with a capital stock k, and chooses consumption c, hours worked l, and capital for tomorrow k\ . Households have a time endowment of 1, which they must split between labor and leisure. Production is Cobb-Douglass, with F (k, l) = Ak α l1 yα .  Capital depreciates at a rate s every period.  You can write this problem recursively as:

o(k) = max

c,k\ ,l s.t.

u(c, l) + 8o(k\ )

c + k\  < F (k, l) + (1 - s)k

0 < l < 1

Assume utility that is additively separable in utility from consumption c and disutility from labor l, with CRRA preferences:

c1 yσ l1+1

1 - 7        1 + 1/v

For this problem, set 8 = 0.95, s = 0.05, 7 = 2, v = 2, a = 1/3, A = 1, and o = 1.

(a) Solve this problem with value function iteration, using a grid search to solve the maximization problem

at every step.  Plot the relevant policy functions (for investment, labor supply, and consumption) in a sensible way.  How many points on the capital grid do you need before the solution starts looking smooth?  How many choices do you need to consider for l?  How long does your solution take you? What do you take away from this?

(b) Solve this problem using policy function iteration. You can verify that you obtain the correct solution

by comparing your results to part (a). Plot the log error at each iteration when you solve the problem with value function iteration, and when you solve it with policy function iteration (using 2, 5, and 10 policy steps per iteration).2   Interpret your results. What does this tell us about the relative rates of convergence? Does this translate to runtime speed?

(c) Rather than using a grid search, interpolate the values of o using cubic splines, and use your favorite continuous optimization algorithm to solve the maximization problem. Plot the relevant policy func- tions.  How many grid points do you need to get a reasonably accurate solution?  What does this do to your runtime? If you’re feeling ambitious, try implementing policy function iteration here as well.3 Discuss your results.

(d) Use your policy functions to calculate the steady state of this model. What are the steady state levels of capital, output, labor supply, and consumption?

(e) Suppose that we perturb k away from its steady state value of k . That is, consider an economy that

starts with k0  = 0.7k . Plot the impulse response functions4 of capital, labor, output, and consumption, as the economy converges to its steady state. Discuss your results.

1 This is quite similar to the version of the neoclassical growth model that we saw in class, but it has just one additional choice variable: how many hours of labor to supply.

2 This is similar to the graph we saw in tutorial

3 You might also try alternative interpolation methods, like chebyshev polynomials or linear interpolation. Which work best?

4 This is just another way to say plot the time series” as the economy converges back to the steady state. That is, if g(k) is your policy function for k\ , then for each t > 0, calculate kt+1  = g(kt) until you converge back to the steady state.  Plot each outcome on the y-axis, with time on the x-axis.

Problem 2. Consider the problem of an infinitely lived worker with assets a and an income u who is saving for the future.  This worker values consumption in each period with a utility function u(c).  They can save at a risk-free rate r, but cannot borrow, and they discount the future at a rate 8 . Their income is a random variable. In particular, income tomorrow follows a log-normal AR(1) process:

log(u\ ) = o log(u) + e

where e ~ N (u, 7e ). Their problem can be written recursively as:

o(a, u) = max    u(c) + 8E [o(a\ , u\ ) | u]

c,a\

s.t.     c + a\  < (1 + r)a + u

a\  > 0

log(u\ ) ~ N (u + o log(u), 7e )

Note: you have not seen this model before, but it should look very familiar. It is very similar to the stochastic neoclassical growth model that we saw in class.  For this problem, set 8 = 0.95, r = 0.04, u = 0.5, o = 0.8, 7e = 0.1, and u(c) = c1yσ /(1 - 7) for 7 = 2

(a)  Solve this problem using any method that we have learned (value function iteration, policy function

iteration, grid searches, interpolation, etc...).5   You will need to determine how many grid points are necessary, and determine appropriate bounds on the asset grid.6   Discuss the choices you made, and defend why you made them.   Plot the relevant policy functions in a sensible way, and discuss the results. In particular, you should plot consumption as a share of available resources. What stands out to you?

(b)  Suppose you are given an initial starting point (a0 , u0 ). You can simulate a sample worker history by

repeatedly evaluating the policy rules, and taking random draws for u0 .7  Start from a0  at the midpoint of your asset grid, and u0  from the midpoint of your income grid.  Simulate 5 sample paths and of assets, income and consumption, for 100 model periods.  Plot them together (you should have three graphs, side-by-side, with 5 lines on each one). Discuss what the results look like.

(c)  Now let’s try this for 10,000 workers.8   Initialize the worker states in any way you like.  Simulate the population forward for 100 periods, and plot a histogram with the distribution of assets. Try stepping the population forward another 100 periods. Is the distribution changing very much?  Can you gure out a way to discuss what it would mean to say that the distribution has converged?

(d)  For the ambitious among you:  Suppose the government decided to tax income (both earned interest ra and labor income u) at a rate of 25% to nance government expenditures. Re-solve the model with this tax rate, and compare the results. How does the distribution of assets change? How much revenue does this raise every period?

(e)  For the exceptionally ambitious among you: what if the government decided to tax just labor income, but wanted to raise the same revenue? Find the tax rate r that would accomplish this.9   Compare the distribution of savings, and average welfare under these two tax systems. What can you say about the results?

5 You will almost certainly want to discretize y and approximate it as a Markov chain, as we discussed in class.  To do this, you should use Rouwenhorst’s method.

6 Hint:  when you plot the policy functions, workers with the highest asset levels and the highest income levels should be choosing to decumulate their assets. If their choices are being bounded by the capital grid, then something is going wrong.

7 Remember, if you have y e (y1 , y2 , . . . , yn}, where the yi  are sorted, and you know P (y = yi) = pi, you can randomly draw samples from this discrete distribution as follows:

(i)  Calculate the cumulative distribution function (a vector in this case):  Fi  =     j(i)=1 pj  Notice that Fi  e [0, 1].

(ii)  Draw a uniformly distributed z ~ U [0, 1].

(iii)  Find  the  largest  i  such  that  z   5   Fi .     This  can  be  done  efficiently  using  numpy .searchsorted  in  python,   or

searchsortedfirst in Julia.

(iv)  Return yi

There are other ways to draw random numbers from discrete distributions.  See Lecture 4 for more details.

8 If you’re doing this in python, you will need to be clever about writing your code using numpy vector operations (vectorized code). If you just write a simple nested loop, it will be far too slow to ever nish.

9 This will require you to search for τ and re-solve your model each time.