1

I am using library robustarima, which has an option auto.ar=TRUE. According to the description and the book (https://onlinelibrary-wiley-com.eur.idm.oclc.org/doi/pdf/10.1002/9781119214656 chapter 8 page 322) this function should return the appropriate lag, but when I am using it it always returns the maximum value max.p (which is also an option). The book has sample code, which I tried to run as well, but this also gives me the output. Does someone know if I am doing something wrong?

I am using library robustarima, which has an option auto.ar=TRUE. According to the description and the book (https://onlinelibrary-wiley-com.eur.idm.oclc.org/doi/pdf/10.1002/9781119214656 chapter 8 page 322) this function should return the appropriate lag, but when I am using it it always returns the maximum value max.p (which is also an option). The book has sample code, which I tried to run as well, but this also gives me the output. Does someone know if I am doing something wrong? Example:

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)

Which returns

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

While an AR(2) lag should be returned. Is this me or is there something wrong with the code? Thanks

Tom
  • 31
  • 4

0 Answers0