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 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 g[i]:
γ(z)=γ0+γ1(z+z−1)+γ2(z2+z−2)+γ3(z3+z−3)+⋯
where z is a complex variable.
Replacing z by e(−i∗w) with 0<=w<=2∗pi
yields the spectral density multiplied by 2∗pi. This gives a power series in the variable 2∗cos(w∗j)
(note that for z=e(−i∗w), which has unit modulus, the inverse 1/z is the complex-conjugate of z):
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.
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.
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.
# the matrix 'm' performs the mapping from the original # to the transformed coefficientsn <-30m <- diag(1, n, n)n2 <- n -2j <--1tmp <- 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 modelgamma <- 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 coefficientsnewcoefs <- 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 equivalentall.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