sampler_BASE  R Documentation 
Details of the MCMC sampling algorithms provided with the NIMBLE MCMC engine
sampler_BASE() sampler_posterior_predictive(model, mvSaved, target, control) sampler_posterior_predictive_branch(model, mvSaved, target, control) sampler_binary(model, mvSaved, target, control) sampler_categorical(model, mvSaved, target, control) sampler_RW(model, mvSaved, target, control) sampler_RW_block(model, mvSaved, target, control) sampler_RW_llFunction(model, mvSaved, target, control) sampler_slice(model, mvSaved, target, control) sampler_ess(model, mvSaved, target, control) sampler_AF_slice(model, mvSaved, target, control) sampler_crossLevel(model, mvSaved, target, control) sampler_RW_llFunction_block(model, mvSaved, target, control) sampler_RW_multinomial(model, mvSaved, target, control) sampler_RW_dirichlet(model, mvSaved, target, control) sampler_RW_wishart(model, mvSaved, target, control) sampler_RW_lkj_corr_cholesky(model, mvSaved, target, control) sampler_RW_block_lkj_corr_cholesky(model, mvSaved, target, control) sampler_CAR_normal(model, mvSaved, target, control) sampler_CAR_proper(model, mvSaved, target, control) sampler_RJ_fixed_prior(model, mvSaved, target, control) sampler_RJ_indicator(model, mvSaved, target, control) sampler_RJ_toggled(model, mvSaved, target, control) sampler_CRP_concentration(model, mvSaved, target, control) sampler_CRP(model, mvSaved, target, control) sampler_slice_CRP_base_param(model, mvSaved, target, control)
model 
(uncompiled) model on which the MCMC is to be run 
mvSaved 

