OneMove {Rtwalk} | R Documentation |
One move of the t-walk
Description
Evaluates the t-walk kernel once and returns the proposed jumping points and the acceptance propability.
Usage
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= |
Supp |
a function that takes a vector of length= |
x |
First of a pair of initial points, within the support of the objective function. |
U |
Current value of |
xp |
Second of a pair of initial points, within the support of the objective function. |
Up |
Current value of |
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 |
pphi |
See description for |
F1 |
See description for |
F2 |
See description for |
F3 |
See description for |
... |
Other parameters passed to |
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
Examples
#### 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.