# coefs2poly: Product of the Polynomials in an ARIMA Model In tsoutliers: Detection of Outliers in Time Series

## Description

This function collapses the polynomials of an ARIMA model into two polynomials: the product of the autoregressive polynomials and the product of the moving average polynomials.

## Usage

 `1` ```coefs2poly(x, add = TRUE) ```

## Arguments

 `x` an object of class `Arima`, as returned by `arima`.
 `add` logical. If `TRUE`, the polynomial of the differencing filter (if present in the model) is multiplied by the stationary autoregressive polynomial. Otherwise only the coefficients of the product of the stationary polynomials is returned.

## Value

A list containing the elements: `arcoefs`, the coefficients of the product of the autoregressive polynomials; `macoefs`, the coefficients of the product of the moving average polynomials. This list is of class `"ArimaPars"` so that it can be recognized by `outliers.tstatistics`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```# ARIMA(0,1,1)(0,1,1) model fit <- arima(log(AirPassengers), order = c(0,1,1), seasonal = list(order = c(0,1,1))) coefs <- coef(fit) # "coefs2poly" returns the coefficients of the product of # the non-seasonal and the seasonal moving average polynomials a1 <- convolve(c(1, coefs[1]), rev(c(1, rep(0, 11), coefs[2])), type="open")[-1] a2 <- coefs2poly(fit)\$macoefs a2 all.equal(a1, a2, check.names=FALSE) # since the model does not contain an autoregressive part # the product of the regular and the seasonal differencing # filter is returned if "add = TRUE" coefs2poly(fit)\$arcoefs # an empty set is returned if "add = FALSE" coefs2poly(fit, add = FALSE)\$arcoefs # in a model with non-seasonal part and no differencing filter # no multiplication of polynomials are involved and # the coefficients are the same as those returned by "coef" fit <- arima(log(AirPassengers), order = c(1,0,1)) coef(fit) coefs2poly(fit) ```

tsoutliers documentation built on May 29, 2017, 8:07 p.m.