PMetropolis {Umacs} | R Documentation |
Generates an object including the information necessary to generate a ``Parallel Metropolis" updating step for a parameter, within the main loop of an iterative sampler function.
The sampler is built using the Umacs function Sampler
;
and the arguments (update
and init
)
are embedded in the sampler function.
PMetropolis(logpost = NULL, init, proposal = NULL, adapt.scale.function = "scaleAdapt.PMetropolis", scale.jump = NA, class. = "PMetropolis", byCol = FALSE)
logpost |
An R function calculating the value (a vector!) of the unnormalized log-posterior function given all other arguments |
init |
An R function that returns a (random) starting point (a vector) for a Markov chain for the parameter |
proposal |
(not used now) |
adapt.scale.function |
name of the function used to adapt the proposal kernel (usually, just ignore and use the default) |
scale.jump |
The scale of the proposal kernel matrix, if adaptation is not to be used |
class. |
(for internal use only; ignore) |
byCol |
code{TRUE} if the parameter is a matrix consisting of columns of independent vectors; the default is code{FALSE}: the parameter is a matrix consisting of rows of independent vectors |
The `PMetropolis' is short for `Parallel Metropolis':
the parameter to be updated is a matrix consisting of
rows of independently updateable vectors.
That is, each row of the matrix can be updated independently (``in parallel'')
using a (vector) Metropolis updating step.
(Alternatively the independent vectors can be in the columns of the matrix,
if the argument byCol
is set to TRUE
.)
In other words, you would use PMetropolis
if conditional on other parameters in the model,
you have independent (exchangeable) vector-valued parameters
that you wish to update using the Metropolis algorithm.
If instead you have conditionally independent scalar-valued parameters,
use PSMetropolis
instead.
An alternative to using PMetropolis
is to define
each row as a separate parameter, but this would be cumbersome and
require lots of repetitive coding, and the code would not be
optimized.
PMetropolis
is to be used only within the Sampler
function call.
The arguments of the update and init functions are ignored.
The body of the function can contain references to any parameters
that are defined in the Sampler
function call, or to any
variables in an enclosing environment (such as the Global Environment).
The name of the parameter that is being updated is not specified here,
but only within the Sampler
function call.
An object of class PMetropolis
,
to be further processed by the Umacs function Sampler
.
Jouni Kerman <jouni@kerman.com>
Kerman, Jouni. Umacs: A Universal Markov Chain Sampler. Technical report, Columbia University, New York.
Umacs-package
for an overview of the Umacs package.
Sampler
for how to create a sampler function; see the vignette for details.
Package `rv'.