acgf2poly {tsdecomp}R Documentation

Change of Variable in the AutoCovariance Generating Function

Description

Change of variable in the autocovariance generating function (ACGF). This transformation allows the pseudo-spectrum to be represented as a polynomial liable to be decomposed in partial fractions.

Usage

acgf2poly(x)
poly2acgf(x, type=c("roots2poly", "acov2ma"), tol = 1e-16, maxiter = 100, 
  init.tol=1e-05, init.maxiter=100)
## S3 method for class 'tsdecMAroots'
print(x, units = c("radians", "degrees", "pi"), digits = 4, echo = TRUE, ...)

Arguments

x

numeric vector of autocovariances; for poly2acgf, an object of class tsdecMAroots returned by type="roots2poly"

type

character string selecting the method to undo the transformation.

tol

convergence tolerance to be used by acov2ma.

maxiter

maximum number of iterations allowed in acov2ma.

init.tol

convergence tolerance to be used by acov2ma.init.

init.maxiter

maximum number of iterations allowed in acov2ma.init.

units

character, the units in which the argument of the roots are printed. units="pi" prints the argument in radians as multiples of \pi.

digits

numeric, the number of significant digits to be used by print.

echo

logical, if TRUE the output is printed, otherwise a invisible copy of the matrix summarizing the results obtained by poly2acgf is returned.

...

further arguments to be passed to print.

Details

The ACGF is defined as a power series where the coefficients are the autocovariances \gamma_\tau:

\gamma(z) = \gamma_0 + \gamma_1(z+z^{-1}) + \gamma_2(z^2+z^{-2}) + \gamma_3(z^3+z^{-3}) + \cdots

where z is a complex variable.

Replacing z by e^{-i\omega} with \omega\in[0,2\pi] yields the spectral density multiplied by 2\pi. This gives a power series in the variable 2\cos(\omega j) (note that for z=e^{-i\omega}, which has unit modulus, the inverse 1/z is the complex-conjugate of z):

z^j + z^{-j} = \cos(\omega j) + i\sin(\omega j) + \cos(\omega j) - i\sin(\omega j) = 2\cos(\omega j)\,.

acgf2poly transforms the following expression in the variable 2\cos(\omega j):

A(2\cos(j\omega)) = a_0 + a_1 2\cos(\omega) + a_2 2\cos(2\omega) + \cdots + a_n 2\cos(n\omega)

into a polynomial in the variable x=2\cos(\omega):

B(x) = b_0 + b_1 x + b_2 x^2 + \cdots + b_n x^n\,.

poly2acgf recovers the vector of autocovariances by undoing the above transformation and computes the coefficients and the variance of the innovations of the moving average model related to those autocovariances. Two methods can be employed. 1) type="acov2ma": this method recovers the autocovariances by undoing the change of variable; then, the the autocovariances are converted to the coefficients of a moving average by means of acov2ma. In the presence of non-invertible roots, this method may experience difficulties to converge. 2) type="roots2poly": this method does not explicitly undo the change of variable acgf2poly (i.e., the vector of autocovariances is not recovered). Instead, the roots of the moving average polynomial \theta(L) are obtained from the polynomial \theta(L)\theta(L^{-1}), where the coefficients are in terms of the polynomial B(x) defined above; then, the coefficients of the moving average model are computed by means of roots2poly.

Value

acgf2poly returns the transformed vector of coefficients.

poly2acgf returns an object of class tsdecMAroots containing the coefficients and the variance of the innovations in the moving average model related to the autocovariances underlying the transformed coefficients. print.tsdecMAroots prints a summary of the results computed by poly2acgf.

Note

Method type="roots2poly" in poly2acgf is based on algorithm pu2ma in the software SSMMATLAB by Gómez, V. URL http://www.sepg.pap.minhap.gob.es/sitios/sepg/en-GB/Presupuestos/Documentacion/Paginas/SSMMATLAB.aspx.

See Also

acov2ma, roots2poly.

Examples

# the matrix 'm' performs the mapping from the original 
# to the transformed coefficients
n <- 30
m <- diag(1, n, n)
n2 <- n - 2
j <- -1
tmp <- seq.int(2, n-1)
for (i in seq.int(3, n-2, 2))
{
  id <- cbind(seq_len(n2),seq.int(i,n))
  m[id] <- j * tmp
  n2 <- n2 - 2
  j <- -1 * j
  tmp <- cumsum(tmp[seq_len(n2)])
}
if (2*floor(n/2) == n) {  # if (n %% 2 == 0)
  m[cbind(seq_len(n2),seq.int(n-1,n))] <- j * tmp 
} else 
  m[1,n] <- j * tmp
m[1:10,1:10]

# equivalence of the original and transformed coefficients,
# example with an ARMA(2,1) model
#
# method 1: compute the spectral density upon the 
# the theoretical autocovariances ('gamma') of the ARMA model
gamma <- ARMAacov(ar=c(0.8,-0.6), ma=0.4, lag.max=n-1)
w <- seq(0, pi, len=length(gamma))
spec1 <- rep(gamma[1], length(w))
for (i in seq_along(w))
{
  z <- 2*cos(w[i] * seq_len(length(gamma)-1))
  spec1[i] <- spec1[i] + sum(gamma[seq.int(2, n)] * z)
}
spec1 <- spec1/(2*pi)
#plot(w, spec1)

# method 2: compute the spectral density upon the 
# transformed coefficients
newcoefs <- m 
spec2 <- rep(newcoefs[1], length(w))
for (i in seq_along(w))
{
  x <- (2*cos(w[i]))^seq_len(n-1)
  spec2[i] <- spec2[i] + sum(newcoefs[seq.int(2, n)] * x)
}
spec2 <- spec2/(2*pi)

# both representations are equivalent
all.equal(spec1, spec2, check.names=FALSE)
#[1] TRUE

# the original coefficients (the autocovariances) 
# can be recovered premultiplying by the inverse of the 
# transformation matrix 'm'
all.equal(c(solve(m) %*% newcoefs), gamma, check.names=FALSE)
#[1] TRUE

[Package tsdecomp version 0.2 Index]