plot_levels_hier_mixG: Plot kernel density of samples in hierarchical tree

Description Usage Arguments Value Examples

Description

This function plots the kernel densities of the samples in the hierarchical tree (in red) and the tempered target densities that they were targetting (in blue)

Usage

1
2
3
plot_levels_hier_mixG(hier_result, weights, means, sds, from, to,
  plot_rows, plot_columns, whole = F, bw = rep("nrd0",
  length(hier_result$samples)))

Arguments

hier_result

hierarchical Monte Carlo fusion result

from, to

the range over which the function will be plotted: integer (if want to have it constant throughout) or vector of length L, where L is the number of levels in the hierarchy

plot_rows

number of rows in plot (should make is so plot_rows x plot_columns = L)

plot_columns

number of rows in plot (should make is so plot_rows x plot_columns = L)

whole

boolean value: defaults to F, determines whether or not to plot kde for all samples in the level or for each node (T)

bw

the smoothing bandwidth used: integer (if want to have it constant throughout) or vector of length L, where L is the number of levels in the hierarchy

Value

none

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# setting variables
w_example <- c(0.35, 0.65)
m_example <- c(-3, 8)
s_example <- c(1, 1.5)
b_example <- 1/4

# sampling from tempered density
nsamples <- 500000
base <- hmc_base_sampler_mixG(w_example, m_example, s_example, b_example, nsamples, 4)

test <- parallel_h_fusion_TA_mixG(N_schedule = rep(10000, 2), time_schedule = 1,
                                  start_beta = b_example, C_schedule = rep(2, 2), L = 3, base_samples = base,
                                  weights = w_example, means = m_example, sds = s_example, study = T)

# plot results with constant from and to
plot_levels_hier_mixG(test, weights = w_example, means = m_example, sds = s_example,
                      from = -15, to = 20, plot_rows = 3, plot_columns = 1)

# plot results with specified bandwidths
plot_levels_hier_mixG(test, weights = w_example, means = m_example, sds = s_example,
                      from = -15, to = 20, plot_rows = 3, plot_columns = 1, bw = c(0.2, 0.3, 0.4))

rchan26/mixGaussTempering documentation built on June 14, 2019, 3:26 p.m.