Session Ready
Exercise

ARMA (p, q) model

An auto-regressive moving average model (ARMA(p, q)) combines the autoregression (AR(p)) and moving average (MA(q)) models into one. The current value of the simulated vector depends both on previous values of the same vector as well as previous values of the noise vector.

Complete the function definition of arma().

Instructions
100 XP
  • Define an integer variable, start, equal to the maximum of p and q, plus one. Recall that max() is in the std namespace.
  • Inside the outer for loop, define a double variable, value, as mu plus the ith noise value.
  • Inside the first inner for loop, increase value by the jth element of theta times the "i minus j minus 1"th element of eps.
  • Inside the second inner for loop, increase value by the jth element of phi times the "i minus j minus 1"th element of x.