MaxBETs {BET} | R Documentation |
Binary Expansion Testing up to a Certain Depth
Description
MaxBETs
is used for nonparametric dependence detection.
Extended from BET
, for a chosen maximal depth d.max
, MaxBETs
does a sequential test up to d.max
and avoids overlapping symmetry statistics in different depths,
for all 2 \le d \le d.max
. The adjustment is done by multiplying the number of interactions which are in the \sigma
-field generated by marginal binary expansions at depth d
but not in that at depth d-1
.
Usage
MaxBETs(
X,
d.max = 4,
unif.margin = FALSE,
asymptotic = TRUE,
plot = FALSE,
index = list(c(1:ncol(X)))
)
Arguments
X |
a matrix to be tested. When |
d.max |
the maximal depth of the binary expansion for |
unif.margin |
logicals. If |
asymptotic |
logicals. If |
plot |
logicals. If |
index |
a list of indices. If provided, test the independence among two or more groups of variables, for example, |
Value
bet.s.pvalue.bonf |
the overall p-value on the test. |
bet.s.index |
the interaction that the p-value is minimal. |
bet.s.zstatistic |
normal approximation of the test statistic. |
Examples
##test mutual independence
v <- runif(128, -pi, pi)
X1 <- cos(v) + 2.5 * rnorm(128, 0, 1/20)
X2 <- sin(v) + 2.5 * rnorm(128, 0, 1/20)
MaxBETs(cbind(X1, X2), 3, asymptotic = FALSE, index = list(1,2))
##test independence between (x1, x2) and y
x1 = runif(128)
x2 = runif(128)
y = sin(4*pi*(x1 + x2)) + 0.4*rnorm(128)
MaxBETs(cbind(x1, x2, y), 3, index = list(c(1,2), c(3)))
##test uniformity
x1 = rbeta(128, 2, 4)
x2 = rbeta(128, 2, 4)
x3 = rbeta(128, 2, 4)
MaxBETs(cbind(x1, x2, x3), 3)