The recommended forecast method for daily data from the Hyndman textbooks is tbats
. For a daily time series, you'd probably want to include both weekly (period 7) and annual (period 365.25) seasonality. The forecast
package includes both a data type for time series with multiple periods of seasonality msts
and the tbats
forecast method.
If you wanted a simpler approach, you could just ditch the annual seasonality and include the weekly with ts
and ets
. If your data is very sparse or noisy, this might be better.
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library(tidyverse)
# define some time series data
d <- tibble(
x = 1:(365*2),
y = 5 + sin(x*2*pi/7) + 0.5*sin(x*2*pi/365.25) + runif(length(x)),
# multiple period ts
ser2 = msts(y, seasonal.periods = c(7, 365.25), start = 2019),
# single period ts
ser1 = ts(y, frequency = 7)
)
# plot the time series
# not sure why the annual seasonality doesn't appear in the PACF at lag 365...
ggtsdisplay(d$ser2, lag.max = 371)
#> Warning in periods * seq(-20:20): longer object length is not a multiple of
#> shorter object length
#> Warning in periods * seq(-20:20): longer object length is not a multiple of
#> shorter object length

# fit a tbats model and make a forecast
model <- tbats(d$ser2)
forec <- forecast(model, h = 60)
autoplot(forec) + coord_cartesian(xlim = c(2020.8, NA))

# simpler approach is to ignore annual seasonality just fit ets with weekly seasonality
ets(d$ser1) %>% forecast(h = 60) %>% autoplot() + coord_cartesian(xlim = c(100, NA))

Created on 2021-05-31 by the reprex package (v1.0.0)