How to model seasonal data using GLM.jl

I would like to model some data that exhibits strong hourly seasonality.
Additionally the data depends on the ambient temperature and if it is a holiday or workday.

@formula(y ~ 1 + T_amb + T_amb^2 + hour_of_day(t))

One option would be to encode the hour of day in a set of dummy variables or to use a Fourier approach.
Additionally I want to switch the hour of day model if it is a holiday or workday.

@formula(y ~ 1 + T_amb + T_amb^2 + hour_of_day_holiday(t) + hour_of_day_workday(t))

How would I do that?
Is there an easier way to include such a switch?

1 Like

It should be something like this:

GLM.@formula(y ~ T_amb + hour + hour&holiday)
1 Like

The Fourier approach is described here: https://github.com/JuliaStats/StatsModels.jl/issues/130

1 Like