简体   繁体   中英

How to forecast time series for many products, including a seasonality factor in R

Following my previous question with one product to forecast, lets say I have 5 products to forecast as in the following data:

 units_vector <- c(89496264,81820040,80960072,109164545,96226255,96270421,95694992,117509717,105134778,0)
library(data.table)
dt <- data.table('time' = rep(c(1:10),3),
                 'units'= c(units_vector,units_vector+runif(n = 10, max = 1000000),units_vector+runif(n = 10, max = 1000000)),
                 'product' = c(rep("A", 10),rep("B", 10),rep("C", 10))
)

I would like to forecast the units for time = 10 for all product s.

I can see that at time = 4*k , where k = 1,2,... there is a big increase of units, and I would like to include that as a seasonality factor.

How could I do that in R ? Maybe with prophet ? Any other library or way will also do.

你做的一样:拟合模型y = a*season + bb = p(product)根据产品和a (如果假设季节性的所有产品一样)相等的所有产品。

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