Description Usage Arguments Value See Also Examples
The function biips_pimh_init
initializes the Particle Independent
Metropolis-Hastings (PIMH) algorithm.
The PIMH algorithm provides MCMC samples of the variables in variable_names
,
using a SMC algorithm as proposal distribution in an independent
Metropolis-Hastings (MH) algorithm.
1 | biips_pimh_init(model, variable_names)
|
model |
|
variable_names |
character vector. The names of the unobserved
variables to monitor. Names can contain subset indices which must define a
valid subset of the variables of the model, e.g.: |
The function biips_pimh_init
returns an object of class
pimh
which can be used to generate samples
from the posterior distribution of the monitored variables in
variable_names
.
An object of class pimh
is a list of functions that share a common
environment. These functions are meant for internal purpose only. They are
used to query information on the current state of the algorithm.
model() |
Get the |
variable_names() |
Get a character vector with the names of the monitored variables. |
sample(sample) |
Get and set the current sample. |
log_marg_like(log_marg_like) |
Get and set the current value of the log marginal likelihood. |
biips_model
, biips_pimh_update
,
biips_pimh_samples
1 2 3 4 5 6 7 8 9 10 11 12 | modelfile <- system.file('extdata', 'hmm.bug', package = 'rbiips')
stopifnot(nchar(modelfile) > 0)
cat(readLines(modelfile), sep = '\n')
data <- list(tmax = 10, p = c(.5, .5), logtau_true = log(1), logtau = log(1))
model <- biips_model(modelfile, data)
n_part <- 50
obj_pimh <- biips_pimh_init(model, c('x', 'c[2:10]')) # Initialize
is.pimh(obj_pimh)
out_pimh_burn <- biips_pimh_update(obj_pimh, 100, n_part) # Burn-in
out_pimh <- biips_pimh_samples(obj_pimh, 100, n_part) # Samples
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.