Session Ready
Exercise

Plotting the theoretical and the sample ACF

Still consider the MA(1) model $$Y_t = 0.05 + \epsilon_t + \theta \epsilon_{t-1},$$ with \(|\theta| < 0\) and \(\epsilon_t ~ iid\) \(N(0,(0.1)^2)\).

While we still assume \(\theta = 0.5\), the theoretical value for the first order autocorrelation is \(\rho_1 = \frac{ \theta}{1+\theta^2} = \frac{0.5}{1+0.5^2} = 0.4\). The theoretical autocorrelation function gives you for each lag the autocorrelation implied by the model. In R, you can use the ARMAacf function to calculate the theoretical autocorrelations for an ARMA model. The ma argument should contain the moving average coefficients, and lag.max specifies the maximum number of lags for which the autocorrelations should be calculated.

Based on the simulated data, you can also easily calculate the sample autocorrelation function in R with the acf() function. It automatically generates a plot of the sample autocorrelation function. Check the documentation of acf for more info.

Instructions
100 XP
  • Use the ARMAacf function to calculate the theoretical autocorrelations up to lag 10. Assign the result to acf_ma1_model.
  • Construct the plot of the sample autocorrelations up to lag 10 by using the acf() function. Set the title of the plot to "Sample ACF".