View source: R/VAR_procs_20240530.R
calc.VAR.spec.from.coefs | R Documentation |
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
).
calc.VAR.spec.from.coefs(a.var)
a.var |
an object of class |
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.
Returns the object of class var
after having calculated and set the following attributes:
freq |
A one dimensional array of length |
spec |
A three dimensional array ( |
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.
VAR.spec-package
,Init.var
, calculate.VAR
, simulate.VAR
,
plot_VAR.spectra
, plot_VAR.Phase.details
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.