You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

robustarima包auto.ar=TRUE始终返回最大AR阶数问题求助

关于robustarima包auto.ar参数的阶数选择问题

使用R语言的robustarima包时,设置参数auto.ar=TRUE。根据文档及对应书籍第8章322页的说明,该功能应自动返回合适的AR滞后阶数,但实际使用时始终返回max.p设定的最大值。即使运行书中的示例代码,结果依然如此。

示例代码如下:

library(robustarima)

set.seed(600)
n.innov = 300
n = 200
theta= 0.8
n.start = n.innov - n
innov = rnorm(n.innov)

x= arima.sim(model = list(ma = theta), n, innov = innov, n.start = n.start)
ao = ifelse(runif(n)>.1, 0, rnorm(n,6,1))
ao = sign(runif(n,-1,1))*ao
y = x + ao


no=sum(ao!=0)
par(mfrow=c(2,1))
plot(x,  ylab=expression(x[t]),ylim=c(-9,9))
plot(y,  ylab=expression(y[t]),ylim=c(-9,9))
ao.times = (1:n)[ao != 0]
points(ao.times, y[ao != 0])
par(mfrow=c(1,1))


out=arima.rob(y~1, auto.ar=TRUE)
summary(out)

运行后返回结果:

Call:
arima.rob(formula = y ~ 1, auto.ar = TRUE)

Regression model:
 y ~ 1

ARIMA model:
Ordinary differences: 0 ; AR order: 5 ; MA order: 0 

Regression Coefficients:
            Value   Std. Error t value Pr(>|t|)
(Intercept) -0.0277  0.1291    -0.2143  0.8305 

AR Coefficients:
      Value   Std. Error t value Pr(>|t|)
AR(1)  0.5822  0.0730     7.9749  0.0000 
AR(2) -0.3314  0.0829    -3.9994  0.0001 
AR(3)  0.2893  0.0837     3.4559  0.0007 
AR(4) -0.2292  0.0829    -2.7659  0.0062 
AR(5)  0.0792  0.0730     1.0846  0.2795 

Degrees of freedom: 200 total; 194 residual

预期应返回AR(2)阶数,请问是操作有误还是代码存在问题?

内容的提问来源于stack exchange,提问作者Tom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 06:01:46