target 
node(s) on which the sampler will be used 
control 
named list that controls the precise behavior of the sampler, with elements specific to 
sampler_base
base class for new samplers
When you write a new sampler for use in a NIMBLE MCMC (see User Manual), you must include contains = sampler_BASE
.
The binary sampler performs Gibbs sampling for binaryvalued (discrete 0/1) nodes. This can only be used for nodes following either a dbern(p)
or dbinom(p, size=1)
distribution.
The binary sampler accepts no control list arguments.
The categorical sampler performs Gibbs sampling for a single node, which must follow a categorical (dcat
) distribution.
The categorical sampler accepts no control list arguments.
The RW sampler executes adaptive MetropolisHastings sampling with a normal proposal distribution (Metropolis, 1953), implementing the adaptation routine given in Shaby and Wells, 2011. This sampler can be applied to any scalar continuousvalued stochastic node, and can optionally sample on a log scale.
The RW sampler accepts the following control list elements:
log. A logical argument, specifying whether the sampler should operate on the log scale. (default = FALSE)
reflective. A logical argument, specifying whether the normal proposal distribution should reflect to stay within the range of the target distribution. (default = FALSE)
adaptive. A logical argument, specifying whether the sampler should adapt the scale (proposal standard deviation) throughout the course of MCMC execution to achieve a theoretically desirable acceptance rate. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the RW sampler will perform its adaptation procedure. This updates the scale variable, based upon the sampler's achieved acceptance rate over the past adaptInterval iterations. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the normal proposal standard deviation. If adaptive = FALSE, scale will never change. (default = 1)
The RW sampler cannot be used with options log=TRUE and reflective=TRUE, i.e. it cannot do reflective sampling on a log scale.
The RW_block sampler performs a simultaneous update of one or more model nodes, using an adaptive MetropolisHastings algorithm with a multivariate normal proposal distribution (Roberts and Sahu, 1997), implementing the adaptation routine given in Shaby and Wells, 2011. This sampler may be applied to any set of continuousvalued model nodes, to any single continuousvalued multivariate model node, or to any combination thereof.
The RW_block sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the scale (a coefficient for the entire proposal covariance matrix) and propCov (the multivariate normal proposal covariance matrix) throughout the course of MCMC execution. If only the scale should undergo adaptation, this argument should be specified as TRUE. (default = TRUE)
adaptScaleOnly. A logical argument, specifying whether adaption should be done only for scale (TRUE) or also for provCov (FALSE). This argument is only relevant when adaptive = TRUE. When adaptScaleOnly = FALSE, both scale and propCov undergo adaptation; the sampler tunes the scaling to achieve a theoretically good acceptance rate, and the proposal covariance to mimic that of the empirical samples. When adaptScaleOnly = TRUE, only the proposal scale is adapted. (default = FALSE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the RW_block sampler will perform its adaptation procedure, based on the past adaptInterval iterations. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the scalar multiplier for propCov. If adaptive = FALSE, scale will never change. (default = 1)
propCov. The initial covariance matrix for the multivariate normal proposal distribution. This element may be equal to the character string 'identity', in which case the identity matrix of the appropriate dimension will be used for the initial proposal covariance matrix. (default = 'identity')
tries. The number of times this sampler will repeatedly operate on each MCMC iteration. Each try consists of a new proposed transition and an accept/reject decision of this proposal. Specifying tries > 1 can help increase the overall sampler acceptance rate and therefore chain mixing. (default = 1)
Note that modifying elements of the control list may greatly affect the performance of this sampler. In particular, the sampler can take a long time to find a good proposal covariance when the elements being sampled are not on the same scale. We recommend providing an informed value for propCov
in this case (possibly simply a diagonal matrix that approximates the relative scales), as well as possibly providing a value of scale
that errs on the side of being too small. You may also consider decreasing adaptFactorExponent
and/or adaptInterval
, as doing so has greatly improved performance in some cases.
Sometimes it is useful to control the log likelihood calculations used for an MCMC updater instead of simply using the model. For example, one could use a sampler with a log likelihood that analytically (or numerically) integrates over latent model nodes. Or one could use a sampler with a log likelihood that comes from a stochastic approximation such as a particle filter, allowing composition of a particle MCMC (PMCMC) algorithm (Andrieu et al., 2010). The RW_llFunction sampler handles this by using a MetropolisHastings algorithm with a normal proposal distribution and a userprovided loglikelihood function. To allow compiled execution, the loglikelihood function must be provided as a specialized instance of a nimbleFunction. The loglikelihood function may use the same model as the MCMC as a setup argument, but if so the state of the model should be unchanged during execution of the function (or you must understand the implications otherwise).
The RW_llFunction sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the scale (proposal standard deviation) throughout the course of MCMC execution. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. (default = 200)
scale. The initial value of the normal proposal standard deviation. (default = 1)
llFunction. A specialized nimbleFunction that accepts no arguments and returns a scalar double number. The return value must be the total loglikelihood of all stochastic dependents of the target nodes – and, if includesTarget = TRUE, of the target node(s) themselves – or whatever surrogate is being used for the total loglikelihood. This is a required element with no default.
includesTarget. Logical variable indicating whether the return value of llFunction includes the loglikelihood associated with target. This is a required element with no default.
The slice sampler performs slice sampling of the scalar node to which it is applied (Neal, 2003). This sampler can operate on either continuousvalued or discretevalued scalar nodes. The slice sampler performs a 'stepping out' procedure, in which the slice is iteratively expanded to the left or right by an amount sliceWidth. This sampler is optionally adaptive, governed by a control list element, whereby the value of sliceWidth is adapted towards the observed absolute difference between successive samples.
The slice sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler will adapt the value of sliceWidth throughout the course of MCMC execution. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. (default = 200)
sliceWidth. The initial value of the width of each slice, and also the width of the expansion during the iterative 'stepping out' procedure. (default = 1)
sliceMaxSteps. The maximum number of expansions which may occur during the 'stepping out' procedure. (default = 100)
maxContractions. The maximum number of contractions of the interval that may occur during sampling (this prevents infinite looping in unusual situations). (default = 100)
maxContractionsWarning. A logical argument specifying whether to warn when the maximum number of contractions is reached. (default = TRUE)
The ess sampler performs elliptical slice sampling of a single node, which must follow either a univariate or multivariate normal distribution (Murray, 2010). The algorithm is an extension of slice sampling (Neal, 2003), generalized to context of the Gaussian distribution. An auxiliary variable is used to identify points on an ellipse (which passes through the current node value) as candidate samples, which are accepted contingent upon a likelihood evaluation at that point. This algorithm requires no tuning parameters and therefore no period of adaptation, and may result in very efficient sampling from Gaussian distributions.
The ess sampler accepts the following control list arguments.
maxContractions. The maximum number of contractions of the interval that may occur during sampling (this prevents infinite looping in unusual situations). (default = 100)
maxContractionsWarning. A logical argument specifying whether to warn when the maximum number of contractions is reached. (default = TRUE)
The automated factor slice sampler conducts a slice sampling algorithm on one or more model nodes. The sampler uses the eigenvectors of the posterior covariance between these nodes as an orthogonal basis on which to perform its 'stepping Out' procedure. The sampler is adaptive in updating both the width of the slices and the values of the eigenvectors. The sampler can be applied to any set of continuous or discretevalued model nodes, to any single continuous or discretevalued multivariate model node, or to any combination thereof. The automated factor slice sampler accepts the following control list elements:
sliceWidths. A numeric vector of initial slice widths. The length of the vector must be equal to the sum of the lengths of all nodes being used by the automated factor slice sampler. Defaults to a vector of 1's.
sliceAdaptFactorMaxIter. The number of iterations for which the factors (eigenvectors) will continue to adapt to the posterior correlation. (default = 15000)
sliceAdaptFactorInterval. The interval on which to perform factor adaptation. (default = 1000)
sliceAdaptWidthMaxIter. The maximum number of iterations for which to adapt the widths for a given set of factors. (default = 512)
sliceAdaptWidthTolerance. The tolerance for when widths no longer need to adapt, between 0 and 0.5. (default = 0.1)
sliceMaxSteps. The maximum number of expansions which may occur during the 'stepping out' procedure. (default = 100)
maxContractions. The maximum number of contractions of the interval that may occur during sampling (this prevents infinite looping in unusual situations). (default = 100)
maxContractionsWarning. A logical argument specifying whether to warn when the maximum number of contractions is reached. (default = TRUE)
This sampler is constructed to perform simultaneous updates across two levels of stochastic dependence in the model structure. This is possible when all stochastic descendents of node(s) at one level have conjugate relationships with their own stochastic descendents. In this situation, a MetropolisHastings algorithm may be used, in which a multivariate normal proposal distribution is used for the higherlevel nodes, and the corresponding proposals for the lowerlevel nodes undergo Gibbs (conjugate) sampling. The joint proposal is either accepted or rejected for all nodes involved based upon the MetropolisHastings ratio. This sampler is a conjugate version of Scheme 3 in KnorrHeld and Rue (2002). It can also be seen as a Metropolisbased version of collapsed Gibbs sampling (in particular Sampler 3 of van Dyk and Park (2008)).
The requirement that all stochastic descendents of the target nodes must themselves have only conjugate descendents will be checked when the MCMC algorithm is built. This sampler is useful when there is strong dependence across the levels of a model that causes problems with convergence or mixing.
The crossLevel sampler accepts the following control list elements:
adaptive. Logical argument, specifying whether the multivariate normal proposal distribution for the target nodes should be adaptived. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. (default = 200)
scale. The initial value of the scalar multiplier for propCov. (default = 1)
propCov. The initial covariance matrix for the multivariate normal proposal distribution. This element may be equal to the character string 'identity' or any positive definite matrix of the appropriate dimensions. (default = 'identity')
Sometimes it is useful to control the log likelihood calculations used for an MCMC updater instead of simply using the model. For example, one could use a sampler with a log likelihood that analytically (or numerically) integrates over latent model nodes. Or one could use a sampler with a log likelihood that comes from a stochastic approximation such as a particle filter, allowing composition of a particle MCMC (PMCMC) algorithm (Andrieu et al., 2010) (but see samplers listed below for NIMBLE's direct implementation of PMCMC). The RW_llFunction_block
sampler handles this by using a MetropolisHastings algorithm with a multivariate normal proposal distribution and a userprovided loglikelihood function. To allow compiled execution, the loglikelihood function must be provided as a specialized instance of a nimbleFunction. The loglikelihood function may use the same model as the MCMC as a setup argument, but if so the state of the model should be unchanged during execution of the function (or you must understand the implications otherwise).
The RW_llFunction_block sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the proposal covariance throughout the course of MCMC execution. (default is TRUE)
adaptScaleOnly. A logical argument, specifying whether adaption should be done only for scale (TRUE) or also for provCov (FALSE). This argument is only relevant when adaptive = TRUE. When adaptScaleOnly = FALSE, both scale and propCov undergo adaptation; the sampler tunes the scaling to achieve a theoretically good acceptance rate, and the proposal covariance to mimic that of the empirical samples. When adaptScaleOnly = TRUE, only the proposal scale is adapted. (default = FALSE)
adaptInterval. The interval on which to perform adaptation. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the scalar multiplier for propCov. If adaptive = FALSE, scale will never change. (default = 1)
propCov. The initial covariance matrix for the multivariate normal proposal distribution. This element may be equal to the character string 'identity', in which case the identity matrix of the appropriate dimension will be used for the initial proposal covariance matrix. (default = 'identity')
llFunction. A specialized nimbleFunction that accepts no arguments and returns a scalar double number. The return value must be the total loglikelihood of all stochastic dependents of the target nodes – and, if includesTarget = TRUE, of the target node(s) themselves – or whatever surrogate is being used for the total loglikelihood. This is a required element with no default.
includesTarget. Logical variable indicating whether the return value of llFunction includes the loglikelihood associated with target. This is a required element with no default.
This sampler is designed for sampling multinomial target distributions. The sampler performs a series of MetropolisHastings steps between pairs of groups. Proposals are generated via a draw from a binomial distribution, whereafter the proposed number density is moved from one group to another group. The acceptance or rejection of these proposals follows a standard MetropolisHastings procedure. Probabilities for the random binomial proposals are adapted to a target acceptance rate of 0.5.
The RW_multinomial
sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the binomial proposal probabilities throughout the course of MCMC execution. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. A minimum value of 100 is required. (default = 200)
This sampler is designed for sampling nonconjugate Dirichlet distributions. The sampler performs a series of MetropolisHastings updates (on the log scale) to each component of a gammareparameterization of the target Dirichlet distribution. The acceptance or rejection of these proposals follows a standard MetropolisHastings procedure.
The RW_dirichlet
sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should independently adapt the scale (proposal standard deviation, on the log scale) for each componentwise MetropolisHasting update, to achieve a theoretically desirable acceptance rate for each. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the sampler will perform its adaptation procedure. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the proposal standard deviation (on the log scale) for each component of the reparameterized Dirichlet distribution. If adaptive = FALSE, the proposal standard deviations will never change. (default = 1)
This sampler is designed for sampling nonconjugate Wishart and inverseWishart distributions. More generally, it can update any symmetric positivedefinite matrix (for example, scaled covaraiance or precision matrices). The sampler performs block MetropolisHastings updates following a transformation to an unconstrained scale (Cholesky factorization of the original matrix, then taking the log of the main diagonal elements.
The RW_wishart
sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the scale and proposal covariance for the multivariate normal MetropolisHasting proposals, to achieve a theoretically desirable acceptance rate for each. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the sampler will perform its adaptation procedure. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the scalar multiplier for the multivariate normal MetropolisHastings proposal covariance. If adaptive = FALSE, scale will never change. (default = 1)
This sampler is designed for sampling nonconjugate LKJ correlation Cholesky factor distributions. The sampler performs a blocked MetropolisHastings update following a transformation to an unconstrained scale (using the signed stickbreaking approach documented in Section 10.12 of the Stan Language Reference Manual, version 2.27).
The RW_block_lkj_corr_cholesky
sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the scale (a coefficient for the entire proposal covariance matrix) and propCov (the multivariate normal proposal covariance matrix) throughout the course of MCMC execution. If only the scale should undergo adaptation, this argument should be specified as TRUE. (default = TRUE)
adaptScaleOnly. A logical argument, specifying whether adaption should be done only for scale (TRUE) or also for provCov (FALSE). This argument is only relevant when adaptive = TRUE. When adaptScaleOnly = FALSE, both scale and propCov undergo adaptation; the sampler tunes the scaling to achieve a theoretically good acceptance rate, and the proposal covariance to mimic that of the empirical samples. When adaptScaleOnly = TRUE, only the proposal scale is adapted. (default = FALSE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the RW_block sampler will perform its adaptation procedure, based on the past adaptInterval iterations. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the scalar multiplier for propCov. If adaptive = FALSE, scale will never change. (default = 1)
propCov. The initial covariance matrix for the multivariate normal proposal distribution. This element may be equal to the character string 'identity', in which case the identity matrix of the appropriate dimension will be used for the initial proposal covariance matrix. (default = 'identity')
This is the default sampler for the LKJ distribution. However, blocked samplers may perform poorly if the adaptation configuration is poorly chosen. See the comments in the RW_block section of this documentation.
This sampler is designed for sampling nonconjugate LKJ correlation Cholesky factor distributions. The sampler performs individual MetropolisHastings updates following a transformation to an unconstrained scale (using the signed stickbreaking approach documented in Section 10.12 of the Stan Language Reference Manual, version 2.27).
The RW_lkj_corr_cholesky
sampler accepts the following control list elements:
adaptive. A logical argument, specifying whether the sampler should adapt the scales of the univariate normal MetropolisHasting proposals, to achieve a theoretically desirable acceptance rate for each. (default = TRUE)
adaptInterval. The interval on which to perform adaptation. Every adaptInterval MCMC iterations (prior to thinning), the sampler will perform its adaptation procedure. (default = 200)
adaptFactorExponent. Exponent controling the rate of decay of the scale adaptation factor. See Shaby and Wells, 2011, for details. (default = 0.8)
scale. The initial value of the scalar multiplier for the multivariate normal MetropolisHastings proposal covariance. If adaptive = FALSE, scale will never change. (default = 1)
Note that this sampler is likely run much more slowly than the blocked sampler for the LKJ distribution, as updating each single element will generally incur the full cost of updating all dependencies of the entire matrix.
The CAR_normal sampler operates uniquely on improper (intrinsic) Gaussian conditional autoregressive (CAR) nodes, those with a dcar_normal
prior distribution. It internally assigns one of three univariate samplers to each dimension of the target node: a posterior predictive, conjugate, or RW sampler; however these component samplers are specialized to operate on dimensions of a dcar_normal
distribution.
The CAR_normal sampler accepts the following control list elements:
carUseConjugacy
. A logical argument, specifying whether to assign conjugate samplers for conjugate components of the target node. If FALSE
, a RW sampler would be assigned instead. (default = TRUE)
adaptive
. A logical argument, specifying whether any component RW samplers should adapt the scale (proposal standard deviation), to achieve a theoretically desirable acceptance rate. (default = TRUE
)
adaptInterval
. The interval on which to perform adaptation for any component RW samplers. Every adaptInterval
MCMC iterations (prior to thinning), component RW samplers will perform an adaptation procedure. This updates the scale
variable, based upon the sampler's achieved acceptance rate over the past adaptInterval
iterations. (default = 200)
scale
. The initial value of the normal proposal standard deviation for any component RW samplers. If adaptive = FALSE
, scale
will never change. (default = 1)
The CAR_proper sampler operates uniquely on proper Gaussian conditional autoregressive (CAR) nodes, those with a dcar_proper
prior distribution. It internally assigns one of three univariate samplers to each dimension of the target node: a posterior predictive, conjugate, or RW sampler, however these component samplers are specialized to operate on dimensions of a dcar_proper
distribution.
The CAR_proper sampler accepts the following control list elements:
carUseConjugacy
. A logical argument, specifying whether to assign conjugate samplers for conjugate components of the target node. If FALSE
, a RW sampler would be assigned instead. (default = TRUE
)
adaptive
. A logical argument, specifying whether any component RW samplers should adapt the scale (proposal standard deviation), to achieve a theoretically desirable acceptance rate. (default = TRUE
)
adaptInterval
. The interval on which to perform adaptation for any component RW samplers. Every adaptInterval MCMC iterations (prior to thinning), component RW samplers will perform an adaptation procedure. This updates the scale variable, based upon the sampler's achieved acceptance rate over the past adaptInterval iterations. (default = 200)
scale
. The initial value of the normal proposal standard deviation for any component RW samplers. If adaptive = FALSE
, scale
will never change. (default = 1)
The CRP sampler is designed for fitting models involving Dirichlet process mixtures. It is exclusively assigned by NIMBLE's default MCMC configuration to nodes having the Chinese Restaurant Process distribution, dCRP
. It executes sequential sampling of each component of the node (i.e., the cluster membership of each element being clustered). Internally, either of two samplers can be assigned, depending on conjugate or nonconjugate structures within the model. For conjugate and nonconjugate model structures, updates are based on Algorithm 2 and Algorithm 8 in Neal (2000), respectively.
checkConjugacy
. A logical argument, specifying whether to assign conjugate samplers if valid. (default = TRUE
)
printTruncation
. A logical argument, specifying whether to print a warning when the MCMC attempts to use more clusters than the maximum number specified in the model. Only relevant where the user has specified the maximum number of clusters to be less than the number of observations. (default = TRUE
)
The CRP_concentration sampler is designed for Bayesian nonparametric mixture modeling. It is exclusively assigned to the concentration parameter of the Dirichlet process when the model is specified using the Chinese Restaurant Process distribution, dCRP
. This sampler is assigned by default by NIMBLE's default MCMC configuration and can only be used when the prior for the concentration parameter is a gamma distribution. The assigned sampler is an augmented betagamma sampler as discussed in Section 6 in Escobar and West (1995).
The posterior_predictive sampler is only appropriate for use on terminal stochastic nodes. Note that such nodes play no role in inference but have often been included in BUGS models to accomplish posterior predictive checks. NIMBLE allows posterior predictive values to be simulated independently of running MCMC, for example by writing a nimbleFunction to do so. This means that in many cases where terminal stochastic nodes have been included in BUGS models, they are not needed when using NIMBLE.
The posterior_predictive sampler functions by calling the simulate() method of relevant node, then updating model probabilities and deterministic dependent nodes. The application of a posterior_predictive sampler to any nonterminal node will result in invalid posterior inferences. The posterior_predictive sampler will automatically be assigned to all terminal, nondata stochastic nodes in a model by the default MCMC configuration, so it is uncommon to manually assign this sampler.
Closely related, the posterior_predictive_branch is only appropriate for nodes for which all downstream (dependent) nodes are nondata; that is, the branch beginning from that node is a jointly posterior predictive network of nodes. This sampler operates by calling the simulate method of all nodes in this downstream (nondata) network, which serves to improve MCMC mixing of the posterior predictive branch.
The posterior_predictive and posterior_predictive_branch samplers accept no control list arguments.
This sampler proposes addition/removal for variable of interest in the framework of variable selection using reversible jump MCMC, with a specified prior probability of inclusion. A normal proposal distribution is used to generate proposals for the addition of the variable. This is a specialized sampler used by configureRJ
function, when the model code is written without using indicator variables. See help{configureRJ}
for details. It is not intended for direct assignment.
This sampler proposes transitions of a binary indicator variable, corresponding to a variable of interest, in the framework of variable selection using reversible jump MCMC. This is a specialized sampler used by configureRJ
function, when the model code is written using indicator variables. See help{configureRJ}
for details. It is not intended for direct assignment.
This sampler operates in the framework of variable selection using reversible jump MCMC. Specifically, it conditionally performs updates of the target variable of interest using the originallyspecified sampling configuration, when variable is "in the model". This is a specialized sampler used by configureRJ
when adding a reversible jump MCMC . See help{configureRJ}
for details. It is not intended for direct assignment.
As of Version 0.10.0 of NIMBLE, the RW_PF
and RW_PF_block
samplers live in the 'nimbleSMC' package. Please load that package in order to use the samplers.
Daniel Turek
Andrieu, C., Doucet, A., and Holenstein, R. (2010). Particle Markov Chain Monte Carlo Methods. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 72(3), 269342.
Escobar, M. D., and West, M. (1995). Bayesian density estimation and inference using mixtures. Journal of the American Statistical Association, 90(430), 577588.
KnorrHeld, L. and Rue, H. (2003). On block updating in Markov random field models for disease mapping. Scandinavian Journal of Statistics, 29, 597614.
Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., and Teller, E. (1953). Equation of State Calculations by Fast Computing Machines. The Journal of Chemical Physics, 21(6), 10871092.
Murray, I., Prescott Adams, R., and MacKay, D. J. C. (2010). Elliptical Slice Sampling. arXiv eprints, arXiv:1001.0175.
Neal, R. M. (2000). Markov chain sampling methods for Dirichlet process mixture models. Journal of Computational and Graphical Statistics, 9(2), 249265.
Neal, R. M. (2003). Slice Sampling. The Annals of Statistics, 31(3), 705741.
Pitt, M.K. and Shephard, N. (1999). Filtering via simulation: Auxiliary particle filters. Journal of the American Statistical Association 94(446), 590599.
Roberts, G. O. and S. K. Sahu (1997). Updating Schemes, Correlation Structure, Blocking and Parameterization for the Gibbs Sampler. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 59(2), 291317.
Shaby, B. and M. Wells (2011). Exploring an Adaptive Metropolis Algorithm. 201114. Department of Statistics, Duke University.
Stan Development Team (2020). Stan Language Reference Manual, Version 2.22, Section 10.12.
Tibbits, M. M., Groendyke, C., Haran, M., and Liechty, J. C. (2014). Automated Factor Slice Sampling. Journal of Computational and Graphical Statistics, 23(2), 543563.
van Dyk, D.A. and T. Park. (2008). Partially collapsed Gibbs Samplers. Journal of the American Statistical Association, 103(482), 790796.
configureMCMC
addSampler
buildMCMC
runMCMC
## y[1] ~ dbern() or dbinom(): # mcmcConf$addSampler(target = 'y[1]', type = 'binary') # mcmcConf$addSampler(target = 'a', type = 'RW', # control = list(log = TRUE, adaptive = FALSE, scale = 3)) # mcmcConf$addSampler(target = 'b', type = 'RW', # control = list(adaptive = TRUE, adaptInterval = 200)) # mcmcConf$addSampler(target = 'p', type = 'RW', # control = list(reflective = TRUE)) ## a, b, and c all continuousvalued: # mcmcConf$addSampler(target = c('a', 'b', 'c'), type = 'RW_block') # mcmcConf$addSampler(target = 'p', type = 'RW_llFunction', # control = list(llFunction = RllFun, includesTarget = FALSE)) # mcmcConf$addSampler(target = 'y[1]', type = 'slice', # control = list(adaptive = FALSE, sliceWidth = 3)) # mcmcConf$addSampler(target = 'y[2]', type = 'slice', # control = list(adaptive = TRUE, sliceMaxSteps = 1)) # mcmcConf$addSampler(target = 'x[1:10]', type = 'ess') ## x[1:10] ~ dmnorm() # mcmcConf$addSampler(target = 'x[1:5]', type = 'RW_multinomial') ## x[1:5] ~ dmulti() # mcmcConf$addSampler(target = 'p[1:5]', type = 'RW_dirichlet') ## p[1:5] ~ ddirch() ## y[1] is a posterior predictive node: # mcmcConf$addSampler(target = 'y[1]', type = 'posterior_predictive')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.