Plot regions of the representative tree in 2D

Share:

Description

This function visualizes the regions of the representative tree of the output of the mrs function.

Usage

1
2
3
4
5
plot2D(ans, type = "prob", data.points = "all", background = "none",
  group = 1, dim = c(1, 2),
  levels = sort(unique(ans$RepresentativeTree$Levels)), regions = rep(1,
  length(ans$RepresentativeTree$Levels)), legend = FALSE, main = "default",
  abs = TRUE)

Arguments

ans

An mrs object.

type

Different options on how to visualize the rectangular regions. The options are type = c("eff", "prob", "empty", "none"). Default is type = "prob".

data.points

Different options on how to plot the data points. The options are data.points = c("all", "differential", "none"). Default is data.points = "all".

background

Different options on the background. The options are background = c("smeared", "none") .

group

If type = "eff", which group effect size is used. Default is group = 1.

dim

If the data are multivariate, dim are the two dimensions plotted. Default is dim = c(1,2).

levels

Vector with the level of the regions to plot. The default is to plot regions at all levels.

regions

Binary vector indicating the regions to plot. The default is to plot all regions.

legend

Color legend for type. Default is legend = FALSE.

main

Overall title for the legend.

abs

If TRUE, plot the absolute value of the effect size. Only used when type = "eff".

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
18
19
20
21
22
23
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)
plot2D(ans, type = "prob", legend = TRUE)

plot2D(ans, type="empty", data.points = "differential",
 background = "none")

plot2D(ans, type="none", data.points = "differential",
 background = "smeared", levels = 4)