September 14, 2022
You are allowed to work in groups of at most 3 people for the following assignment and submit joint responses in ONE pdf file and one .jl (Julia) file. Please write each name and ID clearly in the front page. For Question 1, you should submit a Julia code file as well as copying and pasting the code into the PDF.
1. Spurious regression problem.
We verify the spurious regression problem using simulated data.
Copyright By PowCoder代写 加微信 powcoder
(a) Use the Random library to fix the seed using Random.seed!(1234). This guarantees results are reproducible. Construct two independent random walks xt and yt of length N = 10,000. To do this, first stimulate two standard normals ex and ey. Then set y1 = 0, x1 = 0 and generate
yt = yt−1 + ey,t xt = xt−1 + ex,t
for 2 ≤ t ≤ N. Note, you can generate draws from a standard random normal using randn. Plot x and y in the same figure with respect to time. For this, use can use either the Plots or Pyplot libraries.
(b) Using the DataFrame and GLM libraries, regress y on x and a constant: yt = β0 + β1xt + εt
Report the estimate βˆ1 and its standard error SE(βˆ1). Is it significantly different from zero? If so, is this misleading?
(c) Now re-run the regression with a lagged dependent variable: yt =β0 +β1xt +β2yt−1 +εt
What are the estimates of βˆ1 and βˆ2 and their respective standard errors? How does the coefficient on x compare in this case to without the lagged dependent variable?
(d) Now, using the same random draws eyt and ext as before, define AR(1) processes for xandywithρx =ρy =0.8:
yt = ρxyt−1 + ey,t xt = ρxxt−1 + ex,t
and regress y on x (and a constant). What is the slope coefficient and the standard error? How does this compare to part (a)?
(e) Now, maintain the assumption that xt is a random walk but redefine yt to depend on xt as follows:
yt = βxt + ey,t
with β = 2. Repeat the regression of y on x. What is the estimated slope coefficient
βˆ1? How does it compare to 2?
2. Markov chain
Consider a 2-state Markov chain and a random variable yt = y′xt, where y = (2,5)′. Suppose it is known that E(yt+1|xt) = (3, 4). Note: you should do this problem by hand and show your work, but of course you can use the computer to check accuracy.
(a) Find a transition matrix consistent with the conditional expectations. (b) Find a stationary distribution for the Markov chain xt.
(c) What is the probability of moving from state 1 to state 2 in 3 periods?
3. Impulse response of an ARMA(1, 1) process Let xt follow ARMA(1, 1) process– that is, the sum of an AR(1) and MA(1) process:
where {εt} is white noise.
xt = ρxt−1 + εt + θ1εt−1
(a) Write this in the form φ(L)xt = θ(L)εt for polynomials φ(L) and θ(L), being sure to specify the polynomials.
(b) Assuming the roots of the polynomial φ(z) lie outside the unit circle, the process is covariance stationary, and the series can be represented by a square summable sequence xt = ∞j=0 ψjεt−j. Using xt = φ(L)−1θ(L)εt, rearrange terms to solve for {ψj}. You should be able to find the pattern via algebraic rearrangement.
(c) The mapping t → ψt is the impulse response function. Plot the coefficients {ψt} for θ = 0.2 and (1) either ρ = 0.8 or ρ = −0.8. How do the responses compare?
Both processes feature declining amplitude over time but ρ = −0.8 generates os- cillations. The effects of the persistence parameter are modified with θ1 such that there is an initial upward bump if ρ = 0.9 prior to decaying.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com