cauchy.chain: The MC chain of Cauchy distribution

Description Usage Arguments Details Value Examples

Description

Give a MC chain of Cauchy distribution with location parameter location and scale parameter scale.

Usage

1
cauchy.chain(n, sigma, x0, location, scale)

Arguments

n

the length of the chain.

sigma

The standard deviation of the proposed distribution.

x0

The initial value of the chain.

location, scale

location and scale parameters.

Details

If location or scale are not specified, they assume the default values of 0 and 1 respectively.

The Cauchy distribution with location l and scale s has density f(x)=1/(pi s(1+((x-l)/s)^2)) for all x.

Value

x return the chain. k Returns the number of rejections.

Examples

1
2
3
4
5
6
7
8
## Not run: 
n<-10000
cauchy<-cauchy.chain(n,sigma=1,x0=0,location=0,scale=1)
cauchy$k/n
hist(cauchy$x[1001:n],freq=FALSE,main="cauchy",breaks=60)
curve(dcauchy(x,0,1),add=TRUE)

## End(Not run)

JieHu18039/StatComp documentation built on May 18, 2019, 12:25 p.m.