Description Usage Arguments Value Examples
View source: R/rejection_sampler_exp_4.R
Sample from tempered target using rejection sampling with normal proposals
1 2 | sample_from_fc(N, mean = 0, proposal_mean, proposal_sd, dominating_M,
beta)
|
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 |
samples from tempered target density
1 2 3 4 5 | 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(tempered_target_density_exp_4(x, 1/2), -5, 5, add = T, col = 'blue')
sample_from_fc(N = 100000, proposal_mean = 0, proposal_sd = 1, dominating_M = 1.3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.