random.M: A random walk Metropolis sampler for generating the standard...

Description Usage Arguments Value Examples

View source: R/ex.R

Description

A random walk Metropolis sampler for generating the standard Laplace distribution

Usage

1
random.M(sigma, x0, N)

Arguments

sigma

the standard deviation of the sample-generating normal distribution

x0

Initial values for the random walk

N

number of the generated samples

Value

alist of a Markov Chain sampled from standard Laplace distribution and the times of rejection

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
N=2000
sigma = c(.05, .5, 2, 16)
x0=20
R1=random.M(sigma[1],x0,N)
R2=random.M(sigma[2],x0,N)
R3=random.M(sigma[3],x0,N)
R4=random.M(sigma[4],x0,N)

## End(Not run)

XixuHu/SC19090 documentation built on Jan. 2, 2020, 8:40 p.m.