Take Home Exam
Programming for Economics
Spring 2023
Instructions
This exam consists of four questions. Please answer all the questions. You have from 9:00:00 on the 24th of April to 20:00:00 on the 26th of April to upload your solutions. Solutions must be uploaded to Learn before the deadline. Allow sufficient time for the uploading process because late submissions will not be accepted.
Attempt all questions and sub-questions. If you get stuck on a problem and are unable to complete it, you should write up a short and clear description of where you got stuck, what you think is going wrong, and how you would attempt to solve the remainder of the problem if you could. A careful and thoughtful attempt, even if unsuccessful, will be rewarded. This is true, even if you are unable to produce working code. For each question, you should try to demonstrate what you have learned during the course. Partial credit will be given to answers that demonstrate knowledge and understanding of the problem at hand and how to solve it.
Submissions should either be a Jupyter (IPython) notebook (where the code is mixed with the solu- tions), or a PDF with your solutions and formatted output and the code attached separately. Answers to each question may be done in either Python or Julia, as you prefer (however, you should not mix Python and Julia code in the same notebook). We suggest that you submit two notebooks: one for
part (A) and one for part (B). Do not forget to run your Jupyter notebook before submitting, to ensure that all figures/output are included. Please ensure that all graphs/diagrams are readable, profession- ally formatted, and clear, with labeled axes, and appropriate titles where necessary. Any discussions, mathematical derivations, computations, or proofs should be written incomplete sentences.
Please do not forget to answer the sub-questions that ask you to provide an explanation/interpretation of the findings or to answer in words a specific question. If you are using Jupyter (IPython) notebook, text answers must be in a markdown cell or in a print statement. We will not grade text answers written in comments inside the code.
If you have multiple files to submit, you should submit a zip file which contains all the relevant code to produce any figures/results you discuss. If you have split your solution into several pieces, you should include a README file in the folder, which clearly specifies:
1. Where the solutions to each question can be found
2. Which code needs to be run to produce your solutions, and in what order
3. Any other instructions that would be necessary for someone to follow if they wanted to reproduce your work
This exam is open book. You should feel free to consult any of the relevant course materials, adapt code that you have used on your problem sets, or even adapt code that your classmates have shared with you (so long as they shared it before the exam), in order to solve these problems.
This being said, you may not consult your classmates during the exam, or discuss the exam in any way. Any collaboration during the exam will be considered academic misconduct, and will be dealt with accordingly.
Section A
A1 (25 marks)
The Life-cycle of consumption and income across occupational groups in Uganda. Use the 2011-2012 Uganda ISA-LSMS data from problem set 2 and answer the following questions. You can find the data and the variables description file in Lab Session 3 in Learn.
a. Compute the consumption and income at the per capita level by dividing the household con- sumption and income by the number of members in the household. Report the mean and the Gini indexof the consumption and income at the household level and at the per capita level. Is inequality larger measured at the household level or at the per capita level? Why? (5 marks)
b. Create a categorical variable that describes the main occupation of the household: farmer, en- trepreneur, or worker. To do so, consider that a household is “farmer” if agricultural income is more than 50% of the household income, an “entrepreneur” if business income is more than 50% of the household total income, and “worker” if labour income is more than 50% of the household total income. What is the proportion of households in each occupational group in Uganda? And in rural vs urban Uganda? Briefly comment on the results. (5 marks)
c. Plot the life-cycle of the log of consumption at the household level across occupational groups. Plot the life-cycle of the log of consumption at the per capita level across occupational groups. How does the life-cycle of consumption across occupations change when consumption is mea- suredat the per capita level? (10 marks)
d. Plot the life-cycle of the log of income at the household level across occupational groups. Around what age of the household head does the income of the households attain the maximum? If across some occupations the maximum is different, provide an intuition why. (5 marks)
A2 (25 marks)
Steady-state and transitions in a Representative Agent Economy. Consider an economy populated by a large number of identical infinitely lived households that maximise
where ct is consumption, it is investment, kt is the capital stock, andy tis output. Note that households are choosing consumption and investment at every time period t. As is standard, β represents the discount rate, δ represents the depreciation rate of capital, and A is productivity. Take k0 as given.
a. Analytically, solve for the FOC of the problem and find the equilibrium equation of this economy: the Euler equation. (5 marks)
Using the following parameter values: α = 0.3, β = 0.98, δ = 0.07:
b. Find the value of the TFP parameter, A, such that in the economy in steady state — k* = kt+1 = kt — the output level, y*, is equal to 10. (5 marks)
c. Suppose the economy suffers a negative permanent TFP shock and A decreases by 25%. Compute and plot the transition of capital from the original steady state to the new steady state.
Hint: Assume that the new steady state is achieved in 40 periods and create and solve a system of
40 equations based on the equilibrium equation of the economy. (10 marks)
d. Plot the transition of output and consumption along the same period. (5 marks)
Section B
B1 (25 marks)
Cake Eating Problem: Consider the problem of a person with x0 units of cake that they are thinking about eating. The trouble is, they have concave preferences over their cake consumption in each pe- riod, so they want to ensure that they don’teat it all at once. In particular, assume that they have CRRA preferences u (c) = c1—σ /(1 — σ), for σ = 2.5 and that they discount the future at a rate β . We’ll assume that they have access to a flawless refrigeration technology, so the cake does not spoil if they save some for the next day. Moreover, they have a special deal with the bakery: every day, the baker gives them one new unit of cake for free (so they will never run out).
Assume our consumer is infinitely lived. Then we can write their problem in sequence form. as
Hint: If you’re not sure where to start, this is a special case of the neoclassical growth model (which we saw in both Lecture 7 and Tutorial 7),for a particular choice of the production function. Think about what your choice of F(k) and the depreciation rate δ must be, and then this problem should look quite familiar.
(a) Rewrite this dynamic program in its recursive formulation. That is, write v(x) as a recursive maximization problem,where v occurs both on the left-hand side, and on the right-hand size as a continuation value, of entering the next period with xI units of cake. Describe the intuition for why we can re-write the problem in this way. (5 marks)
(b) Solve this problem using value function iteration, for x ∈ [10—4, 10]. Use an evenly spaced grid for x with 50 points. Start with an initial guess of v0(x) = 0, and use linear interpolation to approximate your guess so that you can evaluate it off of the grid. Keep iterating until the value functions stop changing within a tolerance of 10 —6. Use three different values for β: 0.9, 0.95, 0.99. Plot the log errors against the number of iterations for each solution. What are the slopes? Interpret these results. (10 marks)
For every starting value of x on your grid, calculate the ratio and plot the results, for each of our four values of β . What do you notice? How can we interpret these results? To answer this, you will want to derive the Euler equation for this model. Does the Euler equation hold exactly in your numerical solution? If not, then explain why. Could you change anything in your solution algorithm to make it hold everywhere? (10 marks)
B2 (25 marks)
Aiyagari with Disaster Shocks. Consider the problem of an employed worker who is choosing how much to save for the future. They have human capital y which is subject to shocks: y follows an AR(1) process with persistence ρ, drift µ, and variance of the innovations σe. They can save at a risk-free rate r, but cannot borrow. They value consumption with a CRRA utility function u (c) = c1—σ /(1 — σ), and discount the future at a rate β .
So far, this looks just like the model we saw in class. We are going to add one more wrinkle: with a probability δ ∈ (0, 1), our worker receives a disaster shock and their income falls by a factor φ ∈ (0, 1). That is, if they would have had income yl, now they will receive φyl. You can think of this as a way of modeling a layoff at their firm. We can write their problem recursively as:
Set σ = 2.5, β = 0.95, r = 0.03, ρ = 0.7, µ = 0.5, σe = 0.16. That is, they have a 5% chance each period of losing 50% of their income.
(a) First, consider the baseline case with δ = 0. Solve this problem for σe = 0.05 and σe = 0.16. You can use any solution method that you like, but you should describe clearly any choices you have made (and justify them where necessary). Plot net savings (al — a) as a function of assets for workers at five different (representative) points in the income distribution. How does the savings behavior. of agents change as the variance of income shocks increases? Provide economic intuition for your results. (10 marks)
(b) Now, consider the case with σe = 0.16, and δ = 0.05, and φ = 0.5. Solve this problem anyway that you like. Describe clearly the choices you have made, and justify them where necessary. Note, you will not be able to get around interpolating V, since φyl does not need to lie on the income grid. Plot the policy functions for consumption and net savings (al — a) with assets on the x-axis, and a separate line for several different values of y. (Pick representative values). Interpret the results. What does the shape of the policy functions tell you about the underlying economics of this problem?
Hint: If you discretize y like we have done in class, you will need to decide what to do for points on the income grid where φyl < ymin. (10 marks)
(c) Play around with the values of δ and φ . Simulate data from the model and compare the distri- bution of assets under the various scenarios. In particular, make sure to check δ = 0, 0.05, 0.2 and 0.3, with φ = 0.5. How does δ effect the distribution of assets in the economy? Provide economic intuition for the results. (5 marks)
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。