CFTP Binomial Random Numbers

Share:

Description

Main function, return 0-n binomial distributed random numbers according to the coupling from the past algorithm

Usage

1
bin_ps(x, n, p)

Arguments

x

sample_size:number of random numbers desired

n

n= binomial parameter

p

p= binomial parameter

Details

As usual,p should be between 0 and 1 and n should be any positive integer

Value

values

Random numbers

iteration_needed

Number of iterations needed until coalescence

rand_used

Number of random numbers used

Note

Running time is different as n and p change

Author(s)

Francisco Juretig <fjuretig@yahoo.com>

References

James G. Propp and David B. Wilson. Exact sampling with coupled Markov chains and applications to statistical mechanics. Random Structures and Algorithms, 9(1&2):223–252, 1996.

Examples

1
bin_ps(1000, 20, 0.5)