bfslice_eqp_u {dslice}R Documentation

Dependency detection between a level k (k > 1) categorical variable and a continuous variable via Bayes factor with given size of each group.

Description

Dependency detection between a level k (k > 1) categorical variable x and a continuous variable y via Bayes factor with O(n^{1/2})-resolution. The basic idea is almost the same as bfslice_u. The only different is that bfslice_eqp_u 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.

Usage

  bfslice_eqp_u(x, dim, lambda, alpha)

Arguments

x

Vector: observations of categorical variable, 0,1,\ldots,k-1 for level k categorical variable, should be ranked according to values of continuous variable y, either ascending or descending.

dim

Level of x, equals k.

lambda

lambda corresponds to the probability that makes slice in each possible position. lambda should be greater than 0.

alpha

alpha is hyper-parameter of the prior distribution of frequency in each slice. alpha should be greater than 0 and less equal than k.

Value

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.

References

Jiang, B., Ye, C. and Liu, J.S. Bayesian nonparametric tests via sliced inverse modeling. Bayesian Analysis, 12(1): 89-112, 2017.

See Also

bfslice_u, bfslice_eqp_c.

Examples

n <- 1000
mu <- 0.2
y <- c(rnorm(n, -mu, 1), rnorm(n, mu, 1))
x <- c(rep(0, n), rep(1, n))
x <- x[order(y)]
dim <- max(x) + 1
lambda <- 1.0
alpha <- 1.0
bfval <- bfslice_eqp_u(x, dim, lambda, alpha)

[Package dslice version 1.2.2 Index]