![](/img/trans.png)
[英]Interpolate missing values in a time-series and create a time-series model like Cointegration, ARIMA(X) and SARIMA(X) using R
[英]R: Generate a Seasonal ARIMA time-series model using parameters of existing data
我有一个计数时间序列数据,我可以用它来确定基础随机过程的参数。 例如,我说我有一个SARIMA(p,d,q)(P,D,Q)[S]季节性ARIMA模型。
如何使用它来生成新的计数时间序列数据集?
更具体:SARIMA(1,0,1)(1,0,0)[12] - 如何为每个月生成10年的时间序列? (即120分来估算'计数'的数量。)
使用forecast
包中的simulate.Arima()
。 它处理季节性ARIMA模型,而arima.sim()
则不处理。
然而,ARIMA模型不适用于计数时间序列,因为它们假设该过程是在整个实线上定义的。
派对的后来者,但绝对是生成SARIMA (p,d,q)(P,D,Q)[S]
模型的理想解决方案, 无需调节数据,因为它大大降低了阈值。 最近, SARIMA
对象被添加到gmwm
包中( 免责声明:它的作者。)
此功能目前在GitHub包构建中,因此语法可能会更改。
生成代码示例:
# install.packages("devtools")
devtools::install_github("smac-group/gmwm")
# Set seed for reproducibility
set.seed(5532)
# Generate a SARIMA(1,0,1)(1,0,0)[12]
mod = SARIMA(ar=.6, i = 0, ma=.3, sar = .5, si = 0, sma = 0, s = 12, sigma2 = 1)
# Generate the data
xt = gen_gts(1e3, mod)
# Try to recover parameters
arima(xt, order = c(1,0,1), seasonal = list(order = c(1,0,0), period = 12), include.mean = FALSE)
输出:
Call:
arima(x = xt, order = c(1, 0, 1), seasonal = list(order = c(1, 0, 0), period = 12),
include.mean = F)
Coefficients:
ar1 ma1 sar1
0.5728 0.3117 0.5035
s.e. 0.0335 0.0371 0.0274
sigma^2 estimated as 1.008: log likelihood = -1424.89, aic = 2857.78
其他:在gmwm v3.0.0发行版上更新这篇文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.