diff_density_true_exp_4: Difference density to the true target density exp(-(x^4)/2)

Description Usage Arguments Value Examples

View source: R/analysis_exp_4.R

Description

This function obtains the 'difference density', i.e. the density |pi - tildepi|, where tildepi is the kernel density of the samples

Usage

1
diff_density_true_exp_4(samples, bw = "nrd0")

Arguments

samples

samples of exp(-(x^4)/2)

bw

bandwidth for kernel density estimation (same bw as for density())

Value

difference density of kernel density of the samples and the true density, exp(-(x^4)/2)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
input_samples <- base_rejection_sampler_exp_4(beta = 1/4, nsamples = 100000,  proposal_mean = 0, proposal_sd = 1.5, dominating_M = 1.4)
test <- parallel_h_fusion_exp_4(N_schedule = rep(10000, 2), time_schedule = rep(1, 2),
                                start_beta = 1/4, C_schedule = rep(2, 2), L = 3,
                                base_samples = input_samples, study = T)

# plot true density
curve(target_density_exp_4(x), -3, 3)
# plot density of samples
lines(density(test$samples[[1]]))
# plot density of the difference between samples obtained and true density
lines(diff_density_true_exp_4(test$samples[[1]]))

 @export

rchan26/exp4FusionRCPP documentation built on Nov. 6, 2019, 7:01 p.m.