How can i forecast with same accuracy in GRETL and R

93 views Asked by At

My timeseries comes from the datasets package. It is called "USAccDeaths".

     Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov   Dec
1973  9007  8106  8928  9137 10017 10826 11317 10744  9713  9938  9161  8927
1974  7750  6981  8038  8422  8714  9512 10120  9823  8743  9129  8710  8680
1975  8162  7306  8124  7870  9387  9556 10093  9620  8285  8466  8160  8034
1976  7717  7461  7767  7925  8623  8945 10078  9179  8037  8488  7874  8647
1977  7792  6957  7726  8106  8890  9299 10625  9302  8314  8850  8265  8796
1978  7836  6892  7791  8192  9115  9434 10484  9827  9110  9070  8633  9240

When I make an out of sample forcast in GRETL i get the follwoing: enter image description here

However, when i make the same forecast in R, my results differ subtantially. This is my r code:

    library(forecast)
fit <- arima(USAccDeaths[1:60], order = c(1,1,0), method = "ML")
preds <- as.vector(forecast(fit, h = 12))$mean
RMSE <- sqrt(mean((preds - as.vector(USAccDeaths[61:72])) ^ 2))
RMSE

I get an RMSE of 946.024. This is my predictions in R:

[1] 8803.104 8803.199 8803.201 8803.201 8803.201 8803.201 8803.201 8803.201 8803.201
[10] 8803.201 8803.201 8803.201here

What is the problem? How can I get the same results in both programs?

0

There are 0 answers