## 12.4 Dealing with daylight saving and leap years

Another problem that arises in the case of data with high frequency is the change of local time due to daylight saving (DST). This happens in some countries two times a year: in Spring, the time is moved one hour forward (typically at 1 am to 2 am), while in the Autumn, it is moved back one hour. The implications of this are terrifying from a forecasting point of view because one day of the year has 23 hours, while the other has 25 hours. This leads to modelling difficulties because all the business processes are typically aligned with the local time. This means that if the conventional seasonal ETS model with $$m=24$$ fits the data, it will only work correctly in half of the year. If the smoothing parameter $$\gamma$$ is high enough then after the DST change, the model will eventually adapt to the new patterns, but this implies that $$\gamma$$ is higher than needed, introducing unnecessary reactivity in the model.

There are two solutions to this problem:

1. Shift the periodicity for one day, when the time changes from 24 to either 23, or 25, depending on the time of year;
2. Introduce categorical variables for factors, which will mark specific hours of the day;

The former is more challenging to formalise mathematically and implement in software, but does not require estimation of additional parameters. The latter relies on the already discussed mechanism of ETSX{D} with categorical variables (Section 10.5) and is in general simpler. Given the connection between seasonality in the conventional ETS model and the ETSX{D} with categorical variables for seasonality, both approaches should be equivalent in terms of final forecasts.

Another problem in the high frequency data is the leap years. It can also be solved shifting the periodicity from $$m=365$$ to $$m=366$$ on 29th February in the spirit of option (1) or using the categorical variables approach (2). There is a difference, however: the latter assumes the estimation of an additional parameter, while the former would be suitable for the data with only one leap year in the data, where the estimation of the seasonal index for 29th February might be difficult. However, given the discussion in Section 12.3, maybe we should not bother with $$m=365$$ in the first place and rethink the problem, if possible. Having 52 / 53 weeks in a year has similar difficulties but at least does not involve the estimation of so many initial seasonal states.

Finally, De Livera (2010) proposed to tackle the problem of leap years introducing the fractional seasonality via Fourier series. The model that implements this is called TBATS (it is an exponential smoothing state space model with Box-Cox transformation, ARMA errors, Trend and Seasonal components, De Livera et al., 2011). While this resolves the aforementioned problem with leap years, the approach introduces an additional complexity, because the analyst needs to define the suitable number of harmonics to use, which is in general not straightforward.

Summarising, when trying to resolve the problem with DST and leap years, there are several possible solutions, each one of them having advantages and drawbacks. In order to decide, which should be used in the end, it makes sense to try out several of them and select the one that works better (e.g. produces lower forecast errors).

### References

• De Livera, A.M., 2010. Exponentially weighted methods for multiple seasonal time series. International Journal of Forecasting. 26, 655–657. https://doi.org/10.1016/j.ijforecast.2010.05.010
• De Livera, A.M., Hyndman, R.J., Snyder, R.D., 2011. Forecasting Time Series With Complex Seasonal Patterns Using Exponential Smoothing. Journal of the American Statistical Association. 106, 1513–1527. https://doi.org/10.1198/jasa.2011.tm09771