1
$\begingroup$

I have researched multiple related questions(here, here) but it lacks detailed context and solutions.

My goal is to improve my daily sales forecast accuracy after having incorporated a simple holiday dummy for lunar new year.

y <- msts(train$Sales, seasonal.periods=c(7,365.25))
# precomputed optimal fourier terms
bestfit$i <- 3
bestfit$j <- 20
z <- fourier(y, K=c(bestfit$i, bestfit$j))
fit <- auto.arima(y, xreg=cbind(z,train_df$cny), seasonal=FALSE)
# forecasting
horizon <- length(test_ts)
zf <- fourier(y, K=c(bestfit$i, bestfit$j), h=horizon)
fc <- forecast(bestfit, xreg=cbind(zf,test_df$cny), h=horizon)
plot(fc, include=365, type="l", xlab="Days", ylab="Sales", main="Comparing arimax forecast and actuals")
lines(test_ts, col='green')

ARIMAX forecast

However, this does not reflect the lagged effect of the holiday.

Impact on sales around lunar new year

An approach will be to model the effects with a continuous variable(fitted to the effect curve above), but will like to heard other suggestions.

$\endgroup$
  • $\begingroup$ Why is the seasonal flag set to False? $\endgroup$ – yoav_aaa Jul 12 '16 at 11:20
  • $\begingroup$ I based it off here, the Fourier term is used to model the seasonality outside of arima function. $\endgroup$ – zlace Jul 12 '16 at 13:18
  • $\begingroup$ You are doing regression with ARIMA errors, not ARIMAX; see "The ARIMAX model muddle" by Rob J. Hyndman. $\endgroup$ – Richard Hardy Jul 12 '16 at 19:13
0
$\begingroup$

You could

  1. include a number of dummies for the dates around the lunar new year; or
  2. do as you said (fit a curve).

The first option allows for a lot of flexibility, but that might lead to overfitting. If you have a low number of years in your sample, 1. would probably introduce quite a lot of noise extra to reflecting any signal. It could be nice to apply some form of regularization (shrinkage) to prevent overfitting, but that would be technically challenging.

The second option is less flexible and you need to decide on the functional form, but it is less prone to overfitting.

Thansfer function modelling could probably be a good idea, but I cannot say much about it from my own experience.

$\endgroup$
  • $\begingroup$ Transfer Function modelling would be a good idea . $\endgroup$ – IrishStat Jul 12 '16 at 21:16
0
$\begingroup$

Some points that might help you. 1) Fourier approaches inject structure into the forecasts that might not be present in the data but induced by the equation. You should examine the model residuals carefully 2) One needs to detect the optimal lead and lag around each possible holiday/event and develop a model that includes these effects. As usual there may also be monthly effects/level shift effects/multiple trends as well as anomalous observations. Additionally certain days of the month may be special and even week-in-the-month may play a role. I have implemented a lot of this pre-testing into a commercial package called AUTOBOX which was cited by @forecaster in one of your citataions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.