Metropolis_OAAT_jump {HydroPortailStats}R Documentation

One-At-A-Time Metropolis sampler

Description

Performs a single iteration of the OAAT Metropolis sampler (simulated vector is updated one component at a time). a.k.a block Metropolis sampler with blocks of length one. Sometimes also called 'Metropolis-within-Gibbs'.

Usage

Metropolis_OAAT_jump(f, x0, fx0, sdjump, ...)

Arguments

f

function, log-pdf of the target distribution

x0

numeric vector, starting point

fx0

numeric, f(x0)

sdjump

numeric vector, standard deviation of the Gaussian jump for each component

...

other arguments passed to f

Value

A list with the following components:

x

numeric vector, updated point after the iteration

fx

numeric, updated value f(x)

move

logical vector, TRUE for components of the vector x that changed

Examples

# Bivariate target distribution: beta(2,10) X exp(1)
f=function(x){stats::dbeta(x[1],2,10,log=TRUE)+stats::dexp(x[2],log=TRUE)}
x0=c(0.5,0.5)
fx0=f(x0)
sdjump=c(0.1,0.1)
Metropolis_OAAT_jump(f,x0,fx0,sdjump)

[Package HydroPortailStats version 1.0.3 Index]