unif.2017YMi {SHT}R Documentation

Multivariate Test of Uniformity based on Interpoint Distances by Yang and Modarres (2017)

Description

Given a multivariate sample X, it tests

H_0 : \Sigma_x = \textrm{ uniform on } \otimes_{i=1}^p [a_i,b_i] \quad vs\quad H_1 : \textrm{ not } H_0

using the procedure by Yang and Modarres (2017). Originally, it tests the goodness of fit on the unit hypercube [0,1]^p and modified for arbitrary rectangular domain.

Usage

unif.2017YMi(
  X,
  type = c("Q1", "Q2", "Q3"),
  lower = rep(0, ncol(X)),
  upper = rep(1, ncol(X))
)

Arguments

X

an (n\times p) data matrix where each row is an observation.

type

type of statistic to be used, one of "Q1","Q2", and "Q3".

lower

length-p vector of lower bounds of the test domain.

upper

length-p vector of upper bounds of the test domain.

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

Yang M, Modarres R (2017). “Multivariate tests of uniformity.” Statistical Papers, 58(3), 627–639. ISSN 0932-5026, 1613-9798.

Examples

## CRAN-purpose small example
smallX = matrix(rnorm(10*3),ncol=3)
unif.2017YMi(smallX) # run the test


## empirical Type 1 error 
##   compare performances of three methods 
niter = 1234
rec1  = rep(0,niter) # for Q1
rec2  = rep(0,niter) #     Q2
rec3  = rep(0,niter) #     Q3
for (i in 1:niter){
  X = matrix(runif(50*10), ncol=50) # (n,p) = (10,50)
  rec1[i] = ifelse(unif.2017YMi(X, type="Q1")$p.value < 0.05, 1, 0)
  rec2[i] = ifelse(unif.2017YMi(X, type="Q2")$p.value < 0.05, 1, 0)
  rec3[i] = ifelse(unif.2017YMi(X, type="Q3")$p.value < 0.05, 1, 0)
}

## print the result
cat(paste("\n* Example for 'unif.2017YMi'\n","*\n",
"* Type 1 error with Q1 : ", round(sum(rec1/niter),5),"\n",
"*                   Q2 : ", round(sum(rec2/niter),5),"\n",
"*                   Q3 : ", round(sum(rec3/niter),5),"\n",sep=""))



[Package SHT version 0.1.8 Index]