smart_covmat: Create random VAR-model (dxd) error term covariance matrix...

View source: R/generateParams.R

smart_covmatR Documentation

Create random VAR-model (dxd) error term covariance matrix \Omega fairly close to a given positive definite covariance matrix using (scaled) Wishart distribution

Description

random_covmat generates random VAR model (dxd) error term covariance matrix \Omega from (scaled) Wishart distribution that is fairly close to the given matrix.

Usage

smart_covmat(d, M, Omega, W_and_lambdas, accuracy, structural_pars = NULL)

Arguments

d

the number of time series in the system.

M
For GMVAR and StMVAR models:

a positive integer specifying the number of mixture components.

For G-StMVAR models:

a size (2x1) integer vector specifying the number of GMVAR type components M1 in the first element and StMVAR type components M2 in the second element. The total number of mixture components is M=M1+M2.

Omega

a symmetric positive definite (dxd) covariance matrix specifying expected value of the matrix to be generated.

W_and_lambdas

the mean of the normal distribution the new parameters are generated from.

If lambdas are not constrained:

a size (d^2 - n_zeros + d*(M - 1)) vector (Wvec(W),\lambda_{2},...,\lambda{M}), where n_zeros is the number of zero constraints in W and \lambda_m=(\lambda_{m1},...,\lambda_{md}).

If lambdas are constrained:

a size (d^2 - n_zeros + r) vector (Wvec(W),\gamma), where C_{\lambda}\gamma =(\lambda_2,....,\lambda_M), \gamma is of the size (r x 1), and C_{\lambda} of the size (d*(M - 1) x r).

accuracy

a positive real number adjusting how close to the given covariance matrix the returned individual should be.

For reduced form models standard deviation of each diagonal element is for reduced form models

  • \omega_{i,i}/accuracy when accuracy > d/2

  • and sqrt(2/d)*\omega_{i,i} when accuracy <= d/2.

Wishart distribution is used for reduced form models, but for more details read the source code.

For structural models, the parameters are generated from normal distribution with mean given by the argument W_and_lambdas and the standard deviation is sqrt(abs(W_and_lambdas)/(d + accuracy)).

structural_pars

If NULL a reduced form model is considered. Reduced models can be used directly as recursively identified structural models. For a structural model identified by conditional heteroskedasticity, should be a list containing at least the first one of the following elements:

  • W - a (dxd) matrix with its entries imposing constraints on W: NA indicating that the element is unconstrained, a positive value indicating strict positive sign constraint, a negative value indicating strict negative sign constraint, and zero indicating that the element is constrained to zero.

  • C_lambda - a (d(M-1) x r) constraint matrix that satisfies (\lambda_{2},..., \lambda_{M}) = C_{\lambda} \gamma where \gamma is the new (r x 1) parameter subject to which the model is estimated (similarly to AR parameter constraints). The entries of C_lambda must be either positive or zero. Ignore (or set to NULL) if the eigenvalues \lambda_{mi} should not be constrained.

  • fixed_lambdas - a length d(M-1) numeric vector (\lambda_{2},..., \lambda_{M}) with elements strictly larger than zero specifying the fixed parameter values for the parameters \lambda_{mi} should be constrained to. This constraint is alternative C_lambda. Ignore (or set to NULL) if the eigenvalues \lambda_{mi} should not be constrained.

See Virolainen (2022) for the conditions required to identify the shocks and for the B-matrix as well (it is W times a time-varying diagonal matrix with positive diagonal entries).

Value

For reduced form models:

Returns a (d(d+1)/2x1) vector containing vech-vectorized covariance matrix \Omega.

For structural models:

Returns a length d^2 - n_zeros - d*(M - 1) vector of the form (Wvec(W),\lambda_2,...,\lambda_M) where \lambda_m=(\lambda_{m1},...,\lambda_{md}) contains the eigenvalue parameters of the mth regime (m>1) and n_zeros is the number of zero constraints in W. If lambdas are C_lambda constrained, replace d*(M - 1) in the length with r and \lambda_2,...,\lambda_M) with \gamma. If fixed_lambdas are used, the \lambda_{mi} parameters are not included. The operator Wvec() vectorizes a matrix and removes zeros.


gmvarkit documentation built on Nov. 15, 2023, 1:07 a.m.