SIMULATION OF MOVING AVERAGE PROCESS IN R

 

Here is the code in R for simulation of moving average:

#simulating MA(3) process

noise = rnorm(10000)

ma3= NULL

for(i in 4:10000) {

ma3[i] = noise[i] + 0.8*noise[i-1] + 0.5*noise[i-2] + 0.3*noise[i-3] }

moving_average = ma3[4:10000]

#changing the series into time series

moving_average = ts(moving_average)

par(mfrow=c(2,1))

plot(moving_average, col='blue')

acf(moving_average)



Conclusion: We observe the lag cuts off at 3 in the autocorrelation graph showing that the process is a MA(3) 

Comments