Problème de définition de l'ordre ARIMA


16

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?)

UNERjeMUNE(p,1,q)(P,1,Q)96

ARIMA(0,1,4)(0,1,1)96
with

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):

ARIMA(1,1,1)(2,0,2)96
with

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:

  1. 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..)
  2. 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)
  3. 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?
  4. What is a good way, within this method to cope with holidays? Or is ARIMAX with external holiday dummies needed for this?
  5. Do I need to use Fourier series approach to try models with seasonality=672 as discussed in Long seasonal periods ?
  6. 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)
  7. 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.

Réponses:


9
  1. 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..)

Out of sample risk estimates are the gold standard for performance evaluation, and therefore for model selection. Ideally, you cross-validate so that your risk estimates are averaged over more data. FPP explains one cross-validation method for time series. See Tashman for a review of other methods:

Tashman, L. J. (2000). Out-of-sample tests of forecasting accuracy: an analysis and review. International Journal of Forecasting, 16(4), 437–450. doi:10.1016/S0169-2070(00)00065-0

Of course, cross-validation is time consuming and so people often resort to using in-sample criteria to select a model, such as AIC, which is how auto.arima selects the best model. This approach is perfectly valid, if perhaps not as optimal.

  1. 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)

I'm not sure what you mean by yearly trend. Assuming you mean yearly seasonality, there's not really any way to take it into account with less than a year's worth of data.

  1. 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?

I would expect that barring some change to how the data are generated, the most correct underlying model will be the same throughout the dataset. However, that's not the same as saying that the model selected by any procedure (such as the procedure used by auto.arima) will be the same if that procedure is applied to different subsets of the data. This is because the variability due to sampling will result in variability in the results of the model selection procedure.

  1. What is a good way, within this method to cope with holidays? Or is ARIMAX with external holiday dummies needed for this?

External holiday dummies is the best approach.

  1. Do I need to use Fourier series approach to try models with seasonality=672 as discussed in Long seasonal periods?

You need to do something, because as mentioned in that article, the arima function in R does not support seasonal periods greater than 350. I've had reasonable success with the Fourier approach. Other options include forecasting after seasonal decomposition (also covered in FPP), and exponential smoothing models such as bats and tbats.

  1. 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)

That looks correct. You should experiment with different numbers of terms. Note that there is now a fourier function in the forecast package with a slightly different specification that I assume supersedes the one on Hyndman's blog. See the help file for syntax.

  1. Are initial P and Q components included with the fourier series?

I'm not sure what you're asking here. P and Q usually refer to the degrees of the AR and MA seasonal components. Using the fourier approach, there are no seasonal components and instead there are covariates for fourier terms related to season. It's no longer seasonal ARIMA, it's ARIMAX where the covariates approximate the season.

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.