Nothing
random_walk <- function(pd, start, num_steps){
y <- rep(0, num_steps)
current <- start
for (j in 1:num_steps){
candidate <- current + sample(c(-1, 1), 1)
prob <- pd(candidate) / pd(current)
if (runif(1) < prob) current <- candidate
y[j] <- current
}
return(y)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.