PSMetropolis {Umacs} | R Documentation |
Generates an object including the information necessary to generate a 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.
See Sampler
for further details.
PSMetropolis(logpost = NULL, init, proposal = NULL, adapt.scale.function = "scaleAdapt.PMetropolis", scale.jump = NA, class. = "PSMetropolis")
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) |
PSMetropolis
is a special case of the PMetropolis
sampling scheme.
The parameter to be updated is a vector consisting of
independently updateable scalars.
That is, each component of the vector can be updated independently (``in parallel'')
using a (scalar) Metropolis updating step.
In other words, you would use PSMetropolis
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 vector-valued parameters,
that is, a matrix of independently updateable rows or columns,
use PMetropolis
.
An alternative to using PSMetropolis
is to define
each component as a separate parameter, but this would be very cumbersome and
require lots of repetitive coding, and the code would not be optimized.
PSMetropolis
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.
See the documentation for examples.
An object of class PSMetropolis
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'.