conc_log_lik_init: Initialise the Concentrated Log-Likelihood

Description Usage Arguments Value Examples

View source: R/SVAR-2-estimation.R

Description

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.

Usage

1
conc_log_lik_init(Y, p, By, Be)

Arguments

Y

A (K x N+p) matrix carrying the data for estimation. There are N observations for each of the K variables with p pre-sample values.

p

An integer scalar. The lag length of the VAR(p) system.

By

A (K x K) matrix. Determines the contemporaneous relation between the endogeneous variables y_t. See examples and details below.

Be

A (K x K) matrix. Determines the contemporaneous impact of a structural shock e_t on the endogeneous variables y_t. See examples and details below.

Value

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.

Examples

 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))

nielsaka/zeitreihe documentation built on March 17, 2020, 8:38 p.m.