compare_posteriories_of_perms {gips} | R Documentation |
Compare the posteriori probabilities of 2 permutations
Description
Check which permutation is more likely and how much more likely.
Usage
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
)
Arguments
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 |
Value
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
.
Functions
-
compare_log_posteriories_of_perms()
: More stable, logarithmic version ofcompare_posteriories_of_perms()
. The natural logarithm is used.
See Also
-
print.gips()
- The function that prints the posterior of the optimizedgips
object compared to the starting permutation. -
summary.gips()
- The function that calculates the posterior of the optimizedgips
object compared to the starting permutation. -
find_MAP()
- The function that finds the permutation that maximizeslog_posteriori_of_gips()
. -
log_posteriori_of_gips()
- The function thiscompare_posteriories_of_perms()
calls underneath.
Examples
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))