Given a data \(X \in \mathbb{R}{n\times p}\) such that its rows are vectors in a probability simplex, i.e., \(x \in \Delta_{p-1} =\lbrace z \in \mathbb{R}^p~|~z_j > 0, \sum_{i=1}^p z_i = 1 \rbrace, \) test whether the data is uniformly distributed.
simplex.uniform(X, method)
an \((n\times p)\) data matrix where each row is an observation.
(case-insensitive) name of the method to be used, including
likelihood-ratio test with the Dirichlet distribution.
likelihood-ratio test using the symmetric Dirichlet distribution (default).
a (list) object of S3
class htest
containing:
a test statistic.
\(p\)-value under \(H_0\).
alternative hypothesis.
name of the test.
name(s) of provided sample data.
# \donttest{
## pseudo-uniform data generation
N = 100
P = 4
X = matrix(stats::rnorm(N*P), ncol=P)
for (n in 1:N){
x = X[n,]
x = abs(x/sqrt(sum(x^2)))
X[n,] = x^2
}
## run the tests
simplex.uniform(X, "LRT")
#>
#> Test Uniformity on Simplex : LRT-Dirichlet.
#>
#> data: X
#> lambda = 124.91, p-value < 2.2e-16
#> alternative hypothesis: data is not uniformly distributed.
#>
simplex.uniform(X, "lrtsym")
#>
#> Test Uniformity on Simplex : LRT-Symmetric Dirichlet.
#>
#> data: X
#> lambda = 120.04, p-value < 2.2e-16
#> alternative hypothesis: data is not uniformly distributed.
#>
# }