# riem.test2bg14: Two-Sample Test modified from Biswas and Ghosh (2014) In Riemann: Learning with Data on Riemannian Manifolds

## Description

Given M observations X_1, X_2, …, X_M \in \mathcal{M} and N observations Y_1, Y_2, …, Y_N \in \mathcal{M}, perform the permutation test of equal distribution

H_0~:~\mathcal{P}_X = \mathcal{P}_Y

by the method from Biswas and Ghosh (2014). The method, originally proposed for Euclidean-valued data, is adapted to the general Riemannian manifold with intrinsic/extrinsic distance.

## Usage

 1 riem.test2bg14(riemobj1, riemobj2, geometry = c("intrinsic", "extrinsic"), ...) 

## Arguments

 riemobj1 a S3 "riemdata" class for M manifold-valued data. riemobj2 a S3 "riemdata" class for N manifold-valued data. geometry (case-insensitive) name of geometry; either geodesic ("intrinsic") or embedded ("extrinsic") geometry. ... extra parameters including npermthe number of permutations (default: 999).

## Value

a (list) object of S3 class htest containing:

statistic

a test statistic.

p.value

p-value under H_0.

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

## References

\insertRef

biswas_nonparametric_2014aRiemann

\insertRef

you_revisiting_2020aRiemann

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 #------------------------------------------------------------------- # Example on Sphere : a dataset with two types # # class 1 : 20 perturbed data points near (1,0,0) on S^2 in R^3 # class 2 : 30 perturbed data points near (0,1,0) on S^2 in R^3 #------------------------------------------------------------------- ## GENERATE DATA mydata1 = list() mydata2 = list() for (i in 1:20){ tgt = c(1, stats::rnorm(2, sd=0.1)) mydata1[[i]] = tgt/sqrt(sum(tgt^2)) } for (i in 1:20){ tgt = c(rnorm(1,sd=0.1),1,rnorm(1,sd=0.1)) mydata2[[i]] = tgt/sqrt(sum(tgt^2)) } myriem1 = wrap.sphere(mydata1) myriem2 = wrap.sphere(mydata2) ## PERFORM PERMUTATION TEST # it is expected to return a very small number. riem.test2bg14(myriem1, myriem2, nperm=999) ## Not run: ## CHECK WITH EMPIRICAL TYPE-1 ERROR set.seed(777) ntest = 1000 pvals = rep(0,ntest) for (i in 1:ntest){ X = cbind(matrix(rnorm(30*2, sd=0.1),ncol=2), rep(1,30)) Y = cbind(matrix(rnorm(30*2, sd=0.1),ncol=2), rep(1,30)) Xnorm = X/sqrt(rowSums(X^2)) Ynorm = Y/sqrt(rowSums(Y^2)) Xriem = wrap.sphere(Xnorm) Yriem = wrap.sphere(Ynorm) pvals[i] = riem.test2bg14(Xriem, Yriem, nperm=999)\$p.value } emperr = round(sum((pvals <= 0.05))/ntest, 5) print(paste0("* EMPIRICAL TYPE-1 ERROR=", emperr)) ## End(Not run) 

Riemann documentation built on June 20, 2021, 5:07 p.m.