manifoldtest is an R package for testing statistical independence between two samples of data lying on a Riemannian manifold. Each sample is mapped to a Euclidean tangent space via the logarithmic (inverse exponential) map at a chosen base point, optionally transformed to multidimensional ranks bounded in the unit ball via the center-outward distribution function of Hallin et al. (2021), and then tested for independence with the distance covariance test of Székely, Rizzo and Bakirov (2007).
The package currently supports data on the flat torus (e.g. angular or periodic measurements such as dihedral angles), on hyperbolic space and on the Grassmann manifold of linear subspaces. It is designed so that new manifolds can be added from their logarithmic map and distance function.
Installation
The user can install manifoldtest by running the following command:
# install.packages("devtools")
devtools::install_github("gonzalez-delgado/manifoldtest")Quick example
library(manifoldtest)
# Two samples on the torus, represented in [0,1)^d
X <- matrix(runif(300), nrow = 100, ncol = 3)
Y <- matrix(runif(200), nrow = 100, ncol = 2)
result <- manifold.dcov.test(X, Y, manifold = "torus", R = 500)
result$dcov_test$p.valueOn this website
📖 User guide
How to run the test, with examples on each manifold.
🧩 API documentation
Function reference and package documentation.
If you use manifoldtest, please cite:
The R package
Li, M. and González-Delgado, J. (2026).
manifoldtest: Independence test on Riemannian manifolds.
R package version 1.0.0. GitHub repository
