Learn R Programming

micvar (version 0.1.0)

gen_coef_mat: Simulate coefficient matrices with specified density

Description

Simulates coefficient matrices used to generate data from a vector autoregressive process.

Usage

gen_coef_mat(k, coefmin, coefmax, dens)

Value

k x k matrix.

Arguments

k

Integer. Dimension of process.

coefmin

Numeric. Minimum value of coefficient. See Details.

coefmax

Numeric. Maximum value of coefficient. See Details.

dens

Numeric. Must be between 0 and 1. Specifies the proportion of non-zero entries in the coefficient matrix. The number of non-zero entries is computed as floor(k^2*dens).

Details

Coefficient values are drawn from a Uniform(coefmin, coefmax) or a Uniform(-coefmax, -coefmin) each with 50% probability.

Examples

Run this code
# bivariate coefficient matrix
coefmat <- gen_coef_mat(k = 2, coefmin = 0.1, coefmax = 0.3, dens = 0.8)
print(coefmat)

Run the code above in your browser using DataLab