ECON122: Computational Task Due: December 16
This assessment task requires you to use a scientific programming language suitable for running Monte Carlo simulations. I suggest using Julia, which is free and open source. You can read about Julia here. An excellent set of lectures on Julia aimed at students and researchers in economics can be found here. Click on the link Setting up your Julia Environment to find step-by-step instructions for installing Julia and Jupyter on your machine. (Jupyter is a browser-based inter- face for interacting with Julia, Python and R, which I used in the demonstrations in class.) You may find this MATLAB-Python-Julia cheatsheet helpful.
You should submit your answers to me by email. Your answers should include the code used to generate results, a total of eight graphs, and a written response to part (f).
(a) Ineachof1000iterationsofaMonteCarlosimulation,dothefollowingwith n = 4 and k = 3.
- (i) Generate an n × k matrix X where every element of the first column is equal to one, and the remaining elements are independent standard normal random variables.
- (ii) Generate an n × 1 vector u whose elements are independent standard normal random variables.
- (iii) Sety=Xβ+u,whereβisak×1vectorwiththefirstelementequal to one and the remaining elements equal to zero.
- (iv) Computethe(non-robust)F-statisticfortestingthenullhypothesisthat the last k − 1 elements of β are equal to zero.
- (v) Record whether the F-statistic exceeds the 95% quantile of the F(k − 1, n − k ) distribution.
- (vi) Record whether k − 1 times the F -statistic exceeds the 95% quantile of the χ 2 (k − 1) distribution.
Compute the proportion of Monte Carlo replications in which the F -statistic exceeded the 95% quantile of the F (k − 1, n − k ) distribution, and the propor- tion of Monte Carlo replications in which k − 1 times the F -statistic exceeded the 95% quantile of the χ2(k − 1) distribution. Call these proportions rejF (n) and rejχ2 (n) respectively.
1
- (b) Repeatpart(a)usingn=5,6,7,…,50.GraphrejF(n)andrejχ2(n)asfunc- tions of n. (Hint: if you have trouble getting Julia to produce a suitable graph, try exporting the data to be graphed to a spreadsheet program with suitable graphing capabilities.)
- (c) Repeat parts (a) and (b) using Student t random variables with 5 degrees of freedom in place of standard normal random variables in parts (a)(i) and (a)(ii).
- (d) Repeat parts (a) and (b), but in place of (a)(ii), do the following: Generate an n × 1 vector v whose elements are independent standard normal random variables, and then let u be the n × 1 vector with t th element given by ut= x2 +x2vt.
t,2 t,3
- (e) Repeat part (d), but using heteroskedasticity-robust F-statistics instead of non-robust F -statistics.
- (f) Interpret the graphs produced in parts (b), (c), (d) and (e) in words, relating what you see to what we learned about the F -statistic in class.
2