Description Usage Arguments Value Examples
View source: R/analysis_exp_4.R
This function obtains the total variation, i.e. the integral of density |pi - tildepi| / 2, where tildepi is the kernel density of the samples (note we divide by two so that this is bounded by 1)
1 | total_variation_true_exp_4(samples, bw = "nrd0")
|
samples |
samples of exp(-(x^4)/2) |
bw |
bandwidth for kernel density estimation (same bw as for density()) |
the total variation between samples and the true density, exp(-(x^4)/2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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]]))
# print total variation
print(total_variation_true_exp_4(test$samples))
@export
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.