Description Usage Arguments Value Author(s) References See Also Examples
Evaluates the t-walk kernel once and returns the proposed jumping points and the acceptance propability.
1 2 3 |
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 |
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.
J Andres Christen (CIMAT, Guanajuato, MEXICO).
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
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.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.