Learn R Programming

MRS (version 1.2.6)

plot1D: Plot regions of the representative tree in 1D

Description

This function visualizes the regions of the representative tree of the output of the mrs function. For each region the posterior probability of difference (PMAP) or the effect size is plotted.

Usage

plot1D(ans, type = "prob", group = 1, dim = 1, regions = rep(1,
  length(ans$RepresentativeTree$Levels)), legend = FALSE, main = "default",
  abs = TRUE)

Arguments

ans

An mrs object.

type

What is represented at each node. The options are type = c("eff", "prob"). Default is type = "prob".

group

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

dim

If the data are multivariate, dim is the dimension plotted. Default is dim = 1.

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 plot.

abs

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

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")

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)
p = 1
n1 = 200
n2 = 200
mu1 = matrix( c(0,10), nrow = 2, byrow = TRUE)
mu2 = mu1; mu2[2] = mu1[2] + .01
sigma = c(1,.1)

Z1 = sample(2, n1, replace=TRUE, prob=c(0.9, 0.1))
Z2 = sample(2, n2, replace=TRUE, prob=c(0.9, 0.1))
X1 = mu1[Z1] + matrix(rnorm(n1*p), ncol=p)*sigma[Z1]
X2 = mu2[Z2] + matrix(rnorm(n2*p), ncol=p)*sigma[Z1]
X = rbind(X1, X2)
G = c(rep(1, n1), rep(2,n2))

ans = mrs(X, G, K=10)
plot1D(ans, type = "prob")
plot1D(ans, type = "eff")

Run the code above in your browser using DataLab