eqdist.2014BG: Test for Equality of Two Distributions by Biswas and Ghosh...

View source: R/eqdist_2014BG.R

eqdist.2014BGR Documentation

Test for Equality of Two Distributions by Biswas and Ghosh (2014)

Description

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.

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 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

\insertRef

biswas_nonparametric_2014SHT

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)


SHT documentation built on Nov. 3, 2022, 9:06 a.m.

Related to eqdist.2014BG in SHT...