Delila Program: binomial

# binomial program

## Pascal source code: binomial.p (wget instructions) Instructions on compiling Alphabetic List of Delila Programs Delila Programs by Most Recent Update Please report broken links Copyright Statement for Delila Programs

### Documentation for the binomial program is below, with links to related programs in the "see also" section.

```{   version = 1.50; (* of binomial.p 2003 Sep 4}

(* begin module describe.binomial *)
(*
name
binomial: produce the binomial probabilities for a found black to white ratio

synopsis
binomial(xyin: out, xyplop: out, binomialp: in, output: out)

files

xyin: a table of probabilities of finding the given white to black ratio,
versus the probability.  The form is a series of comment lines that
begin with '* ', followed by two columns of numbers.

The first column is the number of whites.

The second column is the corresponding value of p(white:black|pw) = the
probability of obtaining the number of white and black given pw, the
probability of white.  This file is direct input to the xyplo program.

The third column is the cumulative sum of the second column.

xyplop: the controls for the xyplo program to generate the graph.
These may be modified by the user before plotting.

binomialp: parameters to control the program, on three lines:

balls: one integer on the first line, representing the total number of
black and white balls obtained in an experiment

probability of white in the population.

plot max: maximum number of balls to compute.  This allows one
to limit the distribution plotted.

description

Suppose there exists a large bin containing both black and white balls.
The true fraction of white balls in the bin is fraction, and the fraction
of black balls is (1-fraction).  We obtain a sample of black and white
balls from the bin, given as the first two parameters in binomialp.  The
probability of getting this black:white sample is:

(black+white)!         white             black
p(white:black|fraction) = -------------- fraction      (1-fraction)
black!white!

The program generates these probabilities for a given fraction.
The results are in a form that the xyplo program can use to plot.

examples
From Breiman1969 pages 24 and 25:

The graphs on these pages can be simulated.

Problem 6 a: "Compute the probability of getting exactly 10 Heads
in 20 tosses of a fair coin. (Ans. .18)"

For the binomialp file:

20      total number of black balls and white balls in an experiment
0.5     probability of drawing a white
100     plot max: maximum number of whites to show.

Along with the rest of the distribution, program gives in xyin:
10 0.1761970520020

documentation

@book{Breiman1969,
author = "L. Breiman",
title = "Probability and Stochastic Processes:
With a View Toward Applications",
publisher = "Houghton Mifflin Company",
year = "1969"}

xyplo.p, binplo.p

author
Thomas Dana Schneider

bugs
none known

*)
(* end module describe.binomial *)
{This manual page was created by makman 1.44}
```