I'm trying to forecast data that has an hourly and weekly pattern. The model I made using predictors created using seasonaldummy does a nice job of picking up the hourly weekly pattern, but it takes a long time to train the model. I tried to create a similar forecast using fourier function, but it doesn't seem to be picking up the hourly pattern as well. Am I setting up fourier correctly to try to achieve the effect I've gotten with seasonaldummy? Should the frequency in ts be something other than 168? My data is hourly. I've provided some sample data below.
My end goal is to combine the predictors for the hourly weekly pattern with other predictors, that's why I'm not just using tbats. I've provided examples below of how I'm trying to combine dummy variables for the hourly weekly pattern with other predictors.
Code:
##BoxCox
TTTlambda <- BoxCox.lambda(tsData)
##Partitioning Time Series
EndTrain<-1344
ValStart<-EndTrain+1
ValEnd<-ValStart+336
tsTrain <-tsData[1:EndTrain]
tsValidation<-tsData[ValStart:ValEnd]
tsTest <- tsData[TestStart:TestEnd]
##Predictors
xregTrain<-dfPredictors[1:EndTrain,]
xregVal<-dfPredictors[ValStart:ValEnd,]
xregTest<-dfPredictors[TestStart:TestEnd,]
##Seasonal Dummies
x=ts(tsData,freq=168)
dummies=seasonaldummy(x)
xreg2Train<-dummies[1:EndTrain,]
xreg2Val<-dummies[ValStart:ValEnd,]
xreg2Test<-dummies[TestStart:TestEnd,]
##Fourier Terms
tsTTT<-ts(tsData, freq=168)
bestfit <- list(aicc=Inf)
for(i in 1:25)
{
fit <- auto.arima(tsTTT, xreg=fourier(tsTTT, K=i), seasonal=FALSE)
if(fit$aicc < bestfit$aicc)
bestfit <- fit
else break;
}
bestfit$coef ## K=2
xreg3<-fourier(tsTTT,2)
xreg3Train<-xreg3[1:EndTrain,]
xreg3Val<-xreg3[ValStart:ValEnd,]
xreg3Test<-xreg3[TestStart:TestEnd,]
##hourly weekly
Arima.fit_D <- auto.arima(tsTrain, lambda = TTTlambda, xreg=xreg2Train, stepwise=FALSE, approximation = FALSE, seasonal = FALSE )
Arima.fit_D_P <- auto.arima(tsTrain, lambda = TTTlambda, xreg=cbind(xreg2Train,xregTrain$Predictor), stepwise=FALSE, approximation = FALSE, seasonal = FALSE )
##Fourier hourly weekly
Arima.fit_F <- auto.arima(tsTrain, lambda = TTTlambda, xreg=xreg3Train, stepwise=FALSE, approximation = FALSE, seasonal = FALSE )
Arima.fit_F_P <- auto.arima(tsTrain, lambda = TTTlambda, xreg=cbind(xreg3Train,xregTrain$Predictor), stepwise=FALSE, approximation = FALSE, seasonal = FALSE )
##Forecast Model
Acast_D<-forecast(Arima.fit_D,xreg=xreg2Val, h=336)
Acast_D_P<-forecast(Arima.fit_D_P,xreg=cbind(xreg2Val,xregVal$Predictor), h=336)
Acast_F<-forecast(Arima.fit_F,xreg=xreg3Val, h=336)
Acast_F_P<-forecast(Arima.fit_F_P,xreg=cbind(xreg3Val,xregVal$Predictor), h=336)
Data:
dput(tsData[1:1681])
c(11, 14, 17, 5, 5, 5.5, 8, NA, 5.5, 6.5, 8.5, 4, 5, 9, 10, 11, 7, 6, 7, 7, 5, 6, 9, 9, 6.5, 9, 3.5, 2, 15, 2.5, 17, 5, 5.5, 7, 6, 3.5, 6, 9.5, 5, 7, 4, 5, 4, 9.5, 3.5, 5, 4, 4, 9, 4.5, 6, 10, NA, 9.5, 15, 9, 5.5, 7.5, 12, 17.5, 19, 7, 14, 17, 3.5, 6, 15, 11, 10.5, 11, 13, 9.5, 9, 7, 4, 6, 15, 5, 18, 5, 6, 19, 19, 6, 7, 7.5, 7.5, 7, 6.5, 9, 10, 5.5, 5, 7.5, 5, 4, 10, 7, 5, 12, 6, NA, 4, 2, 5, 7.5, 11, 13, 7, 8, 7.5, 5.5, 7.5, 15, 7, 4.5, 9, 3, 4, 6, 17.5, 11, 7, 6, 7, 4.5, 4, 4, 5, 10, 14, 7, 7, 4, 7.5, 11, 6, 11, 7.5, 15, 23.5, 8, 12, 5, 9, 10, 4, 9, 6, 8.5, 7.5, 6, 5, 8, 6, 5.5, 8, 11, 10.5, 4, 6, 7, 10, 11.5, 11.5, 3, 4, 16, 3, 2, 2, 8, 4.5, 7, 4, 8, 11, 6.5, 7.5, 17, 6, 6.5, 9, 12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5, 6, 10, 4.5, 4, 7, 7.5, 7, 4, 10, 6.5, 6, 10)
dput(dfPredictors$Predictor[1:1681])
c(2, 6, 3, 5, 3, 2, 2, NA, 2, 6, 12, 11, 9, 10, 13, 9, 11, 7, 12, 8, 6, 4, 10, 6, 2, 7, 2, 1, 3, 2, 1, 3, 8, 7, 7, 8, 13, 13, 13, 11, 12, 4, 12, 18, 12, 7, 5, 4, 6, 4, 3, 3, NA, 4, 2, 8, 8, 8, 7, 3, 5, 3, 7, 8, 7, 7, 11, 8, 10, 3, 10, 6, 5, 5, 3, 1, 2, 1, 1, 3, 4, 8, 8, 5, 9, 12, 12, 11, 8, 5, 9, 10, 7, 8, 4, 6, 4, 1, 3, 1, 3, NA, 2, 1, 4, 10, 7, 13, 6, 9, 6, 16, 12, 11, 10, 12, 9, 7, 7, 7, 6, 2, 3, 1, 1, 2, 2, 3, 11, 10, 9, 8, 9, 13, 6, 6, 10, 9, 11, 10, 8, 7, 6, 4, 2, 3, 5, 3, 2, 4, 4, 4, 8, 5, 12, 8, 7, 12, 9, 12, 12, 12, 13, 12, 9, 8, 9, 10, 4, 7, 4, 2, 2, 4, 1, 7, 6, 6, 8, 11, 11, 5, 7, 6, 9, 12, 15, 9, 11, 5, 10, 5, 4, 4, 2, 3, 3, 2, 5, 4, 7, 8, 6, 6, 5, 12, 10, 8, 10, 10, 4, 13, 12, 6, 8, 6, 3, 1, 4, 2, NA, 4, 3, 2, 6, 5, 8, 10, 4, 13, 2, 13, 8, 11, 13, 8, 9, 10, 9, 5, 1, NA, 1, 1, 2, NA, 1, 7, 6, 10, 7, 8, 12, 12, 9, 5, 6, 8, 13, 13, 13, 8, 8, 1, 5, 7, 6, 2, NA, 2, 1, 2, 7, 9, 12, 12, 10, 10, 10, 6, 8, 2, 8, 3, 4, 5, 6, 2, 2, 1, 4, 1, NA, 3, 1, 3, 8, 8, 11, 11, 12, 5, 7, 14, 9, 10, 14, 11, 8, 6, 8, 7, 5, 4, 3, 4, 9, NA, 2, 4, 5, 8, 2, 12, 8, 15, 12, 8, 9, 12, 9, 9, 12, 7, 7, 8, 7, 5, 4, NA, 1, NA, NA, 4, 9, 8, 8, 8, 12, 13, 7, 11, 8, 14, 12, 13, 15, 8, 6, 4, 4, 5, 2, NA, 2, 5, 4, 5, 6, 15, 11, 10, 16, 10, 5, 5, 10, 13, 10, 9, 8, 7, 5, 4, 5, 6, NA, 2, 5, 4, 1, 6, 5, 8, 4, 3, 10, 11, 8, 12, 10, 10, 10, 12, 10, 10, 7, 5, 7, 3, 4, 3, 3, 3, 3, 8, 4, 8, 10, 5, 10, 10, 10, 11, 10, 11, 7, 10, 7, 6, 7, 7, 3, 3, NA, 3, 6, 5, 3, 3, 5, 6, 6, 13, 14, 14, 7, 13, 9, 10, 4, 9, 10, 8, 3, 6, 10, 5, 2, 1, NA, 3, 4, 4, 12, 12, 11, 12, 11, 13, 10, 9, 11, 11, 14, 10, 13, 10, 7, 11, 1, 3, 1, 4, 1, 2, 2, 3, 9, 6, 9, 9, 8, 9, 7, 12, 17, 13, 9, 10, 8, 8, 10, 2, 3, 3, 6, 2, 2, 1, 6, 8, 7, 9, 5, 11, 8, 8, 12, 13, 14, 10, 7, 5, 11, 11, 8, 5, 7, 3, 2, 3, 5, NA, 1, 3, 3, 4, 9, 12, 12, 3, 5, 12, 10, 9, 14, 15, 12, 7, 8, 7, 3, 4, 1, 5, 6, 4, NA, 5, 9, 6, 7, 8, 15, 13, 9, 12, 9, 7, 7, 6, 7, 8, 8, 6, 4, 5, 4, 1, 5, 1, NA, 5, 4, 12, 7, 20, 12, 14, 10, 11, 11, 12, 6, 6, 11, 5, 6, 7, 4, 7, 5, 1, 2, NA, 2, 7, 16, 9, 4, 12, 14, 12, 9, 8, 12, 7, 6, 11, 9, 15, 9, 4, 4, 3, 3, 2, 5, 2, 1, 6, 8, 3, 12, 11, 14, 9, 6, 3, 12, 11, 10, 14, 10, 10, 12, 2, 3, 3, 5, 3, 2, 3, 3, 5, 9, 5, 10, 14, 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apr 08 '16 at 18:40How much data should you train an Arima model on if it has a weekly and hourly pattern, to forecast 20 hours?
Do you know a process for finding good predictors to use in the xreg argument? So far I've been adding predictors, then looking at AICc, ACF plots of residuals, ACCURACY measures (ME, RMSE, MAPE..), and comparing the forecast plot to the actual data. I was wondering what kind of exploratory steps I could do to find predictors to add to the model.
- If you are manually fitting an Arima model how do you select models when both ACF and PACF are sinusoidal?
– ndderwerdo Apr 08 '16 at 18:40- The post below suggests that the Ljung-Box test shouldn't be used to check auto correlation in Arima models. Do you agree? Post: http://stats.stackexchange.com/questions/148004/testing-for-autocorrelation-ljung-box-versus-breusch-godfrey
– ndderwerdo Apr 08 '16 at 18:41test<-ts(tsData, frequency=168)
product.outlier<-tso(test,types=c("AO","LS","TC"))
Error in filter_(.data, .dots = lazyeval::lazy_dots(...)) : argument ".data" is missing, with no default In addition: Warning message: In auto.arima(x = c(11, 14, 17, 5, 5, 5.5, 8, NA, 5.5, 6.5, 8.5, : Unable to fit final model using maximum likelihood. AIC value approximated
– ndderwerdo Apr 08 '16 at 18:45