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

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

问题描述

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

我的意思是,我需要指定一个应导致截距、AR1 项、MA1 项和 MA4 项的 AR(1)MA(1,4) 模型......但这是不同于 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, 滞后 = 列表(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),season=list(order=c(0,0,1), period=4))称呼:arima(x = ppi.d, order = c(1, 0, 1), season = list(order = c(0, 0, 1), period = 4))系数:ar1 ma1 sma1 拦截0.8077 -0.3877 0.2297 0.0076s.e.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),season=list(order=c(0,0,1), period=4))称呼:arima(x = ppi.d, order = c(2, 0, 0), season = list(order = c(0, 0, 1), period = 4))系数:ar1 ar2 sma1 拦截0.4570 0.1611 0.2574 0.0078s.e.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天全站免登陆