Description Usage Arguments Examples
View source: R/sample_wrapper.R
powder
Runs power posterior sampling using differential evolution markov chain monte carlo
1 2 3 4 5 | run_mcmc(model, pars = NULL, data, sampler = "de", num_samples = NULL,
num_chains = NULL, migration_start = NULL, migration_end = NULL,
migration_freq = NULL, randomize_phi = TRUE, update = 100,
init_theta = NULL, init_phi = NULL, return_as_mcmc = TRUE,
parallel_backend = "none", n_cores = NULL, benchmark = FALSE)
|
model |
A |
pars |
A |
data |
A |
sampler |
A |
num_samples |
A |
num_chains |
A |
migration_freq |
A |
randomize_phi |
A |
update |
A |
init_theta |
A list where each element contains a named vector of parameter initial start values for each subject. |
init_phi |
A named vector parameter initial start values |
parallel_backend |
A character vector either 'MPI', 'doParallel', or 'none' indicating backend for parallelization. Default is none. |
n_cores |
A |
benchmark |
A |
migration.start |
A |
migration.end |
A |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
library(derp)
#### Simulate data
data = list(response = rnorm(100,2,1))
#### Model parameters
pars = list(
'mu' = list('init'=c(1,10)),
'sd' = list('init'=c(.1,5))
)
#### Define model
model = function() {
normal_lpdf(mu, 0, 3)
gamma_lpdf(sd, 1, 1)
normal_lpdf(response, mu, sd)
}
#### Run the sampler
samples = run_mcmc(model, pars, data,
migration_start = 500, migration_end = 700,
migration_freq = 10, num_samples=3000)
mcmc_snip = snip(samples,burnin=1000,thin=1)
summary(mcmc_snip)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.