我想绘制一个从 2019 年第一周开始的具有每周频率的分层时间序列,但是在绘制时间序列时,x 轴几乎可以追溯到 2016 年。
分层时间序列创建如下:
library(hts)
abc <- matrix(sample(1:100, 32*140, replace=TRUE), ncol=32)
colnames(abc) <- c(
paste0("A0",1:5),
paste0("B0",1:9),"B10",
paste0("C0",1:8),
paste0("D0",1:5),
paste0("E0",1:4)
)
abc <- ts(abc, start=2019, frequency=365.25/7)
x <- hts(abc, characters = c(1,2))
然后绘制
plot(x, levels = c(0, 2))
x 被描述为
Hierarchical Time Series
3 Levels
Number of nodes at each level: 1 5 32
Total number of series: 38
Number of observations per series: 140
Top level series:
Time Series:
Start = 2019
End = 2021.66392881588
Frequency = 52.1785714285714
注意:如果我只绘制 0 级,则 x 轴正确启动