Learn R Programming

MRS (version 1.2.6)

mrs: Multi Resolution Scanning

Description

This function executes the Multi Resolution Scanning algorithm to detect differences across multiple distributions.

Usage

mrs(X, G, n_groups = length(unique(G)), Omega = "default", K = 6,
  init_state = NULL, beta = 1, gamma = 0.3, delta = NULL, eta = 0.3,
  alpha = 0.5, return_global_null = TRUE, return_tree = TRUE,
  min_n_node = 0)

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.

n_groups

Number of groups.

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 limits for each dimension.

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.

gamma

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

delta

Optional parameter of the transition probability matrix. Default is delta = NULL.

eta

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

alpha

Pseudo-counts of the Beta random probability assignments. Default is alpha = 0.5.

return_global_null

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

return_tree

Boolean indicating whether to return the posterior representative tree.

min_n_node

Node in the tree is returned if there are more than min_n_node data-points in it.

References

Soriano J. and Ma L. (2017). Probabilistic multi-resolution scanning for two-sample differences. Journal of the Royal Statistical Society: Series B (Statistical Methodology). tools:::Rd_expr_doi("10.1111/rssb.12180")

Examples

Run this code
set.seed(1)
n = 20
p = 2
X = matrix(c(runif(p*n/2),rbeta(p*n/2, 1, 4)), nrow=n, byrow=TRUE)
G = c(rep(1,n/2), rep(2,n/2))
ans = mrs(X=X, G=G)

Run the code above in your browser using DataLab