n 使用 R 预测包提前模拟 SARIMA 过程

n step ahead simulation of SARIMA process using R forecast package

我想用 nsim 路径提前 n 步模拟 SARIMA 过程。我已经拟合了模型,'forecast' 包有一个 'simulate' 函数。然而,据我所知,虽然它包含一个 nsim 参数,但它只模拟了 1 步? 'forecast' 包是否可行?

https://robjhyndman.com/hyndsight/simulating-from-a-specified-seasonal-arima-model/

我想要实现的是计算出自相关残差总和的标准误差(其中 SARIMA 模型适合显示自相关残差的模型的残差)。所以我想提前 nsteps 执行蒙特卡洛模拟,对每个模拟的值求和,然后计算出总和的标准差。

nsim 是提前模拟的观察次数。将它设置为任何你喜欢的。这是一个例子。

library(forecast)
library(ggplot2)
fit <- auto.arima(USAccDeaths)
autoplot(USAccDeaths, series="Data") +
  autolayer(simulate(fit, nsim=36), series="Simulated")

reprex package (v0.3.0)

于 2019-07-30 创建