Given two samples (either univariate or multivariate) \(X\) and \(Y\) of same dimension, it tests $$H_0 : F_X = F_Y\quad vs\quad H_1 : F_X \neq F_Y$$ using the procedure by Biswas and Ghosh (2014) in a nonparametric way based on pairwise distance measures. Both asymptotic and permutation-based determination of \(p\)-values are supported.

eqdist.2014BG(X, Y, method = c("permutation", "asymptotic"), nreps = 999)

Arguments

X

a vector/matrix of 1st sample.

Y

a vector/matrix of 2nd sample.

method

method to compute \(p\)-value. Using initials is possible, "p" for permutation tests. Case insensitive.

nreps

the number of permutations to be run when method="permutation".

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

Biswas M, Ghosh AK (2014). “A nonparametric two-sample test applicable to high dimensional data.” Journal of Multivariate Analysis, 123, 160--171. ISSN 0047259X.

Examples

## CRAN-purpose small example
smallX = matrix(rnorm(10*3),ncol=3)
smallY = matrix(rnorm(10*3),ncol=3)
eqdist.2014BG(smallX, smallY) # run the test
#> 
#> 	Test for Equality of Two Distributions by Biswas and Ghosh (2014)
#> 
#> data:  smallX and smallY
#> Tmn = 0.045084, p-value = 0.5065
#> alternative hypothesis: two distributions are not equal
#> 

if (FALSE) {
## compare asymptotic and permutation-based powers
set.seed(777)
ntest  = 1000
pval.a = rep(0,ntest)
pval.p = rep(0,ntest)

for (i in 1:ntest){
  x = matrix(rnorm(100), nrow=5)
  y = matrix(rnorm(100), nrow=5)
  
  pval.a[i] = ifelse(eqdist.2014BG(x,y,method="a")$p.value<0.05,1,0)
  pval.p[i] = ifelse(eqdist.2014BG(x,y,method="p",nreps=100)$p.value <0.05,1,0)
}

## print the result
cat(paste("\n* EMPIRICAL TYPE 1 ERROR COMPARISON \n","*\n",
"* Asymptotics : ", round(sum(pval.a/ntest),5),"\n",
"* Permutation : ", round(sum(pval.p/ntest),5),"\n",sep=""))
}