Learn R Programming

MRS (version 1.2.6)

andova: Multi Resolution Scanning for one-way ANDOVA using the multi-scale Beta-Binomial model

Description

This function executes the Multi Resolution Scanning algorithm to detect differences across the distributions of multiple groups having multiple replicates.

Usage

andova(X, G, H, n_groups = length(unique(G)), n_subgroups = NULL,
  Omega = "default", K = 6, init_state = c(0.8, 0.2, 0), beta = 1,
  gamma = 0.07, delta = 0.4, eta = 0, alpha = 0.5,
  nu_vec = 10^(seq(-1, 4)), return_global_null = TRUE, return_tree = TRUE)

Value

An mrs object.

Arguments

X

Matrix of the data. Each row represents an observation.

G

Numeric vector of the group label of each observation. Labels are integers starting from 1.

H

Numeric vector of the replicate label of each observation. Labels are integers starting from 1.

n_groups

Number of groups.

n_subgroups

Vector indicating the number of replicates for each grop.

Omega

Matrix defining the vertices of the sample space. The "default" option defines a hyperrectangle containing all the data points. Otherwise the user can define a matrix where each row represents a dimension, and the two columns contain the associated lower and upper limit.

K

Depth of the tree. Default is K = 6, while the maximum is K = 14.

init_state

Initial state of the hidden Markov process. The three states are null, altenrative and prune, respectively.

beta

Spatial clustering parameter of the transition probability matrix. Default is beta = 1.0.

gamma

Parameter of the transition probability matrix. Default is gamma = 0.07.

delta

Parameter of the transition probability matrix. Default is delta = 0.4.

eta

Parameter of the transition probability matrix. Default is eta = 0.0.

alpha

Pseudo-counts of the Beta random probability assignments.

nu_vec

The support of the discrete uniform prior on nu.

return_global_null

Boolean indicating whether to return the marginal posterior probability of the global null.

return_tree

Boolean indicating whether to return the posterior representative tree.

References

Ma L. and Soriano J. (2018). Analysis of distributional variation through multi-scale Beta-Binomial modeling. Journal of Computational and Graphical Statistics. Vol. 27, No. 3, 529-541.. tools:::Rd_expr_doi("10.1080/10618600.2017.1402774")

Examples

Run this code
set.seed(1)
n = 1000
M = 5
class_1 = sample(M, n, prob= 1:5, replace=TRUE  )
class_2 = sample(M, n, prob = 5:1, replace=TRUE )

Y_1 = rnorm(n, mean=class_1, sd = .2)
Y_2 = rnorm(n, mean=class_2, sd = .2)

X = matrix( c(Y_1, Y_2), ncol = 1)
G = c(rep(1,n),rep(2,n))
H = sample(3,2*n, replace = TRUE  )

ans = andova(X, G, H)
ans$PostGlobNull
plot1D(ans)

Run the code above in your browser using DataLab