Init.var: Initializes an object of class 'var'

View source: R/VAR_procs_20240530.R

Init.varR Documentation

Initializes an object of class var

Description

Initializes an object of class var, representing a VAR (Vector autoregression) model, sets some of its parameters and reads the specification of certain polynomials which determine the VAR model from a data.frame or from a tab-delimited text file (, which is converted to a data.frame). In this data.frame each polynomial is specified via it's (complex) roots and constant. If no such text file or data.frame is specified, an appropriate default data.frame is created, which can then be modified by the user.

Usage

Init.var(grid = 1001, order.max.init = 10, inv.roots.def = NULL,
              a.niter = 5000, a.eps.max.for.UIA = 1e-10, 
              a.eps.for.roots = 1e-05,a.eps.for.spectra=1E-4)
              

Arguments

grid

An integer specifying the number of equidistant gridpoints in [0,\pi] used for plotting and numerical approximations. They are given by j\pi /((grid-1)), j=0,...,grid.

order.max.init

An integer providing an initial limitation on the order of the VAR model. The degrees of the polynomials specified in the inv.roots.def should not exceed 2*order.max.init and the lines of the inv.roots.def should be at least equal to 6*order.max.init+2 (if this not the case, appropriate lines will be automatically added).

inv.roots.def

Either NULL or a data.frame or a tab-delimited text file (, which is converted to a data.frame). This data.frame contains the roots (rows) of the polynomials (columns) used to specify the VAR model. See Details for the specific structure of the text file. If set to NULL, a data.frame of the appropriate structure will be created, which contains no roots, and corresponds, thus, to a bivariate white noise series. The data.frame in any of the above cases may be modified after the call of init.var, via e.g. var.name$inv.roots <- edit(var.name$inv.roots).

a.niter

An integer specifying the maximal number of iterations for the Innovations algorithm.

a.eps.max.for.UIA

Numeric close to 0. Specifies the threshold for the relative increase in precision achieved at a step of the Innovations algorithm, for accepting that the algorithm has converged.

a.eps.for.roots

Numeric close to 0. A threshold for considering two roots as identical, if a) the inverses of their radii and b) their angles (in their polar representation) differ by less than this threshold.

a.eps.for.spectra

Numeric close to 0. A threshold for checking the validity of the calculation of the VAR model. It's spectra are calculated on the basis of the polynomials used to specify the VAR model in inv.roots.def should coincide with the spectra calculated on the basis of the VAR model's coefficients. If they differ by more than a.eps.for.spectra warning messages will be written out to the console.

Details

The text file [/ data.frame] passed in argument inv.roots.def should have a specific structure:

  • The first row of the file (headers) [/ names of columns of the data.frame] should be 'radius angle det cross chi.1 chi.2 chi.1.prod.2 ma.1 ma.2 eta.1 eta.2 ksi.1 ksi.2 ksi.c zeta'.

  • The second row of the file [/ first row-'observation' in the data.frame] contains the constants of the polynomials, usually set initially to 1, while the first two entries, corresponding to columns radius and angle, are set to '#NA' [/ 'NA'].

  • Subsequent rows, containing each one the specification of a root and the multiplicity of this root for each relevant polynomial, should have the following entries: The first entry is the inverse of its modulus (radius). For all polynomials, except for cross, this should be in [0,1). The second entry is it's argument (angle). This should be a figure in [0,\pi]. Complex conjugates for each non-real root will be automatically added, in order to ensure real coefficients of the polynomials. Subsequent entries in the row are non-negative integers determining the multiplicity of the given root for the polynomial corresponding to the column of the entry. Not all polynomials need to be specified (see parameter calc.method in function calculate.VAR). Non relevant polynomials should have '0' as entry for their multiplicity of the root.

  • Subsequent rows containing no specified roots should have the following structure: the first two entries, corresponding to radius and angle, should equal '#NA' [/ 'NA']. The rest of the row should be filled with '0'. The total number of rows should be at least 6*order.max.init+2 for the file (, including headers) [/ or 6*order.max.init+1 for the data.frame].

Two example text files of the appropriate structure, VAR.inv.roots.from.det.cross.txt and VAR.inv.roots.from.eta.ksi.zeta.txt may be found in the extdata folder of the package. A path to them may be obtained via

fpath<-system.file("extdata","text.file",package="VAR.spec").

The corresponding example data.frames are also directly accessible to the user as

VAR.inv.roots.from.det.cross and VAR.inv.roots.from.eta.ksi.zeta.

Value

An object of class var, basically a list including elements:

grid

The integer contained in argument grid. The number of equidistant gridpoints in [0,\pi], used for plotting and numerical approximations.

p.max.init

The integer contained in argument order.max.init. An initial limitation on the order of the VAR model.

inv.roots

A data.frame containing the roots of certain polynomials, required to specify the VAR model.

niter

The integer contained in argument a.niter. An integer specifying the maximal number of iterations for the Innovations algorithm.

eps.max.for.UIA

Numeric close to 0. Specifies the threshold for the relative increase in precision achieved at a step of the Innovations algorithm, for accepting that the algorithm has converged.

eps.for.roots

Numeric close to 0. A threshold for considering two roots as identical, if a) the inverses of their radii and b) their angles (in their polar representation) differ by less than this threshold.

eps.for.spectra

Numeric close to 0. A threshold for checking the validity of the calculation of the VAR model. It's spectra are calculated on the basis of the polynomials used to specify the VAR model in inv.roots.def should coincide with the spectra calculated on the basis of the VAR model's coefficients. If they differ by more than a.eps.for.spectra warning messages will be written out to the console.

See Also

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

plot_VAR.spectra, plot_VAR.Phase.details,

calc.VAR.spec.from.coefs

Examples

my.var <- Init.var(grid=201, 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$inv.roots


VAR.spec documentation built on June 22, 2024, 10:37 a.m.