我如何模拟 ma 时间序列模型,残差是使用 R 的毒药分布?
how can i simulate ma time series model and the residuals are poison distribution using R?
我想对移动平均时间序列模型进行模拟,但残差不是正态分布而是它的毒药,使用 R 包
您需要使用 arima.sim
。指定参数 rand.gen
,默认为 rnorm
,但您可以将其设置为 rpois
。您必须提供一个 lambda。
# choose your ma
ma <- 0.7
# choose your lambda for the Poisson distribution
lambda <- 0.5
# choose length of your series
n <- 200
arima.sim(list(order = c(0,0,1), ma = ma),
rand.gen = function(x) rpois(x, lambda = lambda),
n = n)
我想对移动平均时间序列模型进行模拟,但残差不是正态分布而是它的毒药,使用 R 包
您需要使用 arima.sim
。指定参数 rand.gen
,默认为 rnorm
,但您可以将其设置为 rpois
。您必须提供一个 lambda。
# choose your ma
ma <- 0.7
# choose your lambda for the Poisson distribution
lambda <- 0.5
# choose length of your series
n <- 200
arima.sim(list(order = c(0,0,1), ma = ma),
rand.gen = function(x) rpois(x, lambda = lambda),
n = n)