Init.var {VAR.spec} | R 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 |
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 |
Either NULL or a |
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 |
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 parametercalc.method
in functioncalculate.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 thedata.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 |
p.max.init |
The integer contained in argument |
inv.roots |
A |
niter |
The integer contained in argument |
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 |
See Also
VAR.spec-package
, calculate.VAR
, simulate.VAR
,
plot_VAR.spectra
, plot_VAR.Phase.details
,
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