Salaam Batur
2013-Aug-05 17:04 UTC
[R] R help: My calculation is different than the one in R with ARIMA(2, 3, 0) model
Dear R users, I picked up ARIMA(2,3,0) model for my time series analysis using auto.arima() function.>From my understanding, the model should be in this shape:[Y(hat)(t)-Y(t-1)]-2[Y(t-1)-Y(t-2)]+[Y(t-2)-Y(t-3)]=Theta(1){[(Y(t-1)-Y(t-2)]-2[(Y(t-2)-Y(t-3)]+[Y(t-3)-Y(t-4)]}+Theta(2){[Y(t-2)-Y(t-3)]-2[Y(t-3)-Y(t-4)]+[Y(t-4)-Y(t-5)]}+mu(e(t)) which in this case, mu(e(t))=0, cause the residuals' mean is assumed and estimated as zero. In R, when t is 2013, the estimation value of Y(hat) is 7.084688, which is different from my own calculation 7.1882, according to the model above. Do you think that I missed something? And is there any way that I can simplify the model or the differential equation above??? Many thanks, Chintemur Batur ############################################################################ Here is the code library(tseries) library(forecast) d=scan("D:/Data.txt") d D=ts(data=d, start=1981,end=2012, frequency=1) D ############################################################################## Time Series: Start = 1981 End = 2012 Frequency = 1 [1] 384 403 427 450 499 550 575 615 640 680 702 730 760 790 [15] 790 830 870 871 906 920 968 1010 1060 1111 1165 1191 1217 1221 [29] 1089 1089 1090 1103 ############################################################################# lnD=log(D) lnD3=diff(lnD, differences=3) adf.test(lnD3) par(mfrow=c(3,1)) acf(lnD3, lag.max=20) pacf(lnD3, lag.max=20) autoarima=auto.arima(lnD,d=3) summary(autoarima) Box.test(autoarima$residuals,lag=20,type="Ljung-Box") ForecastAutoArima=forecast.Arima(autoarima, h=5, c=(0.95)) plot.forecast(ForecastAutoArima) [[alternative HTML version deleted]]
Paul Bernal
2013-Aug-05 18:13 UTC
[R] R help: My calculation is different than the one in R with ARIMA(2, 3, 0) model
Dear Salaam, In your ARIMA (2,3,0), you are telling R you are saying that the order of differencing is 3. Have you chequed that you actually differenced the series with d = 3? Regards, 2013/8/5 Salaam Batur <swordlight20@gmail.com>> Dear R users, > > I picked up ARIMA(2,3,0) model for my time series analysis using > auto.arima() function. > > >From my understanding, the model should be in this shape: > > > [Y(hat)(t)-Y(t-1)]-2[Y(t-1)-Y(t-2)]+[Y(t-2)-Y(t-3)]=Theta(1){[(Y(t-1)-Y(t-2)]-2[(Y(t-2)-Y(t-3)]+[Y(t-3)-Y(t-4)]}+Theta(2){[Y(t-2)-Y(t-3)]-2[Y(t-3)-Y(t-4)]+[Y(t-4)-Y(t-5)]}+mu(e(t)) > > which in this case, mu(e(t))=0, cause the residuals' mean is assumed and > estimated as zero. > > In R, when t is 2013, the estimation value of Y(hat) is 7.084688, which is > different from my own calculation 7.1882, according to the model above. > > Do you think that I missed something? > And is there any way that I can simplify the model or the differential > equation above??? > > Many thanks, > Chintemur Batur > > > > ############################################################################ > > Here is the code > library(tseries) > library(forecast) > d=scan("D:/Data.txt") > d > D=ts(data=d, start=1981,end=2012, frequency=1) > D > > ############################################################################## > Time Series: > Start = 1981 > End = 2012 > Frequency = 1 > [1] 384 403 427 450 499 550 575 615 640 680 702 730 760 790 > [15] 790 830 870 871 906 920 968 1010 1060 1111 1165 1191 1217 1221 > [29] 1089 1089 1090 1103 > > ############################################################################# > > lnD=log(D) > lnD3=diff(lnD, differences=3) > adf.test(lnD3) > > par(mfrow=c(3,1)) > acf(lnD3, lag.max=20) > pacf(lnD3, lag.max=20) > > autoarima=auto.arima(lnD,d=3) > summary(autoarima) > Box.test(autoarima$residuals,lag=20,type="Ljung-Box") > ForecastAutoArima=forecast.Arima(autoarima, h=5, c=(0.95)) > plot.forecast(ForecastAutoArima) > > [[alternative HTML version deleted]] > > ______________________________________________ > 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]]