View source: R/createVARCoefs_ltriangular.R
| createVARCoefs_ltriangular | R Documentation |
Randomly create sparse lower-triangular matrices for VAR coefficients of lagged endogenous variables, and set a constant vector.
createVARCoefs_ltriangular(
p = 1,
K = 5,
diag_val = 1/p,
num_nonzero = 0,
const_vector = NULL,
range_min = 0.2,
range_max = 1/p
)
p |
lag order |
K |
Number of time series variables. |
diag_val |
diagonal values of |
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] |
Consider VAR(p) model:
y_t = A_1 y_{t-1} + \cdots + A_p y_{t-p} + c + e_t,
with the constant deterministic variable (d_t = 1).
The function creates the coefficient matrices A_1, \ldots, A_p and
constant vector c.
Diagonal elements of each K-by-K matrix A_i 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].
A list object with components $A and $c. $A is
a list of K-by-K matrices A_1, \ldots, A_p, and $c is a constant
vector of length K.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.