7 Random Number Distributions
This chapter describes the functions for generating random variates and computing their probability densities provided by the Science Collection/
The functions described in this chapter are defined in the random-distributions sub-collection of the Science Collection. All of the modules in the random-distributions sub-collection can be made available using the form:
(require williams/science/random-distributions)
The random distribution graphics are provided as separate modules. To also include the random distribution graphics routines, use the following form:
(require williams/science/random-distributions-with-graphics)
The individual modules in the random-distributions sub-collection can also be made available as described in the sections below.
7.1 The Beta Distribution
Beta Distribution from Wolfram MathWorld.
The beta distribution functions are defined in the "beta.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
7.1.1 Random Variates from the Beta Distribution
Returns a random variate from the beta distribution with parameters
a and
b using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the beta distribution with parameters a = 2.0 and b = 3.0.
The following figure shows the resulting histogram:
7.1.2 Beta Distribution Density Functions
Computes the probability density, p(x), at x for the beta distribution with parameters a and b.
Computes the cumulative density, d(x), at x for the beta distribution with parameters a and b.
7.1.3 Beta Distribution Graphics
The beta distribution graphics are defined in the "beta-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/beta-graphics)) |
Returns a plot of the probability density and cumulative density of the beta distribution with parameters a and b. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the beta distribution with parameters a = 2.0 and b = 3.0.
The following figure shows the resulting plot:
7.2 The Bivariate Gaussian Distribution
Bivariate Normal Distribution from Wolfram MathWorld.
The bivariate Gaussian distribution functions are defined in the "bivariate-gaussian.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/bivariate-gaussian)) |
7.2.1 Random Variates from the Bivariate Haussian Distribution
Returns a pair of correlated Gaussian variates, with mean 0, correlation coefficient
rho, and standard deviations
sigma-x and
sigma-y in the
x and
y directions using the random source
s or
(current-random-source) if
s is not provided. The correlation coefficient
rho must lie between -1 and 1.
Example: 2D histogram of random variates from the bivariate Gaussian distribution with standard deviation 1.0 in both the x and y direction and correlation coefficient 0.0.
The following figure shows the resulting histogram:
7.2.2 Bivariate Gaussian Distribution Density Functions
Computes the probability density, p(x, y), at (x, y) for the bivariate gaussian distribution with mean 0, correlation coefficient rho, and standard deviations sigma-x and sigma-y in the x and y directions.
7.2.3 Bivariate Gaussian Distribution Graphics
The bivariate Gaussian distribution graphics are defined in the "bivariate-gaussian-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/bivariate-gaussian-graphics)) |
Returns a plot of the probability density and cumulative density of the bivariate Gaussian distribution with mean 0, correlation coefficient rho, and standard deviations sigma-x and sigma-y in the x and y directions. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the bivariate Gaussian distribution mean 0, correlation coefficient 0.0, and standard deviations 1.0 and 1.0 in the x and y directions.
The following figure shows the resulting plot:
7.3 The Chi-Squared Distribution
Chi-Squared Distribution from Wolfram MathWorld.
The chi-squared distribution functions are defined in the "chi-squared.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/chi-squared)) |
7.3.1 Random Variates from the Chi-Squared Distribution
Returns a random variate from the chi-squared distribution with
nu degrees of freedom using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the chi-squared distribution with 3.0 degrees of freedom.
The following figure shows the resulting histogram:
7.3.2 Chi-Squared Distribution Density Functions
Computes the probability density, p(x), at x for the chi-squared distribution with nu degrees of freedom.
Computes the cumulative density, d(x), at x for the chi-squared distribution with nu degrees of freedom.
7.3.3 Chi-Squared Distribution Graphics
The chi-squared distribution graphics are defined in the "chi-squared-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/chi-squared-graphics)) |
Returns a plot of the probability density and cumulative density of the chi-squared distribution with nu degrees of freedom. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the chi-squared distribution with 3.0 degrees of freedom.
The following figure shows the resulting plot:
7.4 The Exponential Distribution
Exponential Distribution from Wolfram MathWorld.
The exponential distribution functions are defined in the "exponential.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/exponential)) |
7.4.1 Random Variates from the Exponential Distribution
Returns a random variate from the exponential distribution with mean
mu using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the exponential distribution with mean 1.0.
The following figure shows the resulting histogram:
7.4.2 Exponential Distribution Density Functions
Computes the probability density, p(x), at x for the exponential distribution with mean mu.
Computes the cumulative density, d(x), at x for the exponential distribution with mean mu.
7.4.3 Exponential Distribution Graphics
The exponential distribution graphics are defined in the "exponential-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/exponential-graphics)) |
Returns a plot of the probability density and cumulative density of the exponential distribution with mean mu. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the exponential distribution with mean 3.0.
The following figure shows the resulting plot:
7.5 The F-Distribution
F-Distribution from Wolfram MathWorld.
The F-distribution functions are defined in the "f-distribution.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/f-distribution)) |
7.5.1 Random Variates from the F-Distribution
Returns a random variate from the F-distribution with
nu1 and
nu2 degrees of freedom using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the F-distribution with 2.0 and 3.0 degrees of freedom.
The following figure shows the resulting histogram:
7.5.2 F-Distribution Density Functions
Computes the probability density, p(x), at x for the F-distribution with nu1 and nu2 degrees of freedom.
Computes the cumulative density, d(x), at x for the F-distribution with nu1 and nu2 degrees of freedom.
7.5.3 F-Distribution Graphics
The F-distribution graphics are defined in the "f-distribution-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/f-distribution-graphics)) |
Returns a plot of the probability density and cumulative density of the F-distribution with nu1 and nu2 degrees of freedom. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the Fdistribution with 2.0 and 3.0 degrees of freedom.
The following figure shows the resulting plot:
7.6 The Flat (Uniform) Distribution
Uniform Distribution from Wolfram MathWorld.
The flat (uniform) distribution functions are defined in the "flat.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
Note that the name flat is used because uniform is already used for the more primitive random number functions in SRFI 27. Note that also matches the convention in the GNU Scientific Library [GSL-RM].
7.6.1 Random Variates from the Flat (Uniform) Distribution
Returns a random variate from the flat (uniform) distribution from
a to
b using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the flat (uniform) distribution from 1.0 to 4.0.
The following figure shows the resulting histogram:
7.6.2 Flat (Uniform) Distribution Density Functions
Computes the probability density, p(x), at x for the flat (uniform) distribution from a to b.
Computes the cumulative density, d(x), at x for the flat (uniform) distribution from a to b.
7.6.3 Flat (Uniform) Distribution Graphics
The flat (uniform) distribution graphics are defined in the "flat-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/flat-graphics)) |
Returns a plot of the probability density and cumulative density of the flat (uniform) distribution from a to b. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the flat (uniform) distribution from 1.0 to 4.0.
The following figure shows the resulting plot:
7.7 The Gamma Distribution
Gamma Distribution from Wolfram MathWorld.
The gamma distribution functions are defined in the "gamma.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
7.7.1 Random Variates from the Gamma Distribution
Returns a random variate from the gamma distribution with parameters
a and
b using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the gamma distribution with parameters 3.0 and 3.0.
The following figure shows the resulting histogram:
7.7.2 Gamma Distribution Density Functions
Computes the probability density, p(x), at x for the gamma distribution with parameters a and b.
Computes the cumulative density, d(x), at x for the gamma distribution with parameters a and b.
7.7.3 Gamma Distribution Graphics
The gamma distribution graphics are defined in the "gamma-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/gamma-graphics)) |
Returns a plot of the probability density and cumulative density of the gamma distribution with parameters a and b. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the gamma distribution with parameters 3.0 and 3.0.
The following figure shows the resulting plot:
7.8 The Gaussian (Normal) Distribution
Normal Distribution from Wolfram MathWorld.
The Gaussian (normal) distribution functions are defined in the "gaussian.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/gaussian)) |
7.8.1 Random Variates from the Gaussian (Normal) Distribution
Returns a random variate from the Gaussian (normal) distribution with mean
mu and standard deviation
sigma using the random source
s or
(current-random-source) if
s is not provided. This function uses the Box-Mueller algorithm that requires two calls to the random source
s.
Example: Histogram of random variates from the Gaussian (normal) distribution with mean 10.0 and standard deviation 2.0.
The following figure shows the resulting histogram:
Returns a random variate from the Gaussian (normal) distribution with mean
0
.0
and standard deviation
1
.0
using the random source
s or
(current-random-source) if
s is not provided. This function uses the Box-Mueller algorithm that requires two calls to the random source
s.
Example: Histogram of random variates from the unit Gaussian (normal) distribution.
The following figure shows the resulting histogram:
Returns a random variate from the Gaussian (normal) distribution with mean
mu and standard deviation
sigma using the random source
s or
(current-random-source) if
s is not provided. This function uses the Kinderman-Monahan ratio method.
Returns a random variate from the Gaussian (normal) distribution with mean
0
.0
and standard deviation
1
.0
using the random source
s or
(current-random-source) if
s is not provided. This function uses the Kinderman-Monahan ratio method.
7.8.2 Gaussian (Normal) Distribution Density Functions
Computes the probability density, p(x), at x for the Gaussian (normal) distribution with mean mu and standard deviation sigma.
Computes the cumulative density, d(x), at x for the Gaussian (normal) distribution with mean mu and standard deviation sigma.
Computes the probability density, p(x), at x for the unit Gaussian (normal) distribution.
Computes the cumulative density, d(x), at x for the unit Gaussian (normal) distribution.
7.8.3 Gaussian (Normal) Distribution Graphics
The Gaussian (normal) distribution graphics are defined in the "gaussian-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/gaussian-graphics)) |
Returns a plot of the probability density and cumulative density of the Gaussian (normal) distribution with mean mu and standard deviation sigma. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the Gaussian (normal) distribution with parameters mean 10.0 and standard deviation 2.0.
The following figure shows the resulting plot:
Returns a plot of the probability density and cumulative density of the unit Gaussian (normal) distribution. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the unit Gaussian (normal) distribution.
The following figure shows the resulting plot:
7.9 The Gaussian Tail Distribution
The Gaussian tail distribution functions are defined in the "gaussian-tail.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/gaussian-tail)) |
7.9.1 Random Variates from the Gaussian Tail Distribution
Returns a random variate from the upper tail of the Gaussian distribution with mean
mu and standard deviation
sigma using the random source
s or
(current-random-source) if
s is not provided. The value returned is larger than the lower limit
a, which must be greater than the mean
mu.
Example: Histogram of random variates from the upper tail greater than 16.0 of the Gaussian distribution with mean 10.0 and standard deviation 2.0.
The following figure shows the resulting histogram:
Returns a random variate from the upper tail of the Gaussian distribution with mean
0
and standard deviation
1
using the random source
s or
(current-random-source) if
s is not provided. The value returned is larger than the lower limit
a, which must be greater than the mean
mu.
7.9.2 Gaussian Tail Distribution Density Functions
Computes the probability density, p(x), at x for the upper tail greater than a of the Gaussian distribution with mean mu and standard deviation sigma.
Computes the probability density, p(x), at x for the upper tail greater than a of the unit Gaussian distribution.
7.9.3 Gaussian Tail Distribution Graphics
The Gaussian tail distribution graphics are defined in the "gaussian-tail-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/gaussian-tail-graphics)) |
Returns a plot of the probability density and cumulative density of the upper tail greater than a of the Gaussian distribution with mean mu and standard deviation sigma. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the upper tail greater than 16.0 of the Gaussian distribution with parameters mean 10.0 and standard deviation 2.0.
The following figure shows the resulting plot:
Returns a plot of the probability density and cumulative density of the upper tail greater than a of the unit Gaussian distribution. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the upper tail greater than 3.0 of the unit Gaussian (normal) distribution.
The following figure shows the resulting plot:
7.10 The Log Normal Distribution
Log Normal Distribution from Wolfram MathWorld.
The log normal distribution functions are defined in the "lognormal.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/lognormal)) |
7.10.1 Random Variates from the Log Normal Distribution
Returns a random variate from the log normal distribution with mean
mu and standard deviation
sigma using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the log normal distribution with parameters mean 0.0 and standard deviation 1.0.
The following figure shows the resulting histogram:
7.10.2 Log Normal Distribution Density Functions
Computes the probability density, p(x), at x for the log normal distribution with mean mu and standard deviation sigma.
Computes the cumulative density, d(x), at x for the log normal distribution with mean mu and standard deviation sigma.
7.10.3 Log Normal Distribution Graphics
The log normal distribution graphics are defined in the "lognormal-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/lognormal-graphics)) |
Returns a plot of the probability density and cumulative density of the log normal distribution with mean mu and standard deviation sigma. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the log normal distribution with mean 0.0 and standard deviation 1.0.
The following figure shows the resulting plot:
7.11 The Pareto Distribution
Pareto Distribution from Wolfram MathWorld.
The Pareto distribution functions are defined in the "pareto.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
7.11.1 Random Variates from the Pareto Distribution
Returns a random variate from the Pareto distribution with parameters
a and
b using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the Pareto distribution with parameters a = 2.0 and b = 3.0.
The following figure shows the resulting histogram:
7.11.2 Pareto Distribution Density Functions
Computes the probability density, p(x), at x for the Pareto distribution with parameters a and b.
Computes the cumulative density, d(x), at x for the Pareto distribution with parameters a and b.
7.11.3 Pareto Distribution Graphics
The Pareto distribution graphics are defined in the "pareto-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/pareto-graphics)) |
Returns a plot of the probability density and cumulative density of the Pareto distribution with parameters a and b. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the Pareto distribution with parameters a = 1.0 and b = 1.0.
The following figure shows the resulting plot:
7.12 The t-Distribution
Student’s t-Distribution from Wolfram MathWorld.
The t-distribution functions are defined in the "t-distribution.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/t-distribution)) |
7.12.1 Random Variates from the t-Distribution
Returns a random variate from the t-distribution with
nu degrees of freedom using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the t-distribution with 1.0 degrees of freedom.
The following figure shows the resulting histogram:
7.12.2 t-Distribution Density Functions
Computes the probability density, p(x), at x for the t-distribution with nu degrees of freedom.
Computes the cumulative density, d(x), at x for the t-distribution with nu degrees of freedom.
7.12.3 t-Distribution Graphics
The t-distribution graphics are defined in the "t-distribution-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/t-distribution-graphics)) |
Returns a plot of the probability density and cumulative density of the t-distribution with nu degrees of freedom. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the t-distribution with 1.0 degrees of freedom.
The following figure shows the resulting plot:
7.13 The Triangular Distribution
Triangular Distribution from Wolfram MathWorld.
The triangular distribution functions are defined in the "triangular.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/triangular)) |
7.13.1 Random Variates from the Triangular Distribution
Returns a random variate from the triangular distribution with minimum value
a, maximum value
b, and most likely value
c using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the triangular distribution with minimum value 1.0, maximum value 4.0, and most likely value 2.0.
The following figure shows the resulting histogram:
7.13.2 Triangular Distribution Density Functions
Computes the probability density, p(x), at x for the triangular distribution with minimum value a, maximum value b, and most likely value c.
Computes the cumulative density, d(x), at x for the triangular distribution with minimum value a, maximum value b, and most likely value c.
7.13.3 Triangular Distribution Graphics
The triangular distribution graphics are defined in the "triangular-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/triangular-graphics)) |
Returns a plot of the probability density and cumulative density of the triangular distribution with minimum value a, maximum value b, and most likely value c. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the triangular distribution with minimum value 1.0, maximum value 4.0, and most likely value 2.0.
The following figure shows the resulting plot:
7.14 The Bernoulli Distribution
Bernoulli Distribution from Wolfram MathWorld.
The Bernoulli distribution functions are defined in the "bernoulli.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/bernoulli)) |
7.14.1 Random Variates from the Bernoulli Distribution
Returns a random variate from the Bernoulli distribution with probability
p using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the Bernoulli distribution with probability 0.6.
The following figure shows the resulting histogram:
7.14.2 Bernoulli Distribution Density Functions
Computes the probability density, p(k), at k for the Bernoulli distribution with probability p.
Computes the cumulative density, d(k), at k for the Bernoulli distribution with probability p.
7.14.3 Bernoulli Distribution Graphics
The Bernoulli distribution graphics are defined in the "bernoulli-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/bernoulli-graphics)) |
Returns a plot of the probability density and cumulative density of the Bernoulli distribution with probability p. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the Bernoulli distribution with probability 0.6.
The following figure shows the resulting plot:
7.15 The Binomial Distribution
Binomial Distribution from Wolfram MathWorld.
The binomial distribution functions are defined in the "binomial.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/binomial)) |
7.15.1 Random Variates from the Binomial Distribution
Returns a random variate from the binomial distribution with parameters
p and
n using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the binomial distribution with parameters 0.5 and 20.
The following figure shows the resulting histogram:
7.15.2 Binomial Distribution Density Functions
Computes the probability density, p(k), at k for the binomial distribution with parameters p and n.
7.15.3 Binomial Distribution Graphics
The binomial distribution graphics are defined in the "binomial-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/binomial-graphics)) |
Returns a plot of the probability density and cumulative density of the binomial distribution with parameters p and n. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the binomial distribution with parameters 0.5 and 20.
The following figure shows the resulting plot:
7.16 The Geometric Distribution
Geometric Distribution from Wolfram MathWorld.
The geometric distribution functions are defined in the "geometric.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/geometric)) |
7.16.1 Random Variates from the Geometric Distribution
Returns a random variate from the geometric distribution with probability
p using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the geometric distribution with probability 0.5.
The following figure shows the resulting histogram:
7.16.2 Geometric Distribution Density Functions
Computes the probability density, p(k), at k for the geometric distribution with probability p.
7.16.3 Geometric Distribution Graphics
The geometric distribution graphics are defined in the "geometric-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/geometric-graphics)) |
Returns a plot of the probability density and cumulative density of the geometric distribution with probability p. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the geometric distribution with probability 0.5.
The following figure shows the resulting plot:
7.17 The Logarithmic Distribution
Note that the logarithmic distribution in the GSL, and as implemented in the Science Collection, is a discrete version of the exponential distribution.
The logarithmic distribution functions are defined in the "logarithmic.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/logarithmic)) |
7.17.1 Random Variates from the Logarithmic Distribution
Returns a random variate from the logarithmic distribution with probability
p using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the logarithmic distribution with probability 0.5.
The following figure shows the resulting histogram:
7.17.2 Logarithmic Distribution Density Functions
Computes the probability density, p(k), at k for the logarithmic distribution with probability p.
7.17.3 Logarithmic Distribution Graphics
The logarithmic distribution graphics are defined in the "logarithmic-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/logarithmic-graphics)) |
Returns a plot of the probability density and cumulative density of the logarithmic distribution with probability p. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the logarithmic distribution with probability 0.5.
The following figure shows the resulting plot:
7.18 The Poisson Distribution
Poisson Distribution from Wolfram MathWorld.
The Poisson distribution functions are defined in the "poisson.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
7.18.1 Random Variates from the Poisson Distribution
Returns a random variate from the Poisson distribution with mean
mu using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from the Poisson distribution with mean 10.0.
The following figure shows the resulting histogram:
7.18.2 Poisson Distribution Density Functions
Computes the probability density, p(k), at k for the Poisson distribution with mean mu.
7.18.3 Poisson Distribution Graphics
The Poisson distribution graphics are defined in the "poisson-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/poisson-graphics)) |
Returns a plot of the probability density and cumulative density of the Poisson distribution with mean mu. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of the Poisson distribution with mean 10.0.
The following figure shows the resulting plot:
7.19 General Discrete Distributions
The discrete distribution functions are defined in the "discrete.rkt" file in the random-distributions subcollection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/discrete)) |
7.19.1 Creating Discrete Distributions
Returns true, #t, if x is a discrete distribution.
Returns a discrete distribution whose probability density is given by the specified weights. Note that the weights do not have to sum to one.
7.19.2 Random Variates from a Discrete Distribution
Returns a random variate from a general discrete distribution
d using the random source
s or
(current-random-source) if
s is not provided.
Example: Histogram of random variates from a discrete distribution with weights 0.1, 0.4, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, and 0.1.
The following figure shows the resulting histogram:
7.19.3 Discrete Distribution Density Functions
Computes the probability density, p(k), at k for a discrete distribution d.
Computes the cumulative density, d(k), at k for a discrete distribution d.
7.19.4 Discrete Distribution Graphics
The discrete distribution graphics are defined in the "discrete-graphics.rkt" file in the random-distributions sub-collection of the Science Collection and are made available using the form:
(require (planet williams/science/random-distributions/discrete-graphics)) |
Returns a plot of the probability density and cumulative density of a discrete distribution d. The plot is produced by the plot collection provided with Racket.
Example: Plot of the probability density and cumulative density of a discrete distribution with weights 0.1, 0.4, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, and 0.1.
The following figure shows the resulting plot: