BEAST {BET} | R 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 |
subsample.percent |
sample size for subsampling. |
B |
times of subsampling. |
unif.margin |
logicals. If |
lambda |
tuning parameter for soft-thresholding, default to be |
index |
a list of indices. If provided, test the independence among two or more groups of variables. For example, |
method |
If |
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.73 secs
## Measured in R 4.0.2, 32 bit, on a processor 3.3 GHz 6-Core Intel Core i5 under MacOS, 2021/9/8
## 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)
##with a known simulation
BEAST.null <- BEAST.null.simu(128, 3, 3,index = list(c(1,2), c(3)))
x1 = runif(128)
x2 = runif(128)
y = sin(4*pi*(x1 + x2)) + 0.8*rnorm(128)
BEAST.stat = BEAST(cbind(x1, x2, y), 3, index = list(c(1,2), c(3)),
method = "stat")$BEAST.Statistic
mean(BEAST.stat<BEAST.null) # p-value
## End(Not run)