- Details
- Parent Category: Programming Assignments' Solutions
We Helped With This R Studio Programming Assignment: Have A Similar One?

Category | Programming |
---|---|
Subject | R | R Studio |
Difficulty | Graduate |
Status | Solved |
More Info | Help With Statistics Assignment |
Short Assignment Requirements
Assignment Description
Economics 217
Homework #4
Due Thursday, March 14th, 11AM
Problem 1
For this question you will study the properties of the ARMA(p,q) model.
a. Program a function in R to simulate an ARMA(p,q) process of length N. Please make the code modular to accept any integer values of p or q. Use your function to generate and plot an ARMA(3,2) process for N=100, 1000, and 10000. Assume that φ = (0.3,0.2,0.1) and θ = (0.3,0.1) (10 points)
b. For each of the values of N from part ’a’, calculate the sample average and variance of the outcome variable. What happens to these values as sample size increases? (10 points)
c. For each of these series, plot an autocorrelation function of lag-length 10. Do we find any differences in the autocorrelation function by sample size? (10 points)
d. For N = 100, simulate the ARMA process 1000 times and calculate a 90% confidence
interval for the estimate of variance. (10 points)
Problem 2
For this question you will study vector autoregressions.
a. Using the library "quantmod", download stock price (open) data for GOOG (Google) and AMZN (Amazon) for the period 2014-04-01 to 2016-01-01. Plot both price series in a panel plot using R. Further, suppose that these two price series follow a one-lag vector autoregression of the following form:
Gt = β0 + β1At + β2Gt−1 + β3At−1 + ut
At = γ0 + γ1Gt + γ2At−1 + γ3Gt−1 + et
where ut and et are unobservables for the two equations. Please derive the reduced form vector autoregression for this system of equations. Then, using the function lm, please estimate the one-lag reduced form vector autoregression for the two price series. Please interpret your results.
(20 points)
b. Using R, please conduct a one-lag Granger causality test between the two price series. In what way are these results consistent with the reduced form VAR from part A? (10 points)
c. For the next question, we will construct impulse response functions. Simply put, to construct an impulse response function, we shock one of the noise parameters in the reduced form VAR, and then follow the effects through the system of equations over time.
Starting from the most recent prices for amazon and google from parts ’a’ and ’b’, assume that there is a $60 increase in the noise term for the reduced form VAR that predicts the price for amazon. Please write code (without using existing impulse response libraries) to trace out the effects of this unobserved shock on the prices of both google and amazon for 10 future periods. Please plot these impulse response functions (20 points. Hint: Use matrices and iterate forward. Also, set all unobservables to zero except the initial shock.)
Problem 3
For this question you will study stationary processes and cointegration.
a. Using the same price series from problem 1, please determine the order of integration for each price series.
b. Are the two price series cointegrated? Please code this procedure in R to test for cointegration. Plot the residuals and discuss how the residual plot supports your answer.