3

I am using the forecast package of R and I created a MA(1) model by using the ARIMA function. I plotted the time series itself ($x variable of the ma_model), the model itself ($fitted variable of the ma_model) and the residuals (residuals variable of the ma_model). Strangely the time series looks equal to the model altough there are nonegative residuals. Here is the code that I used:

library(forecast)
ma_model<-Arima(ts(generationData$Price[1:200]), order=c(0,1,0))
plot(ma_model$fitted, main = "Fitted")
plot(ma_model$x, main = "X")
plot(ma_model$residuals, main = "Residuals")

Here is the result enter image description here

Basically the model can't be equal to the real time series especially when having residuals. Can anyone explain this to me? I'd appreciate every comment.

Update: I tried to use the order=c(0,0,20) so I have a MA(20) or AR(20) model (I am not sure which parameters stands for MA and AR). Now the fitted curve and the original time series look quite equal (but not exactly equal). Is this possible and usual? I'd appreciate every further comment.

Any comments on this issue?

PeterBe
  • 700
  • 1
  • 17
  • 37

1 Answers1

1

I am not sure about your output, but from the code it seems that you just took the difference in the model, not the MA.

I think it should be order=c(0,0,1) instead of order=c(0,1,0) for building the MA model.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Thanks Kashyap Dobariya for your answer (I upvoted it). I now use order = c(0,0,1) and now the residuals and the fitted curve look equal. Can this be possible? – PeterBe Oct 27 '20 at 17:35
  • Hi Kashyap. Any comments to my last comment? I'd appreciate any further answer from you. – PeterBe Oct 28 '20 at 13:50
  • Can it be possible for a MA(1) model that the residuals and the fitted curve look equal? – PeterBe Oct 29 '20 at 17:42
  • According to my knowledge if that's the case that residuals and the fitted curve looks equal, you need to apply more parameters in model creation like add parameters in order=c(p,d,q), the final result should be the white noise in case of residuals. – Kashyap Dobariya Oct 29 '20 at 17:59
  • Also if both the graphs are showing the same result then your model is not capturing the enough variance, for the residuals it should left with just white noise. – Kashyap Dobariya Oct 29 '20 at 18:01
  • Hi all, it's me again. I tried to use the order=c(0,0,20) so I have a MA(20) or AR(20) model (I am not sure which parameters stands for MA and AR). Now the fitted curve and the original time series look quite equal (but not exactly equal). Is this possible and usual? I'd appreciate every further comment. – PeterBe Dec 14 '20 at 18:58