Description Usage Arguments Value Examples
Metroplis flipping to improve mixing
1 | metrop_flip(x, curr_prob)
|
x |
current value, 0 or 1 |
curr_prob |
current probability of being 1 |
a binary value
1 2 3 4 5 6 7 8 9 10 11 | metrop_flip(1,0.2)
p = 0.3
x <- rep(NA,1000)
x[1] <- 0
for (iter in 2:1000){
x[iter] <- metrop_flip(x[iter-1],p)
}
plot(x,type="l",main=mean(x))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.