View source: R/log_posteriori_of_gips.R
compare_posteriories_of_perms | R Documentation |
Check which permutation is more likely and how much more likely.
compare_posteriories_of_perms(
perm1,
perm2 = "()",
S = NULL,
number_of_observations = NULL,
delta = 3,
D_matrix = NULL,
was_mean_estimated = TRUE,
print_output = TRUE,
digits = 3
)
compare_log_posteriories_of_perms(
perm1,
perm2 = "()",
S = NULL,
number_of_observations = NULL,
delta = 3,
D_matrix = NULL,
was_mean_estimated = TRUE,
print_output = TRUE,
digits = 3
)
perm1 , perm2 |
Permutations to compare.
How many times |
S , number_of_observations , delta , D_matrix , was_mean_estimated |
The same parameters as in the |
print_output |
A boolean.
When |
digits |
Integer. Only used when |
The function compare_posteriories_of_perms()
returns
the value of how many times the perm1
is more likely than perm2
.
The function compare_log_posteriories_of_perms()
returns
the logarithm of how many times the perm1
is more likely than perm2
.
compare_log_posteriories_of_perms()
: More stable,
logarithmic version of compare_posteriories_of_perms()
.
The natural logarithm is used.
print.gips()
- The function that prints the posterior of
the optimized gips
object compared to the starting permutation.
summary.gips()
- The function that calculates the posterior of
the optimized gips
object compared to the starting permutation.
find_MAP()
- The function that finds the permutation that
maximizes log_posteriori_of_gips()
.
log_posteriori_of_gips()
- The function this
compare_posteriories_of_perms()
calls underneath.
require("MASS") # for mvrnorm()
perm_size <- 6
mu <- runif(6, -10, 10) # Assume we don't know the mean
sigma_matrix <- matrix(
data = c(
1.05, 0.8, 0.6, 0.4, 0.6, 0.8,
0.8, 1.05, 0.8, 0.6, 0.4, 0.6,
0.6, 0.8, 1.05, 0.8, 0.6, 0.4,
0.4, 0.6, 0.8, 1.05, 0.8, 0.6,
0.6, 0.4, 0.6, 0.8, 1.05, 0.8,
0.8, 0.6, 0.4, 0.6, 0.8, 1.05
),
nrow = perm_size, byrow = TRUE
) # sigma_matrix is a matrix invariant under permutation (1,2,3,4,5,6)
number_of_observations <- 13
Z <- MASS::mvrnorm(number_of_observations, mu = mu, Sigma = sigma_matrix)
S <- cov(Z) # Assume we have to estimate the mean
g <- gips(S, number_of_observations)
g_map <- find_MAP(g, max_iter = 10, show_progress_bar = FALSE, optimizer = "Metropolis_Hastings")
compare_posteriories_of_perms(g_map, g, print_output = TRUE)
exp(compare_log_posteriories_of_perms(g_map, g, print_output = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.