hom_test_polysph | R Documentation |
Permutation tests for the equality of distributions of two or
k
samples of data on \mathcal{S}^{d_1} \times \cdots \times
\mathcal{S}^{d_r}
. The Jensen–Shannon distance is used to construct a test
statistic measuring the discrepancy between the k
kernel density
estimators. Tests based on the mean and scatter matrices are also available,
but for only two samples (k=2
).
hom_test_polysph(X, d, labels, type = c("jsd", "mean", "scatter", "hd")[1],
h = NULL, kernel = 1, kernel_type = 1, k = 10, B = 1000,
M = 10000, plot_boot = FALSE, seed_jsd = NULL, cv_jsd = TRUE)
X |
a matrix of size |
d |
vector of size |
labels |
vector with |
type |
kind of test to be performed: |
h |
vector of size |
kernel |
kernel employed: |
kernel_type |
type of kernel employed: |
k |
softplus kernel parameter. Defaults to |
B |
number of permutations to use. Defaults to |
M |
number of Monte Carlo samples to use when approximating the
Hellinger/Jensen–Shannon distance. Defaults to |
plot_boot |
flag to display a graphical output of the test decision.
Defaults to |
seed_jsd |
seed for the Monte Carlo simulations used to estimate the
integrals in the Jensen–Shannon distance in the original and bootstrapped
statistics. Defaults to |
cv_jsd |
use cross-validation to approximate the Jensen–Shannon
distance? Does not require Monte Carlo. Defaults to |
Only type = "jsd"
is able to deal with k > 2
.
The "jsd"
statistic is the Jensen–Shannon divergence. This statistic
is bounded in [0, 1]
. The "mean"
statistic measures the maximum
(chordal) distance between the estimated group means. This statistic is
bounded in [0, 1]
. The "scatter"
statistic measures the maximum
affine invariant Riemannian metric between the estimated scatter matrices.
The "hd"
statistic computes a monotonic transformation of the
Hellinger distance, which is the Bhattacharyya divergence (or coefficient).
An object of class "htest"
with the following fields:
statistic |
the value of the test statistic. |
p.value |
the p-value of the test. |
statistic_perm |
the |
n |
a table with the sample sizes per group. |
h |
bandwidths used. |
B |
number of permutations. |
alternative |
a character string describing the alternative hypothesis. |
method |
the kind of test performed. |
data.name |
a character string giving the name of the data. |
## Two-sample case
# H0 holds
n <- c(50, 100)
X1 <- rotasym::r_vMF(n = n[1], mu = c(0, 0, 1), kappa = 1)
X2 <- rotasym::r_vMF(n = n[2], mu = c(0, 0, 1), kappa = 1)
hom_test_polysph(X = rbind(X1, X2), labels = rep(1:2, times = n),
d = 2, type = "jsd", h = 0.5)
# H0 does not hold
X2 <- rotasym::r_vMF(n = n[2], mu = c(0, 1, 0), kappa = 2)
hom_test_polysph(X = rbind(X1, X2), labels = rep(1:2, times = n),
d = 2, type = "jsd", h = 0.5)
## k-sample case
# H0 holds
n <- c(50, 100, 50)
X1 <- rotasym::r_vMF(n = n[1], mu = c(0, 0, 1), kappa = 1)
X2 <- rotasym::r_vMF(n = n[2], mu = c(0, 0, 1), kappa = 1)
X3 <- rotasym::r_vMF(n = n[3], mu = c(0, 0, 1), kappa = 1)
hom_test_polysph(X = rbind(X1, X2, X3), labels = rep(1:3, times = n),
d = 2, type = "jsd", h = 0.5)
# H0 does not hold
X3 <- rotasym::r_vMF(n = n[3], mu = c(0, 1, 0), kappa = 2)
hom_test_polysph(X = rbind(X1, X2, X3), labels = rep(1:3, times = n),
d = 2, type = "jsd", h = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.