View source: R/VAR-2-estimation.R
Maximum likelihood estimation of a VAR(p)
1 | mle_var(Y, p, init, log_lik = log_lik_init(Y, p), gradient)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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)
mu <- rep(0, K)
A <- matrix(0.1, K, K * p)
SIGMA <- matrix(0, K, K)
diag(SIGMA) <- 1
args <- c(mu = mu, a = vec(A), s = vech(SIGMA))
ols_fit <- ols_mv(Y = Y, p = p, const = TRUE)
mle_fit <- mle_var(Y, p)
mle_fit$BETA.hat
ols_fit$BETA.hat
mle_fit$SIGMA.hat
ols_fit$SIGMA.hat
mle_fit$std.err
ols_fit$std.err
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.