random_covmat: Create random VAR model error term covariance matrix

View source: R/generateParams.R

random_covmatR Documentation

Create random VAR model error term covariance matrix

Description

random_covmat generates random VAR model (dxd) error term covariance matrix \Omega from (scaled) Wishart distribution for reduced form models and the parameters W,\lambda_1,...,\lambda_M for structural models (from normal distributions).

Usage

random_covmat(d, M, omega_scale, W_scale, lambda_scale, 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_scale

a size (dx1) strictly positive vector specifying the scale and variability of the random covariance matrices in random mutations. The covariance matrices are drawn from (scaled) Wishart distribution. Expected values of the random covariance matrices are diag(omega_scale). Standard deviations of the diagonal elements are sqrt(2/d)*omega_scale[i] and for non-diagonal elements they are sqrt(1/d*omega_scale[i]*omega_scale[j]). Note that for d>4 this scale may need to be chosen carefully. Default in GAfit is var(stats::ar(data[,i], order.max=10)$resid, na.rm=TRUE), i=1,...,d. This argument is ignored if structural model is considered.

W_scale

a size (dx1) strictly positive vector partly specifying the scale and variability of the random covariance matrices in random mutations. The elements of the matrix W are drawn independently from such normal distributions that the expectation of the main diagonal elements of the first regime's error term covariance matrix \Omega_1 = WW' is W_scale. The distribution of \Omega_1 will be in some sense like a Wishart distribution but with the columns (elements) of W obeying the given constraints. The constraints are accounted for by setting the element to be always zero if it is subject to a zero constraint and for sign constraints the absolute value or negative the absolute value are taken, and then the variances of the elements of W are adjusted accordingly. This argument is ignored if reduced form model is considered.

lambda_scale

a length M - 1 vector specifying the standard deviation of the mean zero normal distribution from which the eigenvalue \lambda_{mi} parameters are drawn from in random mutations. As the eigenvalues should always be positive, the absolute value is taken. The elements of lambda_scale should be strictly positive real numbers with the m-1th element giving the degrees of freedom for the mth regime. The expected value of the main diagonal elements ij of the mth (m>1) error term covariance matrix will be W_scale[i]*(d - n_i)^(-1)*sum(lambdas*ind_fun) where the (d x 1) vector lambdas is drawn from the absolute value of the t-distribution, n_i is the number of zero constraints in the ith row of W and ind_fun is an indicator function that takes the value one iff the ijth element of W is not constrained to zero. Basically, larger lambdas (or smaller degrees of freedom) imply larger variance.

If the lambda parameters are constrained with the (d(M - 1) x r) constraint matrix C_lambda, then provide a length r vector specifying the standard deviation of the (absolute value of the) mean zero normal distribution each of the \gamma parameters are drawn from (the \gamma is a (r x 1) vector). The expected value of the main diagonal elements of the covariance matrices then depend on the constraints.

This argument is ignored if M==1 or a reduced form model is considered. Default is rep(3, times=M-1) if lambdas are not constrained and rep(3, times=r) if lambdas are constrained.

As with omega_scale and W_scale, this argument should be adjusted carefully if specified by hand. NOTE that if lambdas are constrained in some other way than restricting some of them to be identical, this parameter should be adjusted accordingly in order to the estimation succeed!

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 (forthcoming) 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).

Details

Note that for StMVAR type regimes, the error term covariance matrix is consists of an ARCH type scalar that multiplies a constant covariance matrix. This function generates the constant covariance matrix part of the error term covariance matrix.

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.


saviviro/gmvarkit documentation built on March 8, 2024, 4:15 a.m.