## Asymptotic distribution
# Circular data
n <- 10
samp_cir <- r_unif_cir(n = n)
# Matrix
unif_test(data = samp_cir, type = "Ajne", p_value = "asymp")
# Vector
unif_test(data = samp_cir[, 1], type = "Ajne", p_value = "asymp")
# Array
unif_test(data = array(samp_cir, dim = c(n, 1, 1)), type = "Ajne",
p_value = "asymp")
# \donttest{
# Several tests
unif_test(data = samp_cir, type = avail_cir_tests, p_value = "asymp")
# }
# Spherical data
n <- 10
samp_sph <- r_unif_sph(n = n, p = 3)
# Array
unif_test(data = samp_sph, type = "Bingham", p_value = "asymp")
# Matrix
unif_test(data = samp_sph[, , 1], type = "Bingham", p_value = "asymp")
# \donttest{
# Several tests
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "asymp")
## Monte Carlo
# Circular data
unif_test(data = samp_cir, type = "Ajne", p_value = "MC")
unif_test(data = samp_cir, type = avail_cir_tests, p_value = "MC")
# Spherical data
unif_test(data = samp_sph, type = "Bingham", p_value = "MC")
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "MC")
# Caching stats_MC
stats_MC_cir <- unif_stat_MC(n = nrow(samp_cir), p = 2)$stats_MC
stats_MC_sph <- unif_stat_MC(n = nrow(samp_sph), p = 3)$stats_MC
unif_test(data = samp_cir, type = avail_cir_tests,
p_value = "MC", stats_MC = stats_MC_cir)
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "MC",
stats_MC = stats_MC_sph)
## Critical values
# Circular data
unif_test(data = samp_cir, type = avail_cir_tests, p_value = "crit_val")
# Spherical data
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "crit_val")
# Caching crit_val
crit_val_cir <- unif_stat_MC(n = n, p = 2)$crit_val_MC
crit_val_sph <- unif_stat_MC(n = n, p = 3)$crit_val_MC
unif_test(data = samp_cir, type = avail_cir_tests,
p_value = "crit_val", crit_val = crit_val_cir)
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "crit_val",
crit_val = crit_val_sph)
## Specific arguments
# Rothman
unif_test(data = samp_cir, type = "Rothman", Rothman_t = 0.5)
# CCF09
unif_test(data = samp_sph, type = "CCF09", p_value = "MC",
CCF09_dirs = samp_sph[1:2, , 1])
unif_test(data = samp_sph, type = "CCF09", p_value = "MC",
CCF09_dirs = samp_sph[3:4, , 1])
## Using a progress bar when p_value = "MC"
# Define a progress bar
require(progress)
require(progressr)
handlers(handler_progress(
format = paste("(:spin) [:bar] :percent Iter: :current/:total Rate:",
":tick_rate iter/sec ETA: :eta Elapsed: :elapsedfull"),
clear = FALSE))
# Call unif_test() within with_progress()
with_progress(
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "MC",
chunks = 10, M = 1e3)
)
# With several cores
with_progress(
unif_test(data = samp_sph, type = avail_sph_tests, p_value = "MC",
cores = 2, chunks = 10, M = 1e3)
)
# Instead of using with_progress() each time, it is more practical to run
# handlers(global = TRUE)
# once to activate progress bars in your R session
# }
Run the code above in your browser using DataLab