如何在 R 中创建具有特定 MA(或 q)项的 ARIMA 模型 [英] How to Create an ARIMA model with specific MA (or q) terms in R

查看:22
本文介绍了如何在 R 中创建具有特定 MA(或 q)项的 ARIMA 模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定使用 arima{stats} 来创建具有特定 MA 术语的 ARMA 模型的特定方法,这些 MA 术语不仅仅由最大数量指定.

我的意思是,我需要指定一个 AR(1)MA(1,4) 模型,该模型应该导致截距、AR1 项、MA1 项和 MA4 项……但这是不同于 AR(1)MA(4) 模型,后者具有 MA1、MA2、MA3 和 MA(4) 的项.

我可以使用 tseries 包中的 arma 函数很好地做到这一点.

<代码>>ar1ma14.model<-arma(ppi.d, lag=list(ar=1, ma=c(1,4)))警告信息:在 arma(ppi.d, lag = list(ar = 1, ma = c(1, 4))) 中:顺序被忽略

<块引用>

总结(ar1ma14.model)

调用:arma(x = ppi.d, lag = list(ar = 1, ma = c(1, 4)))模型:ARMA(1,4)残差:最小值 1Q 中值 3Q 最大值-0.0401487 -0.0056047 0.0004295 0.0045259 0.0379418系数:估计标准.误差 t 值 Pr(>|t|)ar1 0.765279 0.080376 9.521 <2e-16 ***ma1 -0.355297 0.102216 -3.476 0.000509 ***ma4 0.297776 0.098485 3.024 0.002498 **截取 0.001855 0.001026 1.808 0.070603 .

所以它适用于 arma,但 arma 函数没有 arima 相同的预测功能.

我已经尝试了在 arima(p,d,q) 中插入列表作为 q 的所有可能性,但我找不到任何其他人这样做的示例.

有人有想法吗?

解决方案

我想通了.

这就是季节性参数的用途,我怀疑是这样,但无法使其正常工作.

本质上,AR(1)MA(1,4) 模型是一个 AR(1)MA(1) 模型,具有 t-4 周期的季节性移动平均值(这是有道理的,因为这是季度数据).

所以使用 arima 的方法是:

ar1ma14.model<-arima(ppi.d, order=c(1,0,1),seasonal=list(order=c(0,0,1), period=4))称呼:arima(x = ppi.d, order = c(1, 0, 1), 季节性 = list(order = c(0, 0, 1), period = 4))系数:ar1 ma1 sma1 拦截0.8077 -0.3877 0.2297 0.0076瑟0.0855 0.1295 0.0891 0.0032

同样,我需要测试一个 AR(2)MA(|4|) 模型,该模型仅包含 MA4 项,不包含 MA1、MA2 或 MA3.所以这将是一个带有季节性 MA4 的 AR(2) 模型......

ar2ma4.model<-arima(ppi.d, order=c(2,0,0),seasonal=list(order=c(0,0,1), period=4))称呼:arima(x = ppi.d, order = c(2, 0, 0), 季节性 = list(order = c(0, 0, 1), period = 4))系数:ar1 ar2 sma1 拦截0.4570 0.1611 0.2574 0.0078瑟0.0769 0.0790 0.0841 0.0027sigma^2 估计为 0.0001147:对数似然 = 523.37,aic = -1036.75

I'm having trouble figuring the particular way to use arima{stats} to create ARMA models that have specific MA terms that are specified by more than just the maximum number.

What I mean by that, is I need to specific an AR(1)MA(1,4) model that should result in an intercept, AR1 term, an MA1 term, and an MA4 term... but this is different than an AR(1)MA(4) model, which would have terms for MA1, MA2, MA3, and MA(4).

I can do this just fine with the arma function from the tseries package.

> ar1ma14.model<-arma(ppi.d, lag=list(ar=1, ma=c(1,4)))
Warning message:
In arma(ppi.d, lag = list(ar = 1, ma = c(1, 4))) : order is ignored

summary(ar1ma14.model)

Call:
arma(x = ppi.d, lag = list(ar = 1, ma = c(1, 4)))

Model:
ARMA(1,4)

Residuals:
   Min         1Q     Median         3Q        Max 
-0.0401487 -0.0056047  0.0004295  0.0045259  0.0379418 

Coefficient(s):
           Estimate  Std. Error  t value Pr(>|t|)    
ar1        0.765279    0.080376    9.521  < 2e-16 ***
ma1       -0.355297    0.102216   -3.476 0.000509 ***
ma4        0.297776    0.098485    3.024 0.002498 ** 
intercept  0.001855    0.001026    1.808 0.070603 .  

So it works with arma, but the arma function doesn't have the same forecast capabilities as arima.

I've tried every possibility of inserting a list as the q in the arima(p,d,q) and I can't find any examples of others having done it.

Does anyone have an idea?

解决方案

I figured it out.

This is what the seasonal parameter is for, which I suspected, but couldn't get it to work right.

Essentially the AR(1)MA(1,4) model is an AR(1)MA(1) model with a seasonal moving average at t-4 periods (which makes sense because this is quarterly data).

So the way to do it with arima is:

ar1ma14.model<-arima(ppi.d, order=c(1,0,1), seasonal=list(order=c(0,0,1), period=4))

Call:
arima(x = ppi.d, order = c(1, 0, 1), seasonal = list(order = c(0, 0, 1), period = 4))

Coefficients:
         ar1      ma1    sma1  intercept
      0.8077  -0.3877  0.2297     0.0076
s.e.  0.0855   0.1295  0.0891     0.0032

Similarly, I need to test an AR(2)MA(|4|) model, which only includes an MA4 term and not MA1, MA2, or MA3. So that will be an AR(2) model with a seasonal MA4...

ar2ma4.model<-arima(ppi.d, order=c(2,0,0), seasonal=list(order=c(0,0,1), period=4))

Call:
arima(x = ppi.d, order = c(2, 0, 0), seasonal = list(order = c(0, 0, 1), period = 4))

Coefficients:
         ar1     ar2    sma1  intercept
      0.4570  0.1611  0.2574     0.0078
s.e.  0.0769  0.0790  0.0841     0.0027

sigma^2 estimated as 0.0001147:  log likelihood = 523.37,  aic = -1036.75

这篇关于如何在 R 中创建具有特定 MA(或 q)项的 ARIMA 模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