Mcmc
Functions for constucting generic Metropolis-Hastings MCMC algorithms, and associated utilities. Can be used in conjunction with an unbiased estimate of marginal model likelihood for constructing pseudo-marginal MCMC algorithms, such as PMMH pMCMC.
Value members
Concrete methods
Autocorrelation function
Autocorrelation function
- Value Params
- lm
Maximum lag required
- x
Input data
- Returns
A vector of autocorrelations
Function to construct a generic Metropolis-Hastings MCMC algorithm for Bayesian inference. Note that this algorithm avoids re-computation of the log-likelihood associated with the current state, and is therefore suitable for use with the log of an unbiased estimate of likelihood for the constuction of pseudo-marginal "exact approximate" MCMC algorithms.
Function to construct a generic Metropolis-Hastings MCMC algorithm for Bayesian inference. Note that this algorithm avoids re-computation of the log-likelihood associated with the current state, and is therefore suitable for use with the log of an unbiased estimate of likelihood for the constuction of pseudo-marginal "exact approximate" MCMC algorithms.
- Value Params
- dprior
A function to evaluate the log of the prior density
- dprop
A function to evaluate the log-likelihood of the proposal transition kernel
- init
The initial state of the MCMC algorithm
- logLik
The log-likelihood of the model
- rprop
A function to sample from a proposal distribution
- verb
Should the function print diagnostic information to the console at each iteration?
- Returns
An infinite
Stream
corresponding to the MCMC chain. Note that this can be processed with typical Scala combinators such asdrop
(for burn-in) andtake
(for run-length). IfTypes
are imported, there is also athin
method (which can be used for thinning the chain).
Function for executing one step of a MH algorithm. Called by mhStream
.
Function for executing one step of a MH algorithm. Called by mhStream
.
Generate some basic diagnostics associated with an MCMC run. Called purely for the side-effect of generating output on the console.
Generate some basic diagnostics associated with an MCMC run. Called purely for the side-effect of generating output on the console.
- Value Params
- lm
Max lag for ACF plot
- m
A matrix, such as generated by
toDMD
containing MCMC output- plt
Generate plots?
Wrapper around the other summary
function which takes a Stream
Wrapper around the other summary
function which takes a Stream
- Value Params
- plot
Generate plots?
- s
A finite stream of MCMC iterations.
Utility function to convert a finite Stream
(or other collection) to a Breeze DenseMatrix[Double]
.
Utility function to convert a finite Stream
(or other collection) to a Breeze DenseMatrix[Double]
.
- Value Params
- s
Input stream/collection, which must be finite.
- Returns
A matrix with rows corresponding to iterations and columns corresponding to variables.