Dear R users,

I am having a problem using forecast.Arima fuction. Here is the whole code:

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)
        Augmented Dickey-Fuller Test

data:  lnD3
Dickey-Fuller = -3.5315, Lag order = 3, p-value = 0.05795
alternative hypothesis: stationary

#########d parameter is determined by ADF test, which is 3#############

Now choosing p and q parameters

par(mfrow=c(2,1))
acf(lnD3, lag.max=20)
pacf(lnD3, lag.max=20)

######### from acf and pacf, p=2, q=1##############

Now fitting Arima

arima1=arima(lnD3, order=c(2,0,1))
arima1
Series: x
ARIMA(2,0,1) with non-zero mean

Coefficients:
          ar1      ar2      ma1  intercept
      -0.5189  -0.2033  -1.0000     -1e-04
s.e.   0.1806   0.1770   0.0993      5e-04

sigma^2 estimated as 0.00118:  log likelihood=54.24
AIC=-100.48   AICc=-97.87   BIC=-93.64

####### Which looks good#########

Using auto.arima() to see what R have in mind

autoarima=auto.arima(lnD, d=3)
autoarima
Series: lnD
ARIMA(2,3,0)

Coefficients:
          ar1      ar2
      -1.0282  -0.5851
s.e.   0.1524   0.1560

sigma^2 estimated as 0.001731:  log likelihood=50.37
AIC=-94.73   AICc=-93.77   BIC=-90.63

###### From AIC and BIC, I prefer arima1 instead of autoarima######
Now using forecast.Arima

forecastArima1=foreca.Arima(arima1, h=5)
*Warining message
Error in ts(x) : 'ts' object must have one or more observations*

But forecasting autoarima is no problem
forecastAutoArima=forecast.Arima(autoarima, h=5, c=(0.95))
forecastAutoArima

     Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
2013       7.084688 7.031373 7.138004 7.003150 7.166227
2014       7.167079 7.049206 7.284951 6.986808 7.347349
2015       7.285478 7.069813 7.501142 6.955648 7.615308
2016       7.443636 7.085484 7.801789 6.895890 7.991383
2017       7.618670 7.081729 8.155612 6.797489 8.439852

Why???? Is there a bug probelm with arima() function itself???

If anyone knows the problem, or shows me a right direction, I would really
appreciate it!!!
Many many thanks!!!

Chintemur Batur

        [[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.

Reply via email to