我有一个包含30个变量的时间序列my.ts
,以及hts
的{{1}}个对象。 hts只有一个级别。我使用my.hts= hts(my.ts)
来拟合样本内数据。我想要的是样本数据中提前一步预测的准确度量和残差。
我知道在auto.arima
包中,有一个例子说明了这一点:
forecast
但是,我不确定如何在# Fit model to first few years of AirPassengers data
air.model <- Arima(window(AirPassengers,end=1956+11/12),order=c(0,1,1),
seasonal=list(order=c(0,1,1),period=12),lambda=0)
plot(forecast(air.model,h=48))
lines(AirPassengers)
# Apply fitted model to later data
air.model2 <- Arima(window(AirPassengers,start=1957),model=air.model)
# Forecast accuracy measures on the log scale.
# in-sample one-step forecasts.
accuracy(air.model)
# out-of-sample one-step forecasts.
accuracy(air.model2)
# out-of-sample multi-step forecasts
accuracy(forecast(air.model,h=48,lambda=NULL),
log(window(AirPassengers,start=1957)))
中执行此操作。提前致谢。