Computer Routines for Statistical Data Analysis
G. Cowan, Statistical Data Analysis
Computer Routines and Data Files
FORTRAN routines and sample data:

random.f, a multiplicative linear congruential random number generator.
 test_random.f, a
test program for random.f and
HBOOK histogram software.
 test_rnpssn.f, a
test program for generating Poisson distributed numbers with
RNPSSN (CERN routine V136).
 pmt.f simulates electron multiplication
in a photomultiplier tube. (Uses
RNPSSN.)
 compute_chi2.f reads
in a histogram and theoretical prediction from files and computes
a chi2 statistic. Sample data are contained in
data_1.dat, and two files with different
predictions are theory_1.dat and
theory_2.dat.
 compute_chi2_dist.f reads
a file with expectation values for the bins of a histogram, generates
Monte Carlo data according to a Poisson distribution for each bin, and
computes a chi2 statistic. The MC experiment is repeated to determine the
distribution of the statistic, which is compared to the usual chi2
distribution.
 fit_galileo.f, a sample
program for using the
MINUIT minimization routines, reads in
a data file and performs a least squares fit. The program must
be linked to the MINUIT routines from the CERN library as well
as to the routine FCN. A sample FCN is in
fcn_galileo.f, and a data file with measurements
by Galileo is in galileo.dat.
 poislo.f,
poisup.f, and poisint.f,
subroutines for computing upper and lower confidence limits for a
Poisson parameter. The routines must be linked with
CHISIN (quantile of chi2 distribution, routine G101) from the CERN Program
Library.
 ffinv.f, a function that
returns the quantile of the F distribution (i.e. inverse of the
cumulative distribution). The file ffinv.f includes the routines
ALNGAM, XINBTA and BETAIN from StatLib
(Applied Statistics
algorithms).
 binomlo.f,
binomup.f, and
binomint.f, subroutines for computing upper and
lower confidence limits for a binomial parameter p. The routines must
be linked with FFINV, ALNGAM, XINBTA and BETAIN.
C++ versions are available for some of the routines: