PROB
Probability Density Functions
PROB
is a Python library which
handles various discrete and
continuous probability density functions
("PDF's").
For a discrete variable X, PDF(X) is the probability that the value
X will occur; for a continuous variable, PDF(X) is the probability
density of X, that is, the probability of a value between X and X+dX
is PDF(X) * dX.
The corresponding cumulative density functions or "CDF"'s are also
handled. For a discrete or continuous variable, CDF(X) is the
probability that the variable takes on a value less than or equal to X.
In some cases, the inverse of the CDF can easily be computed.
If
X = CDF_INV ( P )
then we are asserting that the value X has a cumulative
probability density function of P, in other words,
the probability that the variable is less than or equal to X
is P. If the CDF cannot be analytically inverted, there
are simple ways to try to estimate the inverse. Depending on
the PDF, these methods may be rapid and accurate, or not.
For most distributions, the mean or "average value" or
"expected value" is also available. For a discrete variable, MEAN
is simply the sum of the products X * PDF(X); for a continuous
variable, MEAN is the integral of X * PDF(X) over the range.
For the distributions covered here, the means are known beforehand,
and no summation or integration is required.
For most distributions, the variance is available. For a
discrete variable, the variance is the sum of the products
( X - MEAN )^2 * PDF(X); for a continuous variable, the
variance is the integral of ( X - MEAN )^2 * PDF(X) over the range.
The square root of the variance is known as the standard
deviation. For the distributions covered here, the variances are
often known beforehand, and no summation or integration is required.
For many of the distributions, it is possible to repeatedly
request "samples", that is, a pseudorandom sequence of realizations
of the PDF. These samples are always associated with an integer
seed, which controls the calculation. Using the same seed as input
will guarantee the same sample value on output. Ultimately, a
random number generator must be invoked internally. In most cases,
the current code will call a routine called R8_UNIFORM or
I4_UNIFORM, each of which in turn calls a routine called
R8_UNIFORM_01. You may prefer a different random number generator
for this purpose.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
PROB is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
LOG_NORMAL,
a Python library which
returns quantities associated with the log normal Probability
Distribution Function (PDF).
LOG_NORMAL_TRUNCATED_AB,
a Python library which
returns quantities associated with the log normal Probability
Distribution Function (PDF) truncated to the interval [A,B].
NORMAL,
a Python library which
samples the normal distribution.
PDFLIB,
a Python library which
evaluates Probability Density Functions (PDF's)
and produces random samples from them,
including beta, binomial, chi, exponential, gamma, inverse chi,
inverse gamma, multinomial, normal, scaled inverse chi, and uniform.
TEST_VALUES,
a Python library which
contains sample values for a number of distributions.
TRUNCATED_NORMAL,
a Python library which
works with the truncated normal distribution over [A,B], or
[A,+oo) or (-oo,B], returning the probability density function (PDF),
the cumulative density function (CDF), the inverse CDF, the mean,
the variance, and sample values.
UNIFORM,
a Python library which
samples the uniform distribution.
Source Code:
-
angle.py
the Angle distribution.
-
anglit.py
the Anglit distribution.
-
arcsin.py
the Arcsin distribution.
-
benford.py
the Benford distribution.
-
bernoulli.py
the Bernoulli distribution.
-
bessel_i0.py
evaluates the I0 Bessel function.
-
bessel_i0_values.py
returns some values of the I0 Bessel function.
-
bessel_i1.py
evaluates the I1 Bessel function.
-
bessel_i1_values.py
returns some values of the I1 Bessel function.
-
beta.py
the Beta distribution.
-
beta_binomial.py
the Beta Binomial distribution.
-
beta_cdf_values.py
returns some values of the Beta CDF.
-
beta_inc.py
returns the value of the incomplete Beta function.
-
beta_inc_values.py
returns some values of the incomplete Beta function.
-
beta_values.py
returns some values of the Beta function.
-
binomial.py
the Binomial distribution.
-
birthday.py
the Birthday distribution.
-
bradford.py
the Bradford distribution.
-
buffon_box.py
the Buffon Box distribution.
-
buffon.py
the Buffon distribution.
-
burr.py
the Burr distribution.
-
cardioid.py
the Cardioid distribution.
-
cauchy.py
the Cauchy distribution.
-
chebyshev1.py
the Chebyshev1 distribution.
-
chi.py
the Chi distribution.
-
chi_square.py
the Chi Square distribution.
-
chi_square_noncentral.py
the Chi Square Noncentral distribution.
-
circular_normal.py
the Circular Normal distribution.
-
circular_normal_01.py
the Circular Normal 01 distribution.
-
cosine.py
the Cosine distribution.
-
coupon.py
the Coupon distribution.
-
coupon_complete.py
the Coupon Complete distribution.
-
deranged.py
the Deranged distribution.
-
digamma.py
evaluates the psi or digamma function.
-
dipole.py
the Dipole distribution.
-
dirichlet.py
the Dirichlet distribution.
-
dirichlet_mix.py
the Dirichlet Mix distribution.
-
discrete.py
the Discrete distribution.
-
disk.py
the Disk distribution.
-
empirical_discrete.py
the Empirical Discrete distribution.
-
english_letter.py
the English Letter distribution.
-
english_sentence_length.py
the English Sentence Length distribution.
-
english_word_length.py
the English Word Length distribution.
-
erlang.py
the Erlang distribution.
-
exponential.py
the Exponential distribution.
-
exponential_01.py
the Exponential 01 distribution.
-
extreme_values.py
the Extreme Values distribution.
-
f.py
the F distribution.
-
fermi_dirac.py
the Fermi Dirac distribution.
-
fisher.py
the Fisher distribution.
-
fisk.py
the Fisk distribution.
-
folded_normal.py
the Folded Normal distribution.
-
frechet.py
the Frechet distribution.
-
gamma.py
the Gamma distribution.
-
gamma_inc.py
evaluates the incomplete gamma function.
-
gamma_inc_values.py
returns some values of the incomplete gamma function.
-
gamma_values.py
returns some values of the gamma function.
-
gamma_log_values.py
returns some values of the logarithm of the gamma function.
-
genlogistic.py
the Genlogistic distribution.
-
geometric.py
the Geometric distribution.
-
gompertz.py
the Gompertz distribution.
-
gumbel.py
the Gumbel distribution.
-
half_normal.py
the Half Normal distribution.
-
hypergeometric.py
the Hypergeometric distribution.
-
i4_choose.py,
computes the binomial coefficient C(N,K) as an I4.
-
i4_choose_log.py,
computes the logarithm of the binomial coefficient C(N,K) as an I4.
-
i4_is_power_of_10.py,
reports whether an I4 is a power of 10.
-
i4_uniform_ab.py,
returns a scaled uniform I4 between A and B.
-
i4vec_max.py,
returns the maximum entry in an I4VEC.
-
i4mat_print.py,
prints an I4MAT.
-
i4mat_print_some.py,
prints some of an I4MAT.
-
i4row_max.py,
returns the row maximums of an I4ROW.
-
i4row_mean.py,
returns the row means of an I4ROW.
-
i4row_min.py,
returns the minimums of an I4ROW.
-
i4row_variance.py,
returns the variances of an I4ROW.
-
i4vec_mean.py,
returns the mean of an I4VEC.
-
i4vec_min.py,
returns the minimum entry in an I4VEC.
-
i4vec_print.py,
prints an I4VEC.
-
i4vec_run_count.py,
counts the runs in an I4VEC.
-
i4vec_sum.py,
sums the entries in an I4VEC.
-
i4vec_uniform_ab.py,
returns an I4VEC whose entries are uniformly random between A and B.
-
i4vec_unique_count.py,
counts the unique elements in an I4VEC.
-
i4vec_variance.py,
returns the variance of an I4VEC.
-
inverse_gaussian.py,
the Inverse Gaussian distribution.
-
laplace.py,
the Laplace distribution.
-
levy.py,
the Levy distribution.
-
log_normal.py,
the Log Normal distribution.
-
log_series.py,
the Log Series distribution.
-
log_uniform.py,
the Log Uniform distribution.
-
logistic.py,
the Logistic distribution.
-
lorentz.py,
the Lorentz distribution.
-
maxwell.py,
the Maxwell distribution.
-
multinomial.py,
the Multinomial distribution.
-
multinomial_coef.py,
evaluates the multinomial coefficient.
-
multinoulli.py,
the Multinoulli distribution.
-
nakagami.py,
the Nakagami distribution.
-
negative_binomial.py,
the Negative Binomial distribution.
-
normal_01.py,
the Normal 01 distribution.
-
normal_01_cdf_values.py,
returns some values of the Normal CDF with mean 0 and variance 1.
-
normal.py,
the Normal distribution.
-
normal_truncated_ab.py,
the Normal Truncated AB distribution.
-
normal_truncated_a.py,
the Normal Truncated A distribution.
-
normal_truncated_b.py,
the Normal Truncated B distribution.
-
owen_values.py,
selected values of Owen's T function.
-
pareto.py,
the Pareto distribution.
-
pearson_05.py,
the Pearson 05 distribution.
-
poisson.py,
the Poisson distribution.
-
power.py,
the Power distribution.
-
psi_values.py
returns selected values of the psi function.
-
quasigeometric.py,
the Quasigeometric distribution.
-
r8_beta.py,
evaluates the beta function.
-
r8_csc.py,
evaluates the cosecant function.
-
r8_epsilon.py,
evaluates the machine epsilon.
-
r8_erf.py,
the error function Erf(x).
-
r8_factorial.py,
evaluates the factorial function.
-
r8_factorial_values.py,
returns selected values of the factorial function.
-
r8_gamma.py,
evaluates the gamma function.
-
r8_gamma_log.py,
evaluates the logarithm of the gamma function.
-
r8_gamma_log_int.py,
evaluates the logarithm of the gamma function for an integer argument.
-
r8_huge.py,
returns a "huge" R8;
-
r8_uniform_01.py,
returns a unit pseudorandom R8.
-
r8_zeta.py,
returns an estimate of the Zeta function.
-
r8mat_print.py,
prints an R8MAT;
-
r8mat_print_some.py,
prints some of an R8MAT;
-
r8poly_print.py,
prints a polynomial;
-
r8poly_value_horner.py,
evaluates a polynomial using Horner's method;
-
r8row_max.py,
computes the row maximums of an R8ROW.
-
r8row_mean.py,
computes the row means of an R8ROW.
-
r8row_min.py,
computes the row minimums of an R8ROW.
-
r8row_variance.py,
computes the row variances of an R8ROW.
-
r8vec_dot_product.py,
returns the dot product of two R8VEC's.
-
r8vec_max.py,
returns the maximum entry in an R8VEC.
-
r8vec_mean.py,
returns the mean of an R8VEC.
-
r8vec_min.py,
returns the minimum entry in an R8VEC.
-
r8vec_norm.py,
returns the L2 norm of an R8VEC.
-
r8vec_print.py,
prints an R8VEC.
-
r8vec_sum.py,
returns the sum of the entries of an R8VEC.
-
r8vec_transpose_print.py,
prints the 'transpose' of an R8VEC.
-
r8vec_uniform_01.py,
returns an R8VEC whose entries are uniformly random between 0.0 and 1.0.
-
r8vec_uniform_ab.py,
returns an R8VEC whose entries are uniformly random between A and B.
-
r8vec_variance.py,
returns the variance of an R8VEC.
-
r8vec2_print.py,
prints a pair of R8VEC's.
-
rayleigh.py,
the Rayleigh distribution.
-
reciprocal.py,
the Reciprocal distribution.
-
sech.py,
the Sech distribution.
-
semicircular.py,
the Semicircular distribution.
-
sin_power_int.py,
returns the value of the integral of the N-th power of
the sine function;
-
sin_power_int_values.py
returns some values of the integral of the N-th power of the
sine function;
-
stirling2.py,
computes Stirling numbers of the second kind.
-
student.py,
the Student distribution.
-
student_noncentral.py,
the Student Noncentral distribution.
-
tfn.py,
evaluates Owen's T function.
-
triangle.py,
the Triangle distribution.
-
triangular.py,
the Triangular distribution.
-
trigamma.py,
the Trigamma function.
-
trigamma_values.py,
selected values of the Trigamma function.
-
timestamp.py
returns the current YMDHMS date as a timestamp.
-
uniform.py,
the Uniform distribution.
-
uniform_01.py,
the Uniform 01 distribution.
-
uniform_01_order.py,
the Uniform 01 Order distribution.
-
uniform_discrete.py,
the Uniform Discrete distribution.
-
uniform_nsphere.py,
the Uniform Npshere distribution.
-
von_mises.py
the Von Mises distribution.
-
weibull.py
the Weibull distribution.
-
weibull_discrete.py
the Weibull Discrete distribution.
-
zipf.py
the Zipf distribution.
Test Files:
You can go up one level to
the Python source codes.
Last revised on 19 September 2018.