简体   繁体   中英

continue seasonality of time series from forecast stl decomposition

The stl function in the stats package decomposes a time series into seasonal, trend, and remainder:

sstl <- stl(ts(rnorm(100), frequency=12), "period")
plot(sstl)

在此处输入图片说明

The seasonality is a regular pattern, how can I continue this pattern for the next 50 data points?

You could extract the unique values of the seasonal component and then use rep_len to create a vector of length 150 as follows

rep_len(unique(sstl$time.series[, "seasonal"]), length.out = 150)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM