Skip to content
Snippets Groups Projects
Commit 4cf28b65 authored by SANTAGOSTINI Pierre's avatar SANTAGOSTINI Pierre
Browse files

Test for dim 6 added

parent dc289685
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,31 @@ kl21_d5 <- kldggd(Sigma2, beta2, Sigma1, beta1, eps = 1e-12)
test_that("kl works (dim 5)", {
expect_equal(attr(kl12_d5, "eps"), 1e-12)
expect_equal(attr(kl21_d5, "eps"), 1e-12)
expect_equal(as.numeric(kl12_d5), kl12Matlab_d5)
expect_equal(as.numeric(kl21_d5), kl21Matlab_d5)
})
# Dimension p = 6
beta1 <- 0.74
beta2 <- 0.55
Sigma1 = matrix(c(0.8, 0.3, 0.2, 0, 0, 0, 0.3, 0.2, 0.1, 0, 0, 0,
0.2, 0.1, 0.2, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0 , 0, 1), nrow = 6)
Sigma2 = matrix(c(1, 0.3, 0.2, 0, 0, 0, 0.3, 0.5, 0.1, 0, 0, 0,
0.2, 0.1, 0.7, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3), nrow = 6)
kl12Matlab_d6 <- 3.367857801981060
kl21Matlab_d6 <- 16.157323374492506
kl12_d6 <- kldggd(Sigma1, beta1, Sigma2, beta2, eps = 1e-5)
kl21_d6 <- kldggd(Sigma2, beta2, Sigma1, beta1, eps = 1e-6)
test_that("kl works (dim 6)", {
expect_equal(attr(kl12_d6, "eps"), 1e-5)
expect_equal(attr(kl21_d6, "eps"), 1e-6)
expect_equal(as.numeric(kl12_d6), kl12Matlab_d6)
expect_equal(as.numeric(kl21_d6), kl21Matlab_d6)
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment