Beast: Binary Expansion Adaptive Symmetry Test

BEASTR Documentation

Binary Expansion Adaptive Symmetry Test

Description

BEAST (Binary Expansion Adaptive Symmetry Test) is used for nonparametric detection of nonuniformity or dependence.

Usage

BEAST(
  X,
  dep,
  subsample.percent = 1/2,
  B = 100,
  unif.margin = FALSE,
  lambda = NULL,
  index = list(c(1:ncol(X))),
  method = "p",
  num = NULL
)

Arguments

X

a matrix to be tested.

dep

depth of the binary expansion for the BEAST.

subsample.percent

sample size for subsampling.

B

times of subsampling.

unif.margin

logicals. If TRUE the marginal distribution is known to be Uniform[0,1]. Default is FALSE, and empirical cdf transformation will be applied to each marginal distribution.

lambda

tuning parameter for soft-thresholding, default to be \sqrt{\log(2^{p \cdot dep}) / (8n)}.

index

a list of indices. If provided, test the independence among two or more groups of variables. For example, index = list(c(1,2), c(3))) refers to test the independence between (X_1, X_2) and X_3. Default to be list(c(1:p)) to test if the data follow the multivariate uniform distribution over [0,1]^p, where p = ncol(X).

method

If "p", then compute null distribution with permutations. If "s", then compute null distribution with simulations. If "stat", only return interaction and BEAST Statistic. The method = "s" option is only available for testing uniformity and bivariate independence.

num

number of permutations if method == "p" (default to be 100), or simulations if method == "s" (default to be 1000).

Value

Interaction

the most frequent interaction among all subsamples.

BEAST.Statistic

BEAST statistic.

Null.Distribution

simulated null distribution.

p.value

simulated p-value.

Examples

## Elapsed times 7.32 secs
## Measured in R 4.0.2, 32 bit, on a processor 3.3 GHz 6-Core Intel Core i5 under MacOS, 2024/9/6
## Not run: 
  x1 = runif(128)
  x2 = runif(128)
  y = sin(4*pi*(x1 + x2)) + 0.8*rnorm(128)
  ##test independence between (x1, x2) and y
  BEAST(cbind(x1, x2, y), 3, index = list(c(1,2), c(3)))
  ##test mutual independence among x1, x2 and y
  BEAST(cbind(x1, x2, y), 3, index = list(1, 2, 3))
  
  ##test bivariate uniformity
  x1 = rbeta(128, 2, 4)
  x2 = rbeta(128, 2, 4)
  BEAST(cbind(x1, x2), 3)
  ##test multivariate uniformity
  x1 = rbeta(128, 2, 4)
  x2 = rbeta(128, 2, 4)
  x3 = rbeta(128, 2, 4)
  BEAST(cbind(x1, x2, x3), 3)

## End(Not run)

BET documentation built on Sept. 11, 2024, 8:14 p.m.

Related to Beast in BET...