VARshrink (version 0.3.1)

createVARCoefs_ltriangular: Create coefficients of a VAR model

Description

Randomly create sparse lower-triangular matrices for VAR coefficients of lagged endogenous variables, and set a constant vector.

Usage

createVARCoefs_ltriangular(p = 1, K = 5, diag_val = 1/p,
  num_nonzero = 0, const_vector = NULL, range_min = 0.2,
  range_max = 1/p)

Arguments

p

lag order

K

Number of time series variables.

diag_val

diagonal values of A1,...,Ap

num_nonzero

Number of nonzero entries on the lower-triangular parts of A1, ..., Ap

const_vector

constant vector c of the VAR model

range_min, range_max

Each nonzero off-diagonal entry of coefficient matrices is drawn uniformly from the interval [-range_max, -range_min] U [range_min, range_max]

Value

A list object with components $A and $c. $A is a list of K-by-K matrices A_1, ..., A_p, and $c is a constant vector of length K.

Details

Consider VAR(p) model: $$y_t = A_1 y_{t-1} + ... + A_p y_{t-p} + c + e_t,$$ with the constant deterministic variable (d_t = 1). The function creates the coefficient matrices A_1, ..., A_p and constant vector c.

Diagonal elements of each K-by-K matrix A_k are all equal to diag_val, and off-diagonal elements are all zero except for a few randomly selected nonzero elements. Nonzero off-diagonal elements are selected from lower-triangular parts of A_i and the values are drawn from a uniform distribution over [-range_max, -range_min] U [range_min, range_max].

Examples

Run this code
# NOT RUN {
p <- 1; K <- 20;
const_vector <- c(rep(0.2, 5), rep(0.7, 15))
createVARCoefs_ltriangular(p = p, K = K, diag_val = 0.6,
num_nonzero = K, const_vector = const_vector, range_max = 1)
# }

Run the code above in your browser using DataLab