bfslice_eqp_c | R Documentation |
k
(k > 1
) categorical variable and a continuous variable via Bayes factor.
Conditional dependency detection between a level k_x
(k_x > 1
) categorical variable x
and a continuous variable y
via Bayes factor given a level k_z
categorical variable z
with O(n^{1/2})
-resolution. The basic idea is almost the same as bfslice_c
. The only different is that bfslice_eqp_c
groups samples into approximate O(n^{1/2})
groups which contain approximate O(n^{1/2})
samples and treat the groups as a sample to calculate Bayes facor. If k_z = 1
, it is unconditional dependency detection method. It could be applied for non-parametric variable selecltion.
bfslice_eqp_c(z, x, zdim, xdim, lambda, alpha)
z |
Vector: observations of given (preselected) categorical variable, |
x |
Vector: observations of categorical variable, |
zdim |
Level of |
xdim |
Level of |
lambda |
|
alpha |
|
Value of Bayes factor (nonnegative). Bayes factor could be treated as a statistic and one can take some threshold then calculates the corresponded Type I error rate. One can also take the value of Bayes factor for judgement.
Jiang, B., Ye, C. and Liu, J.S. Bayesian nonparametric tests via sliced inverse modeling. Bayesian Analysis, 12(1): 89-112, 2017.
bfslice_c, bfslice_eqp_u
.
n <- 1000
mu <- 0.2
## Unconditional test
y <- c(rnorm(n, -mu, 1), rnorm(n, mu, 1))
x <- c(rep(0, n), rep(1, n))
z <- rep(0, 2*n)
## Conditional test
y <- c(rnorm(n, -mu, 1), rnorm(n, mu, 1))
x <- c(rep(0, n/5), rep(1, n), rep(0, 4*n/5))
z <- c(rep(0, n), rep(1, n))
z <- z[order(y)]
x <- x[order(y)]
zdim <- max(z) + 1
xdim <- max(x) + 1
lambda <- 1.0
alpha <- 1.0
bfval <- bfslice_eqp_c(z, x, zdim, xdim, lambda, alpha)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.