fusion_diff_mixG: Standard Fusion

Description Usage Arguments Value Examples

Description

Monte Carlo Fusion for sub-posteriors which are tempered mixture Gaussians with same weights, means, sds components

Usage

1
2
fusion_diff_mixG(N, time, C, samples_to_fuse, weights, means, sds, betas,
  level = 1, acceptance_rate = F, timed = F)

Arguments

N

number of samples

time

time T for fusion algorithm

C

number of sub-posteriors to combine

samples_to_fuse

list of length C, where samples_to_fuse[c] containg the samples for the c-th sub-posterior

weights

vector: weights of mixture Gaussian

means

vector: means of mixture Gassuan

sds

vector: st.devs of mixture Gaussian

betas

vector of length C, where betas[c] is the beta for c-th sub-posterior

level

defaults to 1, used in hierarchical and sequential Monte Carlo Fusion

acceptance_rate

boolean value: defaults to F, determines whether or not to return acceptance rates

timed

boolen value: defaults to T, determines whether or not to return the time elapsed to run

Value

samples: fusion samples

iters_rho: number of iterations from the first accept/reject step (rho)

iters_Q: number of iterations from the second (diffusion) accept/reject step (Q)

time: run-time of fusion sampler

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# setting variables
w_example <- c(0.35, 0.65)
m_example <- c(-3, 5)
s_example <- c(1, 1.5)
b_example <- 1/2

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

test <- fusion_diff_mixG(N = 10000, time = 1, C = 2, samples_to_fuse = base,
                         weights = w_example, means = m_example, sds = s_example,
                         betas = rep(b_example, 2), acceptance_rate = T, timed = T)

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