OneMove: One move of the t-walk

Description Usage Arguments Value Author(s) References See Also Examples

Description

Evaluates the t-walk kernel once and returns the proposed jumping points and the acceptance propability.

Usage

1
2
3
OneMove(dim, Obj, Supp, x, U, xp, Up,
  at=6, aw=1.5, pphi=min( dim, 4)/dim, F1=0.4918, F2=0.9836, F3=0.9918
  , ...) 

Arguments

dim

dimension of the objective function.

Obj

a function that takes a vector of length=dim and returns -log of the objective function, besides an adding constant.

Supp

a function that takes a vector of length=dim and returns TRUE if the vector is within the support of the objective and FALSE otherwise. Supp is *always* called right before Obj.

x

First of a pair of initial points, within the support of the objective function. x0 and xp must be different.

U

Current value of Obj at x.

xp

Second of a pair of initial points, within the support of the objective function. x0 and xp must be different.

Up

Current value of Obj at xp.

at

The remaining parameters are the traverse and walk kernel parameters, the parameter choosing probability and the cumulative probabilities of choosing each kernel. These are not intended to be modified in standard calculations.

aw

See description for at.

pphi

See description for at.

F1

See description for at.

F2

See description for at.

F3

See description for at.

...

Other parameters passed to Obj.

Value

A list with the following items:

y, yp propolsals.
propU, propUp value of the objective at y and yp.
A Metropilis-Hastings ratio, acceptance probability = min(1,move$A).
funh Kernel used: 1=traverse, 2=walk, 3=hop, 4=blow.

Author(s)

J Andres Christen (CIMAT, Guanajuato, MEXICO).

References

Christen JA and Fox C (2010). A general purpose sampling algorithm for continuous distributions (the t-walk)., Bayesian Analysis, 5 (2), 263-282. URL: http://ba.stat.cmu.edu/journal/2010/vol05/issue02/christen.pdf

See Also

Runtwalk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  

#### We first load the twalk package:
library(Rtwalk)



#### A ver simple example, 4 independent normals N(0,1):
x <- runif( 4, min=20, max=21)
xp <-  runif( 4, min=20, max=21)
U <- sum(x^2)/2
Up <- sum(x^2)/2

move  <- OneMove( dim=4, Obj=function(x) { sum(x^2)/2 }
  , Supp=function(x) { TRUE }, x=x, U=U, xp=xp, Up=Up)

if (runif(1) < move$A) ### the actual acceptance probability is min(1,A)
{ ## accepted
      x <- move$y
      U <- move$propU

      xp <- move$yp
      Up <- move$propUp

}
##else Not accepted


### etc.

Rtwalk documentation built on May 2, 2019, 3:45 a.m.

Related to OneMove in Rtwalk...