sample_exp_4: Rejection sampler for tempered target...

View source: R/exp_4_sampler.R

sample_exp_4R Documentation

Rejection sampler for tempered target exp(-(beta*(x-mean)^4)/2)

Description

Sample from tempered target using rejection sampling with normal proposals

Usage

sample_exp_4(N, mean = 0, proposal_mean, proposal_sd, dominating_M, beta)

Arguments

N

number of samples

mean

mean value, defaults to 0

proposal_mean

mean of proposal density for rejection sampler

proposal_sd

st.dev of proposal density for rejection sampler

beta

real value between 0 and 1

dominiating_M

constant M to bound the target density

Value

samples from tempered target density

Examples

dominating_dnorm <- function(x) 1.3*dnorm(x, mean = 0, sd = 1)
curve(dominating_dnorm(x), -5, 5, col = 'red')
curve(dnorm(x, mean = 0, sd = 1), -5, 5, add = T, col = 'green')
curve(exp_4_density(x, 1/2), -5, 5, add = T, col = 'blue')
sample_from_fc(N = 100000, proposal_mean = 0, proposal_sd = 1, dominating_M = 1.3)


rchan26/hierarchicalFusion documentation built on Sept. 11, 2022, 10:30 p.m.