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. Since this method depends on quantile information, every observation should strictly reside within the boundary so that it becomes valid after transformation.

unif.2017YMq(X, lower = rep(0, ncol(X)), upper = rep(1, ncol(X)))

Arguments

X

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

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(runif(10*3),ncol=3)
unif.2017YMq(smallX) # run the test
#> 
#> 	Multivariate Test of Uniformity based on Normal Quantiles by Yang and
#> 	Modarres (2017)
#> 
#> data:  smallX
#> Cn = 2.1329, p-value = 0.5453
#> alternative hypothesis: Sample smallX does not follow uniform distribution.
#> 

# \donttest{
## empirical Type 1 error 
niter   = 1234
counter = rep(0,niter)  # record p-values
for (i in 1:niter){
  X = matrix(runif(50*5), ncol=25)
  counter[i] = ifelse(unif.2017YMq(X)$p.value < 0.05, 1, 0)
}

## print the result
cat(paste("\n* Example for 'unif.2017YMq'\n","*\n",
"* number of rejections   : ", sum(counter),"\n",
"* total number of trials : ", niter,"\n",
"* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))
#> 
#> * Example for 'unif.2017YMq'
#> *
#> * number of rejections   : 49
#> * total number of trials : 1234
#> * empirical Type 1 error : 0.03971
# }