Description Usage Arguments Value Examples
View source: R/SVAR-2-estimation.R
Create the concentrated log-likelihood function of a structural VAR(p) for a
particular data set. Maximise it for estimating the contemporaneous
structural parameters By
and Be
.
1 | conc_log_lik_init(Y, p, By, Be)
|
Y |
A |
p |
An integer scalar. The lag length of the VAR(p) system. |
By |
A |
Be |
A |
A function. It takes as input a named vector args
. This vector
consists of the structural parameters of the SVAR(p) model in vectorised
form.
It will return the value of the log-likelihood at the specified parameter
vector. See the example for details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | TODO factor out common code -> source modular R scripts
set.seed(8191)
# number of variables, observations and lag length
K <- 3
N <- 1E6
p <- 2
# prepare input
A <- cbind(matrix(0.1, K, K), matrix(-0.05, K, K)); diag(A) <- 0.4
Be <- matrix(0.4, K, K); Be[upper.tri(Be)] <- 0
Y0 <-matrix(0, nrow = K, ncol = p)
W <- matrix(rnorm(N * K), nrow = K, ncol = N)
# create data and set restrictions
Y <- create_svar_data(A, Be, Y0, W)
By_init <- diag(K)
Be_init <- matrix(0, K, K)
Be_init[lower.tri(Be_init, diag = TRUE)] <- NA
# initialise log-likelihood function and evaluate
log_lik <- conc_log_lik_init(Y, p, By_init, Be_init)
log_lik(rep(0.35, 6))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.