Learn R Programming

timsac (version 1.2.7)

armaimp: Calculate Characteristics of Scalar ARMA Model

Description

Calculate impulse, autocovariance, partial autocorrelation function and characteristic roots of scalar ARMA model for given AR and MA coefficients.

Usage

armaimp(arcoef, macoef, v, n=1000, lag=NULL, nf=200, plot=TRUE)

Arguments

arcoef
AR coefficients.
macoef
MA coefficients.
v
innovation variance.
n
data length.
lag
maximum lag of autocovariance function. Default is $2 \sqrt{n}$.
nf
number of frequencies in evaluating spectrum.
plot
logical. If TRUE (default) impulse response function, autocovariance, power spectrum and characteristic roots are plotted.

Value

  • impulsimpulse response function.
  • acovautocovariance function.
  • parcorpartial autocorrelation function.
  • specpower spectrum.
  • croot.archaracteristic roots of AR operator. Characteristic root is a list with components named real (real part $R$), image (imaginary part $I$), amp ($=\sqrt{R^2+I^2}$), atan($=atan(I/R)$) and degree.
  • croot.macharacteristic roots of MA operator.

Details

The ARMA model is given by $$y(t) - a(1)y(t-1) - ... - a(p)y(t-p) = u(t) - b(1)u(t-1) - ... - b(q)u(t-q),$$ where $p$ is AR order, $q$ is MA order and $u(t)$ is a zero mean white noise.

References

G.Kitagawa (1993) Time series analysis programing (in Japanese). The Iwanami Computer Science Series.

Examples

Run this code
# ARMA model :  y(n) = 0.9sqrt(3)y(n-1) - 0.81y(n-2)
  #                      + v(n) -0.9sqrt(2)v(n-1) + 0.81v(n-2)
  a <- c(0.9*sqrt(3), -0.81)
  b <- c(0.9*sqrt(2), -0.81)
  z <- armaimp(arcoef=a, macoef=b, v=1.0, n=1000, lag=20)
  z$croot.ar
  z$croot.ma

  # AR model : y(n) = 0.9sqrt(3)y(n-1) - 0.81y(n-2) + v(n)
  z <- armaimp(arcoef=a, v=1.0, n=1000, lag=20)
  z$croot.ar

  # MA model : y(n) = v(n) -0.9sqrt(2)v(n-1) + 0.81v(n-2)
  z <- armaimp(macoef=b, v=1.0, n=1000, lag=20)
  z$croot.ma

Run the code above in your browser using DataLab