# Example with simulated innovation data
# Set dimensions
n_var <- 3
h <- 4
n_draws <- 10
n_innovations <- n_var * h
# Create simulated innovation means and covariances
set.seed(123)
mu_eps <- array(rnorm(n_innovations * 1 * n_draws, mean = 0, sd = 0.1),
dim = c(n_innovations, 1, n_draws))
Sigma_eps <- array(0, dim = c(n_innovations, n_innovations, n_draws))
for (d in 1:n_draws) {
temp_cov <- matrix(rnorm(n_innovations^2), n_innovations, n_innovations)
Sigma_eps[,,d] <- temp_cov %*% t(temp_cov) + diag(n_innovations) * 0.5
}
# Calculate KL measure
kl_result <- KL(Sigma_eps, mu_eps, h, plot_ = FALSE)
print(head(kl_result[[1]])) # Print first few q values
Run the code above in your browser using DataLab