PeterBe
PeterBe

Reputation: 852

Time Series and MA-model look equal in R

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?

Upvotes: 3

Views: 83

Answers (1)

Kashyap Dobariya
Kashyap Dobariya

Reputation: 11

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.

Upvotes: 1

Related Questions