Some useful NAG routines: Discrete distributions: Uniform distribution POINT=(easy to calculate) GEN=G05DYF Binomial distribution POINT=G01BJF GEN=G05EDF Geometric distribution POINT= GEN= Poisson distribution POINT=G01BKF GEN=G05DRF/G05ECF Continuous distributions: Uniform distribution DENS=(easy to calculate) GEN=G05FAF Normal distribution DENS= GEN=G05FDF Multinomial distribution DENS= GEN= Exponential distribution DENS= GEN=G05FBF Binormal distribution DENS= GEN= Lognormal distribution DENS= GEN=G05DEF Gamma distribution DENS= GEN=G05FFF Beta distribution DENS=G05FEF Dirichlet distribution DENS= GEN= POINT=which subroutine computes the point probablity function DENS=which subroutine computes the density function GEN=which subroutine generates random numbers G01 – Simple Calculations on Statistical Data G01BJF Binomial distribution function - G01BJF returns the lower tail, upper tail and point probabilities associated with a Binomial distribution. SUBROUTINE G01BJF(N,P,K,PLEK,PGTK,PEQK,IFAIL) INTEGER N,K,IFAIL real P,PLEK,PGTK,PEQK Here N,P are the parameters of the binomial distribution (N = number of tries, P = success prob) K is the point in which we are interested, PLEK, PGTK, PEQK are probabilities of X < K, X > K and X = K, respectively. G01BKF Poisson distribution function - G01BKF returns the lower tail, upper tail and point probabilities associated with a Poisson distribution. SUBROUTINE G01BKF(RLAMDA,K,PLEK,PGTK,PEQK,IFAIL) INTEGER K,IFAIL real RLAMDA,PLEK,PGTK,PEQK Here RLAMDA is the parameter of the Poisson distribution P(RLAMDA) K is the point in which we are interested, PLEK, PGTK, PEQK are probabilities of X < K, X > K and X = K, respectively. G01EEF Computes upper and lower tail probabilities and probability density function for the beta distribution - G01EEF computes the upper and lower tail probabilities and the probability density function of the beta distribution with parameters a and b. SUBROUTINE G01EEF(X,A,B,TOL,P,Q,PDF,IFAIL) INTEGER IFAIL real X,A,B,TOL,P,Q,PDF Here A and B are the parameters of the distribution Beta(A, B) TOL is the tolerance for error; the smallest number that must be able to express P and Q are the probabilities P(B =< X) and P(B >= X), respectively. PDF is the probability density function Beta(X: A, B) G01EFF Computes probabilities for the gamma distribution - G01EFF returns the lower or upper tail probability of the gamma distribution, with parameters a and b, via the routine name. - Note: No density function included! real FUNCTION G01EFF(TAIL,G,A,B,IFAIL) INTEGER IFAIL real G,A,B CHARACTER *1 TAIL G05LAF(Mark 20) Generates a vector of random numbers from a Normal distribution, seeds and generator number passed explicitly - G05LAF generates a vector of pseudo-random numbers taken from a Normal (Gaussian) distribution with mean XMU and variance VAR. SUBROUTINE G05LAF(XMU,VAR,N,X,IGEN,ISEED,IFAIL) INTEGER N,IGEN,ISEED(4),IFAIL real XMU,VAR,X(*) G05LEF(Mark 20) Generates a vector of random numbers from a beta distribution, seeds and generator number passed explicitly G05DBF Pseudo-random real numbers, (negative) exponential distribution G05DEF Pseudo-random real numbers, log-normal distribution G05EBF Set up reference vector for generating pseudo-random integers, uniform distribution