Learn R Programming

binomialcftp (version 1.0)

bin_ps: CFTP Binomial Random Numbers

Description

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

Usage

bin_ps(x, n, p)

Arguments

x
sample_size:number of random numbers desired
n
n= binomial parameter
p
p= binomial parameter

Value

values
Random numbers
iteration_needed
Number of iterations needed until coalescence
rand_used
Number of random numbers used

Details

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

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

Run this code
bin_ps(1000, 20, 0.5)

Run the code above in your browser using DataLab