eqdist.2014BG {SHT} | R Documentation |
Test for Equality of Two Distributions by Biswas and Ghosh (2014)
Description
Given two samples (either univariate or multivariate) and
of same dimension, it tests
using the procedure by Biswas and Ghosh (2014) in a nonparametric way based on
pairwise distance measures. Both asymptotic and permutation-based determination of
-values are supported.
Usage
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 |
nreps |
the number of permutations to be run when |
Value
a (list) object of S3
class htest
containing:
- statistic
a test statistic.
- p.value
-value under
.
- 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
## Not run:
## 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=""))
## End(Not run)