px <- seq(as.POSIXct('1949-01-01'),
as.POSIXct('1960-12-01'), by = 'month')
d0 <- data.frame(px, y = AirPassengers)
head(d0)
## px y
## 1 1949-01-01 112
## 2 1949-02-01 118
## 3 1949-03-01 132
## 4 1949-04-01 129
## 5 1949-05-01 121
## 6 1949-06-01 135
library('forecast')
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
s <- mstl(x = msts(d0$y, seasonal.period = c(12, 12*7)),
s.window = 'periodic')
## Warning in mstl(x = msts(d0$y, seasonal.period = c(12, 12 * 7)), s.window =
## "periodic"): Dropping seasonal components with fewer than two full periods.
autoplot(s, main = '周期成分:時間変動なし')

s <- mstl(x = msts(d0$y, seasonal.period = c(24, 24*7)))
## Warning in mstl(x = msts(d0$y, seasonal.period = c(24, 24 * 7))): Dropping
## seasonal components with fewer than two full periods.
autoplot(s, main = '周期成分:時間変動あり')
