# see FDOTT for more examples
# enable parallel computation
if (requireNamespace("future")) {
future::plan(future::multisession)
}
K <- 3
N <- 2
costm <- cost_matrix_lp(1:N)
# use higher number to better approximate null distribution and get more accurate p-value
num.sim <- 10
# underlying probability vectors (one-way layout)
# only mu^1 and mu^3 are equal
mu <- matrix(0.5, K, N, TRUE)
mu[2, ] <- c(0.2, 0.8)
n <- c(300, 360, 200)
set.seed(123)
samples <- tab_sample(n, mu)
res <- FDOTT(samples, costm, num.sim = num.sim) |> FDOTT_HSD()
# significant differences for mu^1 = mu^2 and mu^2 = mu^3
print(res)
# \dontshow{
## R CMD check: make sure any open connections are closed afterward
if (requireNamespace("future") && !inherits(future::plan(), "sequential")) future::plan(future::sequential)
# }
Run the code above in your browser using DataLab