Solved – Adjusting daily time series data for the seasonal component

armarseasonalitytime series

I have a time series data containing roughly 13 000 daily observations, and the initial plan is to fit them to an ARMA model. I have adjusted the data for deterministic trend with a regression model, which basically did nothing to the data.
enter image description here
One thing the data suffers from is a strong seasonal effect, and I need to adjust for that in order to estimate the ARMA model, and get the white noise from the residuals.

My big problem, and the reason I'm looking for help is because I don't know how to handle the seasonal component. I would like to keep the data in a daily solution since the point with the time series is to be able to model daily changes in weather conditions. But to differentiate the season with a period of 365 is not only impossible in R, but also not theoretical sound, since I would compare the seasonal effect of separate days.

So… does anyone have any idea of what to do when you don't want to do a seasonal adjustment of 12 months or 4 quarters, or should I simply give up the thought of an ARMA model with daily data? It is simple to model the time series with monthly data, but it sort of defeats the purpose of the project.

Best Answer

It's probably best to do a standard STL (Season, Trend, Level) decomposition. Here is what you'd do with dummy data:

set.seed(1)
series <- ts(sin((1:13000)*2*pi/365)+rnorm(13000),frequency=365)
foo <- stl(series,s.window="periodic")
plot(foo)

STL

Note that "Time" here is in years, and that this algorithm already accounts for the trend, so you don't need to extract that beforehand.

Afterwards, you can extract the components from foo$time.series, for example foo$time.series[,"remainder"] for the residuals.

An alternative would be exponential smoothing or an equivalent state space model, but forecast::ets also doesn't work with frequencies greater than 24.

You may want to look through some of our earlier questions on daily time series.