Мне интересно применить подход сверху вниз, как показано ниже https://otexts.com/fpp2/top-down.html
y <- ts(matrix(rnorm(900),ncol=45,nrow=20))
blnames <- paste(c(rep("A",20),rep("B",25)), # State
rep(1:9,each=5), # County
rep(c("X","X","X","Y","Y"),9), # Industry
rep(c("a","b","c","a","b"),9), # Sub-industry
sep="")
colnames(y) <- blnames
gy <- gts(y, characters=list(c(1,1),c(1,1)))
gps <- rbind(
c(rep(1,20),rep(2,25)), # State
rep(1:9,each=5), # County
rep(c(1,1,1,2,2),9), # Industry
rep(1:5, 9), # Sub-industry
c(rep(c(1,1,1,2,2),4),rep(c(3,3,3,4,4),5)), # State x industry
c(rep(1:5, 4),rep(6:10, 5)), # State x Sub-industry
rep(1:18, rep(c(3,2),9)) # County x industry
)
gy <- gts(y, groups=gps)
forecast(gy, method="tdgsa", fmethod="arima")# top down gross sohl method a
Я пытался выяснить, как определить строгую иерархию, но, похоже, нет примеров того, как его создать. При попытке применить метод сверху вниз я получу следующую ошибку.
> forecast(gy, method="tdgsa", fmethod="arima")# top down gross sohl method a
Error: Argument method is not appropriate for a non-hierarchical time series.