calc.VAR.spec.from.coefs {VAR.spec}R Documentation

Calculates the spectral matrix of a multivariate VAR (Vector autoregression) model.

Description

Calculates the spectral matrix for all grid points for any (multivariate) VAR model, represented by an object of class var, with specified coefficients (in attribute ar.list).

Usage

calc.VAR.spec.from.coefs(a.var)

Arguments

a.var

an object of class var for which the spectral matrix will be calculated. Actually only the attributes grid, order and ar.list of a.var are needed.

Details

Is being called in calculate.VAR, so there is no need to call it again after calculate.VAR has been called. Can also be used to calculate the spectral matrix of a VAR model which has been fitted to data, e.g. using function ar. See Brockwell and Davis, 1990, Example 11.8.1, Hannan, 1970, Chapter II, Section 5.iv or Brillinger, 2001, Sections 2.8 and 2.9.

Value

Returns the object of class var after having calculated and set the following attributes:

freq

A one dimensional array of length grid, containing the grid-points at which spec has been calculated.

spec

A three dimensional array (gridxkxk), where k is the number of series of the VAR model. Contains for each grid-point the spectral matrix, as calculated at the basis of ar.list. That is, spec[j,1,1] is the spectrum of series 1 at grid-point j, spec[j,1,2] is the cross-spectrum between series 1 and 2 at grid-point j, etc.

References

Brillinger, D.R. (2001). Time Series: Data Analysis and Theory, second ed. Classics in Applied Mathematics, vol. 36. SIAM, Philadelphia.

Brockwell, P. J., Davis, R. A. (1990). Time Series: Theory and Methods, second ed. Springer, New York.

Hannan, E. J. (1970). Multiple Time Series. Wiley, New York.

See Also

VAR.spec-package,Init.var, calculate.VAR, simulate.VAR,

plot_VAR.spectra, plot_VAR.Phase.details

Examples



my.var <- Init.var(grid=501, order.max.init=10, inv.roots.def=NULL)
my.var$inv.roots[2,]<- c(0.98,0.017261,2,3,1,1,2, rep(0,8))
my.var$inv.roots[3,]<- c(0.92,0.897598,2,1,1,1,2, rep(0,8))
my.var$inv.roots[4,]<- c(0.98,1.795196,1,1,0,1,1, rep(0,8))
my.var <- calculate.VAR(a.var=my.var,calc.method="from.det.cross",
          suppr.spec.check.warn=TRUE)
print(my.var$validity.msg)
my.sample <-simulate.VAR(a.var=my.var, sample.size=250, burn.in = 500)
est.var<-list()
est.var$ar.outp <- ar(x=my.sample, aic=FALSE, order.max=6, demean=FALSE, method="ols", 
		series=c("ser1","ser2"))
est.var$label <-"MY VAR(6)"
est.var$order<-dim(est.var$ar.outp$ar)[1]
est.var$ar.list$ar <- est.var$ar.outp$ar
est.var$ar.list$var.pred <- est.var$ar.outp$var.pred
est.var$grid <- 501 
est.var <- calc.VAR.spec.from.coefs(est.var)
plot_VAR.spectra(a.var=est.var,both=FALSE)



[Package VAR.spec version 1.0 Index]