[R] Package forecast
Joao Santos
jcsantos at student.dei.uc.pt
Wed Oct 24 17:04:43 CEST 2007
Hello All,
I trying to use the function auto.arima(....) from package forecast but I
have a problem.
My steps after I used the function auto.arima(...)
I create the time series like this:
>bbrass = scan("C:/Program Files/R/data PTIN/my_file.dat")
>regts.start = ISOdatetime(2006, 7, 1, hour=0, min=0, sec=0, tz="GMT") #2006
07 01 00
>regts.end = ISOdatetime(2006, 7, 22, hour=2, min=0, sec=0, tz="GMT") #2006
07 22 02
>regts.zoo <- zooreg(bbrass, regts.start, regts.end, deltat=3600)
>regts.hour <- zoo(coredata(regts.zoo), as.numeric(time(regts.zoo))/(3600))
>regts.ts <- as.ts(regts.hour)
>regts.ts
>Time Series:
Start = 319920
End = 321439
Frequency = 1
[1] 61 60 60 59 58 58 58 58 58 61 64 65 65 64 64 64 63 63 62 61 60 60 60
59
[25] 58 58 58 57 57 57 57 56 57 57 58 59 59 59 60 60 60 61 60 60 60 60 60
59
......
My data is seasonal(repeat every weak) and I get values every hour. I'm
using arima function from package stats like this:
>bb.fit = arima(regts.ts, order=c(3,0,0), seasonal=list(order=c(0,1,0),
period=168)) #period=24(hours)*7(days)=168(values)
Series: regts.ts
ARIMA(0,1,0)(0,1,0)[168]
sigma^2 estimated as 6.138: log likelihood = -2783.19
AIC = 5568.37 AICc = 5568.37 BIC = NaN
#I going changing the values of p,d and q and select the one with the small
value of AIC.
Then I find the package forecast and the function auto.arima, but my problem
is that when I use this function the result is this I don't have the
seasonal part:
>fit<-auto.arima(regts.ts, d = NA, D = NA, max.p = 3, max.q = 3,
+ max.P = 2, max.Q = 2, max.order = 5,
+ start.p=0, start.q=0, start.P=0, start.Q=0,
+ stationary = FALSE, ic = c("aic","aicc", "bic"),
+ stepwise=TRUE, trace=TRUE)
ARIMA(0,1,0) with drift : 6178.487
ARIMA(0,1,0) with drift : 6178.487
ARIMA(1,1,0) with drift : 5467.095
ARIMA(0,1,1) with drift : 5571.326
ARIMA(2,1,0) with drift : 5419.149
ARIMA(2,1,1) with drift : 5420.55
ARIMA(3,1,1) with drift : 5422.054
ARIMA(2,1,0) : 5416.789
ARIMA(1,1,0) : 5464.839
ARIMA(3,1,0) : 5417.929
ARIMA(2,1,1) : 5418.177
ARIMA(3,1,1) : 5419.681
Best model: ARIMA(2,1,0)
Another problem in arima(....) is because I've NA values and I want to plot
the fitted model with the values created for filling the NA's.
I used na.interp(regts.ts) but the seasonality vanish.
ex:bb.fit <- arima(na.interp(regts.ts), order=c(3,0,0),
seasonal=list(order=c(0,1,0), period=168, method = "ML"))
Any ideas to solve this problems?
Sorry the big mail but I don't find other way to explain my problem.
Thanks in advance,
João Santos
--
View this message in context: http://www.nabble.com/Package-forecast-tf4684066.html#a13384789
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list