[R] MA terms in arima
testrider
testrider at gmail.com
Wed Dec 21 19:27:15 CET 2011
With the arima function I found some nice results, however now i have trouble
interpreting them for use outside R.
I am currently struggeling 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.
Dennis
--
View this message in context: http://r.789695.n4.nabble.com/MA-terms-in-arima-tp4222716p4222716.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list