# plotTree: Plot nodes of the representative tree In jacsor/MRS: Multi-Resolution Scanning for Cross-Sample Differences

## Description

This function visualizes the representative tree of the output of the `mrs` function. For each node of the representative tree, the posterior probability of difference (PMAP) or the effect size is plotted. Each node in the tree is associated to a region of the sample space. All non-terminal nodes have two children nodes obtained by partitiing the parent region with a dyadic cut along a given direction. The numbers under the vertices represent the cutting direction.

## Usage

 ```1 2``` ```plotTree(ans, type = "prob", group = 1, legend = FALSE, main = "", node.size = 5, abs = TRUE) ```

## Arguments

 `ans` A `mrs` object. `type` What is represented at each node. The options are `type = c("eff", "prob")`. `group` If `type = "eff"`, which group effect size is used. `legend` Color legend for type. Default is `legend = FALSE`. `main` Main title. Default is `main = ""`. `node.size` Size of the nodes. Default is `node.size = 5`. `abs` If `TRUE`, plot the absolute value of the effect size. Only used when `type = "eff"`.

## Note

The package igraph is required.

## References

Soriano J. and Ma L. (2016). Probabilistic multi-resolution scanning for two-sample differences. Journal of the Royal Statistical Society: Series B (Statistical Methodology). http://onlinelibrary.wiley.com/doi/10.1111/rssb.12180/abstract

Ma L. and Soriano J. (2016). Analysis of distributional variation through multi-scale Beta-Binomial modeling. arXiv. http://arxiv.org/abs/1604.01443

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```set.seed(1) p = 2 n1 = 200 n2 = 200 mu1 = matrix( c(9,9,0,4,-2,-10,3,6,6,-10), nrow = 5, byrow=TRUE) mu2 = mu1; mu2[2,] = mu1[2,] + 1 Z1 = sample(5, n1, replace=TRUE) Z2 = sample(5, n2, replace=TRUE) X1 = mu1[Z1,] + matrix(rnorm(n1*p), ncol=p) X2 = mu2[Z2,] + matrix(rnorm(n2*p), ncol=p) X = rbind(X1, X2) colnames(X) = c(1,2) G = c(rep(1, n1), rep(2,n2)) ans = mrs(X, G, K=8) plotTree(ans, type = "prob", legend = TRUE) ```

jacsor/MRS documentation built on May 18, 2019, 9:05 a.m.