Last data update: 2014.03.03

R: Plot regions of the representative tree in 1D
plot1DR Documentation

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

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.

References

Soriano J. and Ma L. (2014). Multi-resolution two-sample comparison through the divide-merge Markov tree. Preprint. http://arxiv.org/abs/1404.3753

Examples

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MRS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MRS/plot1D.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot1D
> ### Title: Plot regions of the representative tree in 1D
> ### Aliases: plot1D
> 
> ### ** Examples
> 
> 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")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>