Ceci est un long post, donc j'espère que vous pourrez me supporter, et veuillez me corriger là où je me trompe.
Mon objectif est de produire une prévision quotidienne basée sur 3 ou 4 semaines de données historiques.
Les données sont des données de 15 minutes de la charge locale d'une des lignes d'un transformateur. J'ai du mal à trouver l'ordre du modèle d'un processus ARIMA saisonnier. Considérez la série chronologique de la demande d'électricité:
Série chronologique originale http://i.share.pho.to/80d86574_l.png
Lorsque les 3 premières semaines sont prises comme sous-ensemble et différenciées, les parcelles ACF / PACF suivantes sont calculées:
Sous-ensemble http://i.share.pho.to/5c165aef_l.png
Première différence http://i.share.pho.to/b7300cc2_l.png
Saisonnier et première différence http://i.share.pho.to/570c5397_l.png
On dirait que la série est un peu stationnaire. Mais la saisonnalité pourrait aussi être hebdomadaire (voir la semaine des différences saisonnières et les différences de second ordre [ici] http://share.pho.to/3owoq , qu'en pensez-vous?)
Series: x
ARIMA(0,1,4)(0,1,1)[96]
Coefficients:
ma1 ma2 ma3 ma4 sma1
-0.2187 -0.2233 -0.0996 -0.0983 -0.9796
s.e. 0.0231 0.0234 0.0257 0.0251 0.0804
sigma^2 estimated as 364612: log likelihood=-15138.91
**AIC=30289.82 AICc=30289.87 BIC=30323.18**
The auto.arima function computes the following model (with stepwise and approximation on TRUE, else it takes to long to converge):
Series: x
ARIMA(1,1,1)(2,0,2)[96]
Coefficients:
ar1 ma1 sar1 sar2 sma1 sma2
0.7607 -1.0010 0.4834 0.4979 -0.3369 -0.4168
s.e. 0.0163 0.0001 0.0033 0.0116 0.0216 0.0255
sigma^2 estimated as 406766: log likelihood=-15872.02
**AIC=31744.99 AICc=31745.05 BIC=31784.25**
Which means no seasonal differencing is applied. Here are the residuals of the both models. The Ljung Box statistic give a very small p value, indicating that there is still some autocorrelation present (? correct me if im wrong).
Forecasting
Thus to determine which is better, an out-sample accuracy test is then the best. So for both models an forecast is made 24 hours ahead which is compared with each other. The results are: auto.arima http://i.share.pho.to/5d1dd934_l.png manual model http://i.share.pho.to/7ca69c97_l.png
Auto:
ME RMSE MAE MPE MAPE MASE ACF1 Theil's U
Training set -2.586653 606.3188 439.1367 -1.284165 7.599403 0.4914563 -0.01219792 NA
Test set -330.144797 896.6998 754.0080 -7.749675 13.268985 0.8438420 0.70219229 1.617834
Manual
ME RMSE MAE MPE MAPE MASE ACF1 Theil's U
Training set 2.456596e-03 589.1267 435.6571 -0.7815229 7.509774 0.4875621 -0.002034122 NA
Test set 2.878919e+02 919.7398 696.0593 3.4756363 10.317420 0.7789892 0.731013599 1.281764
Questions
As you can think of this is an analysis on the first three weeks of a dataset. I'm struggling in my mind with the following questions:
- How do I select the best ARIMA model (by trying all different orders and checking the best MASE/MAPE/MSE? where the selection of performance measurement can be a discussion in it's own..)
- If I generate a new model and forecast for every new day forecast (as in online forecasting), do I need to take the yearly trend into account and how? (as in such a small subset my guess would be that the trend is neglible)
- Would you expect that the model order stays the same throughout the dataset, i.e. when taking another subset will that give me the same model?
- What is a good way, within this method to cope with holidays? Or is ARIMAX with external holiday dummies needed for this?
- Do I need to use Fourier series approach to try models with
seasonality=672
as discussed in Long seasonal periods ? - If so would this be like
fit<-Arima(timeseries,order=c(0,1,4), xreg=fourier(1:n,4,672)
(where the function fourier is as defined in Hyndman's blog post) - Are initial P and Q components included with the fourier series?
Most theoretical knowledge obtained from FPP, great stuff!
Before advising on using exponential smoothing or (dynamic)linear regression this is also being worked on to compare.
Data
https://www.dropbox.com/sh/mzx61sskya5ze6x/Zq3A7Q6htH/trafo.txt
Code
data<-read.csv("file", sep=";")
load<-data[,3]
I removed the few zero values with week before values
stepback<-672
load[is.na(load)] <- 0 # Assumed no 0's in first 672 values!
idx <- which(load == 0)
idx <- idx[which(idx>stepback)]
load[idx] <- load[idx-stepback]
ED<-ts(load,start=0, end=c(760,96),frequency=96)
x<-window(ED,start=0, end=c(20,96))
It is also possible to post a reproducible example but this will make the post even longer, but possible if needed. So if there is anything I should provide please let me know.
la source