Metropolis: generate Markov chains for specific distribution based on...

Description Usage Arguments Details References Examples

Description

This function generates a Markov chain using a random walk Metropolis-Hastings algorithm.The user supplies target distribution, burn-in time, the length of the chain and the variance of proposal distribution. And a Markov chain after discarding burn-in samples is returned, which can be used for monitoring convengence.

Usage

1
Metropolis(burn_in=1000,dist=dcauchy,sigma,N=10000,print_acc=F)

Arguments

burn_in

the total length of discarding

dist

the target distribution

sigma

the variance of the normal proposal distribution

N

the length of Markov chain

print_acc

if print acceptance rate or not

Details

Metropolis generates a Markov chain using a Metropolis-Hastings algorithm. The aim is to generate random numbers from specific distribution based on Normal proposal distribution

References

Statistic computing with R. Maria L. Rizzo

Examples

1
2
3
4
5
## Not run: 
y=Metropolis(sigma=2,print_acc=T)
plot(density(Metropolis(sigma = 3,print_acc = T)))

## End(Not run)

Scopia/StatComp18053 documentation built on May 22, 2019, 2:44 p.m.