plot_VAR.spectra {VAR.spec}R Documentation

Plots spectra of a bivariate VAR (Vector autoregression) model.

Description

Plots in a 2x2 layout the marginal spectra, the squared Coherency spectrum and the Phase spectrum of a VAR model, represented by an object of class var. If both=TRUE, each one is calculated (and plotted) in two ways: once directly from det, cross, chi.1, chi.2, and once from the coefficients in ar.list. For each quantity the values from the two ways of calculation should coincide, if the calculation of the VAR model undertaken in calculate.VAR was correct. If both=FALSE, only the calculation based on the coefficients in attribute ar.list is plotted.

Usage

plot_VAR.spectra(a.var, both = TRUE)

Arguments

a.var

An object of class var for which spectra are to be plotted.

both

Logical. If TRUE, each quantity will be plotted calculated in two ways: once directly from det, cross, chi.1, chi.2 and once from the coefficients in ar.list. If FALSE, each quantity will be plotted calculated from the coefficients in ar.list only.

Details

If both=TRUE the var should have been obtained from calculate.VAR. If both=FALSE only the attributes grid, freq and spec are required. Thus, it can also be used to plot spectra of a VAR model fitted to a bivariate series, e.g. using function ar, the spectra of which have previously been calculated by a call to calc.VAR.spec.from.coefs.

Value

No return value, called for side effects.

See Also

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

simulate.VAR, plot_VAR.Phase.details,

calc.VAR.spec.from.coefs

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.var <- calc.VAR.spec.from.coefs(a.var=my.var)
plot_VAR.spectra(a.var=my.var)


[Package VAR.spec version 1.0 Index]