Plotting the characteristic roots for ARIMA models

July 23, 2014

(This article was first published on Hyndsight » R, and kindly contributed to R-bloggers)

When modelling data with ARIMA models, it is sometimes useful to plot the inverse characteristic roots. The following functions will compute and plot the inverse roots for any fitted ARIMA model (including seasonal models).

# Compute AR roots
arroots <- function(object)
  if(class(object) != "Arima" & class(object) != "ar")
    stop("object must be of class Arima or ar")
  if(class(object) == "Arima")
    parvec <- object$model$phi
    parvec <- object$ar
  if(length(parvec) > 0)
    last.nonzero <- max(which(abs(parvec) > 1e-08))
    if (last.nonzero > 0)
      type="AR"), class='armaroots'))
# Compute MA roots
maroots <- function(object)
  if(class(object) != "Arima")
    stop("object must be of class Arima")
  parvec <- object$model$theta
  if(length(parvec) > 0)
    last.nonzero <- max(which(abs(parvec) > 1e-08))
    if (last.nonzero > 0)
      type="MA"), class='armaroots'))
plot.armaroots <- function(x, xlab="Real",ylab="Imaginary",
    main=paste("Inverse roots of",x$type,"characteristic polynomial"),
  oldpar <- par(pty='s')
       type="n",bty="n",xaxt="n",yaxt="n", main=main, ...)
  circx <- seq(-1,1,l=501)
  circy <- sqrt(1-circx^2)
  if(length(x$roots) > 0) {
    inside <- abs(x$roots) > 1
    if(sum(!inside) > 0)

The arroots function will return the autoregressive roots from the AR characteristic polynomial while the maroots function will return the moving average roots from the MA characteristic polynomial. Both functions take an Arima object as their only argument. If a seasonal ARIMA model is passed, the roots from both polynomials are computed in each case.

The plot.armaroots function will plot the inverse of the roots on the complex unit circle. A causal invertible model should have all the roots outside the unit circle. Equivalently, the inverse roots should like inside the unit circle.

Here are a couple of examples demonstrating their use.

A simple example with three AR roots:



A more complicated example with ten AR roots and four MA roots. (This is not actually the best model for these data.)

fit <- Arima(woolyrnq,order=c(2,0,0),seasonal=c(2,1,1))
plot(arroots(fit),main="Inverse AR roots")
plot(maroots(fit),main="Inverse MA roots")


Finally, here is an example where two inverse roots lie outside the unit circle (shown in red).



Note that the Arima function will never return a model with inverse roots outside the unit circle. The auto.arima function is even stricter and will not select a model with roots close to the unit circle either, as such models are unlikely to be good for forecasting.

I won’t add these functions to the forecast package as I don’t think enough people would use them, and the package is big enough as it is. So I’m making them available here instead for anyone who wants to use them.

To leave a comment for the author, please follow the link and comment on their blog: Hyndsight » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training


CRC R books series

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)