Plot the data from the simulated MA(1) model
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)\).
The code on the right simulates 250 observations and should look familiar.
This exercise is part of the course
Intro to Computational Finance with R
Exercise instructions
- Make a line plot of the observations in
ma1_sim
with the title "MA(1) Process: mu = 0.05, theta = 0.5". Label the x-axis with "time" and the y-axis with "y(t)". A line plot can be specified by settingtype = "l"
of theplot()
function. - Add a horizontal line at zero.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
set.seed(123)
# Simulate 250 observations from the described MA(1) model
ma1_sim <- arima.sim(model = list(ma = 0.5), n = 250, mean = 0, sd = 0.1) + 0.05
# A line plot of the simulated observations