Neuman Co
2013-May-22 14:13 UTC
[R] Forecasting MA model different to manually computation?
Hi, 3 down vote favorite 1 I am interested in forecasting a MA model.Therefore I have created a very simple data set (three variables). I then adapted a MA(1) model to it. The results are: x<-c(2,5,3) m<-arima(x,order=c(0,0,1)) Series: x ARIMA(0,0,1) with non-zero mean Coefficients: ma1 intercept -1.0000 3.5000 s.e. 0.8165 0.3163 sigma^2 estimated as 0.5: log likelihood=-3.91 AIC=13.82 AICc=-10.18 BIC=11.12 While the MA(1) model looks like this: X_t=c+a_t+theta*a_{t-1} and a_t is White Noise. Now, I look at the fitted values: library(forecast) fitted(m) Time Series: Start = 1 End = 3 Frequency = 1 [1] 3.060660 4.387627 3.000000 I tried different ways, but I cant find out how the fitted values (3.060660, 4.387627 and 3.000000) are calculated. Any help would be very appreciated. -- Neumann, Conrad
Rui Barradas
2013-May-22 15:00 UTC
[R] Forecasting MA model different to manually computation?
Hello, Since R is open source, you can look at the source code of package forecast to know exactly how it is done. My guess would be x - m$residuals Time Series: Start = 1 End = 3 Frequency = 1 [1] 3.060660 4.387627 3.000000 Hope this helps, Rui Barradas Em 22-05-2013 15:13, Neuman Co escreveu:> Hi, > 3 down vote favorite > 1 > > I am interested in forecasting a MA model.Therefore I have created a > very simple data set (three variables). I then adapted a MA(1) model > to it. The results are: > > x<-c(2,5,3) > m<-arima(x,order=c(0,0,1)) > > Series: x > ARIMA(0,0,1) with non-zero mean > > Coefficients: > ma1 intercept > -1.0000 3.5000 > s.e. 0.8165 0.3163 > > sigma^2 estimated as 0.5: log likelihood=-3.91 > AIC=13.82 AICc=-10.18 BIC=11.12 > > While the MA(1) model looks like this: > > X_t=c+a_t+theta*a_{t-1} > > and a_t is White Noise. > > Now, I look at the fitted values: > > library(forecast) > fitted(m) > Time Series: > Start = 1 > End = 3 > Frequency = 1 > [1] 3.060660 4.387627 3.000000 > > I tried different ways, but I cant find out how the fitted values > (3.060660, 4.387627 and 3.000000) are calculated. > > Any help would be very appreciated. > > > > -- > Neumann, Conrad > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Peter Buribon
2013-May-22 16:00 UTC
[R] Forecasting MA model different to manually computation?
mh, this is interesting, I would have expected that the following is valid: If we look at the second value: 4.387627 = 3.5 + (-1)*(5-3.060660) or 4.387627 = 3.5 - (-1)*(5-3.060660) but this does not work. Surprise. Nice question! ________________________________ Von: Neuman Co <neumancohu@gmail.com> An: r-help@r-project.org Gesendet: 16:13 Mittwoch, 22.Mai 2013 Betreff: [R] Forecasting MA model different to manually computation? Hi, 3 down vote favorite 1 I am interested in forecasting a MA model.Therefore I have created a very simple data set (three variables). I then adapted a MA(1) model to it. The results are: x<-c(2,5,3) m<-arima(x,order=c(0,0,1)) Series: x ARIMA(0,0,1) with non-zero mean Coefficients: ma1 intercept -1.0000 3.5000 s.e. 0.8165 0.3163 sigma^2 estimated as 0.5: log likelihood=-3.91 AIC=13.82 AICc=-10.18 BIC=11.12 While the MA(1) model looks like this: X_t=c+a_t+theta*a_{t-1} and a_t is White Noise. Now, I look at the fitted values: library(forecast) fitted(m) Time Series: Start = 1 End = 3 Frequency = 1 [1] 3.060660 4.387627 3.000000 I tried different ways, but I cant find out how the fitted values (3.060660, 4.387627 and 3.000000) are calculated. Any help would be very appreciated. -- Neumann, Conrad ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]