Description Usage Arguments Value Examples
A random walk Metropolis sampler using R
1 | rwMetropolisC(sigma, x0, N)
|
sigma |
the sd |
x0 |
the initial value |
N |
the number of samples |
a random sample of size n
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
N <- 2000
sigma <- c(.05, .5, 2, 16)
x0 <- 25
rw1 <- rwMetropolisC(sigma[1], x0, N)
rw2 <- rwMetropolisC(sigma[2], x0, N)
rw3 <- rwMetropolisC(sigma[3], x0, N)
rw4 <- rwMetropolisC(sigma[4], x0, N)
rw <- cbind(rw1$x, rw2$x, rw3$x, rw4$x)
print(c(rw1$k, rw2$k, rw3$k, rw4$k))
print(c(1-rw1$k/N,1-rw2$k/N,1-rw3$k/N,1-rw4$k/N))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.