# MA terms in arima

With the arima function I found some nice results, however now I have trouble interpreting them for use outside R. I am currently struggling with the MA terms, here is a short example:

ser=c(1, 14, 3, 9)        #Example series
mod=arima(ser,c(0,0,1))   #From {stats} library
mod

#Series: ser
#ARIMA(0,0,1) with non-zero mean
#
#Coefficients:
#          ma1  intercept
#      -0.9999     7.1000
#s.e.   0.5982     0.8762
#
#sigma^2 estimated as 7.676:  log likelihood = -10.56
#AIC = 27.11   AICc = Inf   BIC = 25.27

mod$resid #Time Series: #Start = 1 #End = 4 #Frequency = 1 #[1] -4.3136670 3.1436951 -1.3280435 0.6708065 predict(mod,n.ahead=5) #$pred
#Time Series:
#Start = 5
#End = 9
#Frequency = 1
#[1] 6.500081 7.100027 7.100027 7.100027 7.100027
#
#\$se
#Time Series:
#Start = 5
#End = 9
#Frequency = 1
#[1] 3.034798 3.917908 3.917908 3.917908 3.917908
?arima


When looking at the specification this formula is presented: X[t] = a[1]X[t-1] + … + a[p]X[t-p] + e[t] + b[1]e[t-1] + … + b[q]e[t-q]

Given my choice of AR and MA terms, and considering that I have included a constant this should reduce to: X[t] = e[t] + b[1]e[t-1] + constant

However this does not hold up when i compare the results from R with manual calculations: 6.500081 != 6.429261 == -0.9999 * 0.6708065 + 7.1000

Furthermore I can also not succeed in reproducing the insample errors, assuming i know the first one this should be possible: -4.3136670 * -0.9999 +7.1000 != 14 - 3.1436951 3.1436951 * -0.9999 +7.1000 != 3 + 1.3280435 -1.3280435 * -0.9999 +7.1000 != 9 - 0.6708065

I hope someone can shed some light on this matter so I will actually be able to use the nice results that I have obtained.

-
I just tried this with a much longer series, e <- rnorm(1001); y <- e[-1] + 0.5*e[-1001] and the numbers came out fine. I also replicated your problem. I have no idea what happened with your series; I can only suspect its shortness caused some problem! Very interesting. –  jbowman Dec 27 '11 at 1:19
AN MA 1 coefficient of -.999999 indicates that you have a very questionable model. Try using the Box-Jenkins method of identification in order to form your model. If you post your data I will try and help you ( after the new year ! ) –  IrishStat Dec 27 '11 at 4:05
Thank you very much for the replies, I have tried whether it is caused by the length by substituting the first line with ser=rep(c(1, 14, 3, 9),100) but this still did not provide the desired result. Therefore I conclude it must be the awkwardness of the test model that is causing the problem as suggested by IrishStat . I will leave it open for a few days, but if there are no new insights I will accept this answer –  Dennis Jaheruddin Dec 27 '11 at 9:34