Description Usage Arguments Value Note Examples
View source: R/SVAR-3-identification.R
Selection matrix selecting those elements in X
with restrictions in place.
This function will create the matrix C
in C %*% vec(X) = c
.
1 | selection_matrix(X, value = 0:1, flatten = vec)
|
X |
A square matrix, the target of imposing restrictions. The restricted
elements must coincide with the values specified for |
value |
A numeric vector, the values imposed on elements of |
flatten |
A function, flattening the dimension of |
A matrix containing 0s and 1s of dimension
R x K^2
if flatten = vec
or
R x (K^2 + K)/2
if flatten = vech
. The scalar R is the number of restrictions and K the
number of variables, i.e. K is the number of both the rows and the columns of
X
.
This function is only able to create selection matrices for restrictions on individual elements. Restrictions on linear combinations of elements are not (yet) implemented.
1 2 3 4 5 | set.seed(8191)
K <- 4
A <- matrix(rnorm(K^2), K, K)
A[sample(1:K^2, K * (K-1) / 2)] <- 0
selection_matrix(A)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.