log_lik_init: Create a function to compute the log-likelihood

Description Usage Arguments Value Examples

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

Description

Create the log-likelihood function of a VAR(p) for a particular data set.

Usage

1

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.

Value

A function is returned. It takes as input a named vector args. This vector consists of the parameters of the VAR(p) model in vectorised form. Note that names mu, a, s are a requirement. 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
K <- 3
N <- 5E2
p <- 2

set.seed(8191)

A <- matrix(0.1, K, K * p)
Y0 <- matrix(0, K, p)
U <- matrix(rnorm(K * N), K, N)

Y <- create_varp_data(A, Y0, U)

log_lik <- log_lik_init(Y, p)

mu <- rep(0, K)
SIGMA <- diag(K)
args = c(mu = mu, a = vec(A), s = vech(SIGMA))

log_lik(args)

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