Learn R Programming

timsac (version 1.3.8-4)

mulrsp: Multiple Rational Spectrum

Description

Compute rational spectrum for d-dimensional ARMA process.

Usage

mulrsp(h, d, cov, ar = NULL, ma = NULL, log = FALSE, plot = TRUE, ...)

Value

rspec

rational spectrum. An object of class "specmx".

scoh

simple coherence.

Arguments

h

specify frequencies \(i/2\)h (\(i=0,1,...,\)h).

d

dimension of the observation vector.

cov

covariance matrix.

ar

coefficient matrix of autoregressive model. ar[i,j,k] shows the value of \(i\)-th row, \(j\)-th column, \(k\)-th order.

ma

coefficient matrix of moving average model. ma[i,j,k] shows the value of \(i\)-th row, \(j\)-th column, \(k\)-th order.

log

logical. If TRUE, rational spectrums rspec are plotted as \(log(\)rspec\()\).

plot

logical. If TRUE, rational spectrums rspec are plotted.

...

graphical arguments passed to plot.specmx.

Details

ARMA process : $$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 \(u(t)\) is a white noise with zero mean vector and covariance matrix cov.

References

H.Akaike and T.Nakagawa (1988) Statistical Analysis and Control of Dynamic Systems. Kluwer Academic publishers.

Examples

Run this code
# Example 1 for the normal distribution
xorg <- rnorm(1003)
x <- matrix(0, nrow = 1000, ncol = 2)
x[, 1] <- xorg[1:1000]
x[, 2] <- xorg[4:1003] + 0.5*rnorm(1000)
aaa <- ar(x)
mulrsp(h = 20, d = 2, cov = aaa$var.pred, ar = aaa$ar)

# Example 2 for the AR model
ar <- array(0, dim = c(3,3,2))
ar[, , 1] <- matrix(c(0.4,  0,   0.3,
                      0.2, -0.1, -0.5,
                      0.3,  0.1, 0), nrow = 3, ncol = 3, byrow = TRUE)
ar[, , 2] <- matrix(c(0,  -0.3,  0.5,
                      0.7, -0.4,  1,
                      0,   -0.5,  0.3), nrow = 3, ncol = 3, byrow = TRUE)
x <- matrix(rnorm(200*3), nrow = 200, ncol = 3)
y <- mfilter(x, ar, "recursive")
z <- fpec(y, max.order = 10)
mulrsp(h = 20, d = 3, cov = z$perr, ar = z$arcoef)

Run the code above in your browser using DataLab