acgf2poly function

Change of Variable in the AutoCovariance Generating Function

Change of Variable in the AutoCovariance Generating Function

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.

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 pipi.

  • 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 g[i]g[i]:

γ(z)=γ0+γ1(z+z1)+γ2(z2+z2)+γ3(z3+z3)+ \gamma(z) = \gamma_0 + \gamma_1(z+z^{-1}) + \gamma_2(z^2+z^{-2}) + \gamma_3(z^3+z^{-3}) + \cdots%g(z) = g[0] + g[1](z+z^(-1)) + g[2](z^2+z^(-2)) + g[3](z^3+z^(-3)) + ...

where zz is a complex variable.

Replacing zz by e(iw)e^(-i*w) with 0<=w<=2pi0 <= w <= 2*pi

yields the spectral density multiplied by 2pi2*pi. This gives a power series in the variable 2cos(wj)2*cos(w*j)

(note that for z=e(iw)z=e^(-i*w), which has unit modulus, the inverse 1/z1/z is the complex-conjugate of zz):

zj+zj=cos(ωj)+isin(ωj)+cos(ωj)isin(ωj)=2cos(ωj). z^j + z^{-j} = \cos(\omega j) + i\sin(\omega j) + \cos(\omega j) - i\sin(\omega j) =2\cos(\omega j)\,.%z^j + z^(-j) = cos(w*j) + i*sin(w*j) + cos(w*j) - i*sin(w*j) = 2*cos(w*j).

acgf2poly transforms the following expression in the variable 2cos(wj)2*cos(w*j):

A(2cos(jω))=a0+a12cos(ω)+a22cos(2ω)++an2cos(nω) 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)%A(2*cos(j*w)) = a[0] + a[1] * 2*cos(w) + a[2] 2*cos(2*w) + ... + a[n] 2*cos(n*w)

into a polynomial in the variable x=2cos(w)x=2*cos(w):

B(x)=b0+b1x+b2x2++bnxn. B(x) = b_0 + b_1 x + b_2 x^2 + \cdots + b_n x^n\,.%B(x) = b[0] + b[1]*x + b[2]*x^2 + ... + 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.

  1. 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)theta(L)

are obtained from the polynomial theta(L)theta(L(1))theta(L)*theta(L^(-1)), where the coefficients are in terms of the polynomial B(x)B(x)

defined above; then, the coefficients of the moving average model are computed by means of roots2poly.

Returns

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
  • Maintainer: Javier López-de-Lacalle
  • License: GPL-2
  • Last published: 2017-01-04