繁体   English   中英

"如何模拟高阶 AR(N) 过程?"

[英]How to simulate high order AR(N) process?

我需要模拟高阶 AR(N) 系列。 我没有系数,只有 N 是已知的。 II 尝试使用 arima.sim,但我需要提供特定的系数来进行模拟,不幸的是,随机选择保持平稳性条件的有效系数是不可能的。 有任何想法吗? 我需要任何 AR(N) 样本(很多)。 谢谢。

"

一个平稳的 AR(p) 过程将具有在单位圆外具有 p 个根的特征方程。 因为特征方程有实系数,所以这些根是共轭对的,如果 p 是奇数,就会有一个实根。 因此生成系数的一种有效方法是首先生成根,然后构造特征多项式,从中可以轻松提取系数。

这是一些代码来做到这一点。

在单位圆内生成逆根,然后将它们取反更简单。

library(polynom)

# Order of AR polynomial
p <- 50
n_real_roots <- p %% 2
inv_real_roots <- runif(n_real_roots, -1, 1)
# Generate inverse complex roots in conjugate pairs
n_complex_roots <- (p - n_real_roots) / 2
r <- runif(n_complex_roots, -1, 1)
angle <- runif(n_complex_roots, -pi, pi)
inv_complex_roots <- c(complex(argument = angle, modulus = r), 
                       complex(argument = -angle, modulus = r))
# Find polynomial with these as roots
poly <- suppressWarnings(polynom::poly.calc(1/c(inv_real_roots, inv_complex_roots)))
# Scale to have constant 1
poly <- poly / poly[1]
phi <- -as.numeric(poly)[-1]

y <- arima.sim(n = 100, model=list(ar = -coefficients(poly)[-1]))
plot(y)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM