octave: Distributions
26.5 Distributions
==================
Octave has functions for computing the Probability Density Function
(PDF), the Cumulative Distribution function (CDF), and the quantile (the
inverse of the CDF) for a large number of distributions.
The following table summarizes the supported distributions (in
alphabetical order).
Distribution PDF CDF Quantile
-----------------------------------------------------------------------------
Beta Distribution ‘betapdf’ ‘betacdf’ ‘betainv’
Binomial ‘binopdf’ ‘binocdf’ ‘binoinv’
Distribution
Cauchy Distribution ‘cauchy_pdf’ ‘cauchy_cdf’ ‘cauchy_inv’
Chi-Square ‘chi2pdf’ ‘chi2cdf’ ‘chi2inv’
Distribution
Univariate Discrete ‘discrete_pdf’ ‘discrete_cdf’ ‘discrete_inv’
Distribution
Empirical ‘empirical_pdf’ ‘empirical_cdf’ ‘empirical_inv’
Distribution
Exponential ‘exppdf’ ‘expcdf’ ‘expinv’
Distribution
F Distribution ‘fpdf’ ‘fcdf’ ‘finv’
Gamma Distribution ‘gampdf’ ‘gamcdf’ ‘gaminv’
Geometric ‘geopdf’ ‘geocdf’ ‘geoinv’
Distribution
Hypergeometric ‘hygepdf’ ‘hygecdf’ ‘hygeinv’
Distribution
Kolmogorov Smirnov _Not Available_ ‘kolmogorov_smirnov_cdf’_Not Available_
Distribution
Laplace Distribution ‘laplace_pdf’ ‘laplace_cdf’ ‘laplace_inv’
Logistic ‘logistic_pdf’ ‘logistic_cdf’ ‘logistic_inv’
Distribution
Log-Normal ‘lognpdf’ ‘logncdf’ ‘logninv’
Distribution
Univariate Normal ‘normpdf’ ‘normcdf’ ‘norminv’
Distribution
Pascal Distribution ‘nbinpdf’ ‘nbincdf’ ‘nbininv’
Poisson Distribution ‘poisspdf’ ‘poisscdf’ ‘poissinv’
Standard Normal ‘stdnormal_pdf’ ‘stdnormal_cdf’ ‘stdnormal_inv’
Distribution
t (Student) ‘tpdf’ ‘tcdf’ ‘tinv’
Distribution
Univariate Discrete ‘unidpdf’ ‘unidcdf’ ‘unidinv’
Distribution
Uniform Distribution ‘unifpdf’ ‘unifcdf’ ‘unifinv’
Weibull Distribution ‘wblpdf’ ‘wblcdf’ ‘wblinv’
-- : betapdf (X, A, B)
For each element of X, compute the probability density function
(PDF) at X of the Beta distribution with parameters A and B.
-- : betacdf (X, A, B)
For each element of X, compute the cumulative distribution function
(CDF) at X of the Beta distribution with parameters A and B.
-- : betainv (X, A, B)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the Beta distribution with parameters A and B.
-- : binopdf (X, N, P)
For each element of X, compute the probability density function
(PDF) at X of the binomial distribution with parameters N and P,
where N is the number of trials and P is the probability of
success.
-- : binocdf (X, N, P)
For each element of X, compute the cumulative distribution function
(CDF) at X of the binomial distribution with parameters N and P,
where N is the number of trials and P is the probability of
success.
-- : binoinv (X, N, P)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the binomial distribution with parameters N and P,
where N is the number of trials and P is the probability of
success.
-- : cauchy_pdf (X)
-- : cauchy_pdf (X, LOCATION, SCALE)
For each element of X, compute the probability density function
(PDF) at X of the Cauchy distribution with location parameter
LOCATION and scale parameter SCALE > 0.
Default values are LOCATION = 0, SCALE = 1.
-- : cauchy_cdf (X)
-- : cauchy_cdf (X, LOCATION, SCALE)
For each element of X, compute the cumulative distribution function
(CDF) at X of the Cauchy distribution with location parameter
LOCATION and scale parameter SCALE.
Default values are LOCATION = 0, SCALE = 1.
-- : cauchy_inv (X)
-- : cauchy_inv (X, LOCATION, SCALE)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the Cauchy distribution with location parameter
LOCATION and scale parameter SCALE.
Default values are LOCATION = 0, SCALE = 1.
-- : chi2pdf (X, N)
For each element of X, compute the probability density function
(PDF) at X of the chi-square distribution with N degrees of
freedom.
-- : chi2cdf (X, N)
For each element of X, compute the cumulative distribution function
(CDF) at X of the chi-square distribution with N degrees of
freedom.
-- : chi2inv (X, N)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the chi-square distribution with N degrees of freedom.
-- : discrete_pdf (X, V, P)
For each element of X, compute the probability density function
(PDF) at X of a univariate discrete distribution which assumes the
values in V with probabilities P.
-- : discrete_cdf (X, V, P)
For each element of X, compute the cumulative distribution function
(CDF) at X of a univariate discrete distribution which assumes the
values in V with probabilities P.
-- : discrete_inv (X, V, P)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the univariate distribution which assumes the values
in V with probabilities P.
-- : empirical_pdf (X, DATA)
For each element of X, compute the probability density function
(PDF) at X of the empirical distribution obtained from the
univariate sample DATA.
-- : empirical_cdf (X, DATA)
For each element of X, compute the cumulative distribution function
(CDF) at X of the empirical distribution obtained from the
univariate sample DATA.
-- : empirical_inv (X, DATA)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the empirical distribution obtained from the
univariate sample DATA.
-- : exppdf (X, LAMBDA)
For each element of X, compute the probability density function
(PDF) at X of the exponential distribution with mean LAMBDA.
-- : expcdf (X, LAMBDA)
For each element of X, compute the cumulative distribution function
(CDF) at X of the exponential distribution with mean LAMBDA.
The arguments can be of common size or scalars.
-- : expinv (X, LAMBDA)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the exponential distribution with mean LAMBDA.
-- : fpdf (X, M, N)
For each element of X, compute the probability density function
(PDF) at X of the F distribution with M and N degrees of freedom.
-- : fcdf (X, M, N)
For each element of X, compute the cumulative distribution function
(CDF) at X of the F distribution with M and N degrees of freedom.
-- : finv (X, M, N)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the F distribution with M and N degrees of freedom.
-- : gampdf (X, A, B)
For each element of X, return the probability density function
(PDF) at X of the Gamma distribution with shape parameter A and
scale B.
-- : gamcdf (X, A, B)
For each element of X, compute the cumulative distribution function
(CDF) at X of the Gamma distribution with shape parameter A and
scale B.
-- : gaminv (X, A, B)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the Gamma distribution with shape parameter A and
scale B.
-- : geopdf (X, P)
For each element of X, compute the probability density function
(PDF) at X of the geometric distribution with parameter P.
The geometric distribution models the number of failures (X-1) of a
Bernoulli trial with probability P before the first success (X).
-- : geocdf (X, P)
For each element of X, compute the cumulative distribution function
(CDF) at X of the geometric distribution with parameter P.
The geometric distribution models the number of failures (X-1) of a
Bernoulli trial with probability P before the first success (X).
-- : geoinv (X, P)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the geometric distribution with parameter P.
The geometric distribution models the number of failures (X-1) of a
Bernoulli trial with probability P before the first success (X).
-- : hygepdf (X, T, M, N)
Compute the probability density function (PDF) at X of the
hypergeometric distribution with parameters T, M, and N.
This is the probability of obtaining X marked items when randomly
drawing a sample of size N without replacement from a population of
total size T containing M marked items.
The parameters T, M, and N must be positive integers with M and N
not greater than T.
-- : hygecdf (X, T, M, N)
Compute the cumulative distribution function (CDF) at X of the
hypergeometric distribution with parameters T, M, and N.
This is the probability of obtaining not more than X marked items
when randomly drawing a sample of size N without replacement from a
population of total size T containing M marked items.
The parameters T, M, and N must be positive integers with M and N
not greater than T.
-- : hygeinv (X, T, M, N)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the hypergeometric distribution with parameters T, M,
and N.
This is the probability of obtaining X marked items when randomly
drawing a sample of size N without replacement from a population of
total size T containing M marked items.
The parameters T, M, and N must be positive integers with M and N
not greater than T.
-- : kolmogorov_smirnov_cdf (X, TOL)
Return the cumulative distribution function (CDF) at X of the
Kolmogorov-Smirnov distribution.
This is defined as
Inf
Q(x) = SUM (-1)^k exp (-2 k^2 x^2)
k = -Inf
for X > 0.
The optional parameter TOL specifies the precision up to which the
series should be evaluated; the default is TOL = ‘eps’.
-- : laplace_pdf (X)
For each element of X, compute the probability density function
(PDF) at X of the Laplace distribution.
-- : laplace_cdf (X)
For each element of X, compute the cumulative distribution function
(CDF) at X of the Laplace distribution.
-- : laplace_inv (X)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the Laplace distribution.
-- : logistic_pdf (X)
For each element of X, compute the PDF at X of the logistic
distribution.
-- : logistic_cdf (X)
For each element of X, compute the cumulative distribution function
(CDF) at X of the logistic distribution.
-- : logistic_inv (X)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the logistic distribution.
-- : lognpdf (X)
-- : lognpdf (X, MU, SIGMA)
For each element of X, compute the probability density function
(PDF) at X of the lognormal distribution with parameters MU and
SIGMA.
If a random variable follows this distribution, its logarithm is
normally distributed with mean MU and standard deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : logncdf (X)
-- : logncdf (X, MU, SIGMA)
For each element of X, compute the cumulative distribution function
(CDF) at X of the lognormal distribution with parameters MU and
SIGMA.
If a random variable follows this distribution, its logarithm is
normally distributed with mean MU and standard deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : logninv (X)
-- : logninv (X, MU, SIGMA)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the lognormal distribution with parameters MU and
SIGMA.
If a random variable follows this distribution, its logarithm is
normally distributed with mean MU and standard deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : nbinpdf (X, N, P)
For each element of X, compute the probability density function
(PDF) at X of the negative binomial distribution with parameters N
and P.
When N is integer this is the Pascal distribution. When N is
extended to real numbers this is the Polya distribution.
The number of failures in a Bernoulli experiment with success
probability P before the N-th success follows this distribution.
-- : nbincdf (X, N, P)
For each element of X, compute the cumulative distribution function
(CDF) at X of the negative binomial distribution with parameters N
and P.
When N is integer this is the Pascal distribution. When N is
extended to real numbers this is the Polya distribution.
The number of failures in a Bernoulli experiment with success
probability P before the N-th success follows this distribution.
-- : nbininv (X, N, P)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the negative binomial distribution with parameters N
and P.
When N is integer this is the Pascal distribution. When N is
extended to real numbers this is the Polya distribution.
The number of failures in a Bernoulli experiment with success
probability P before the N-th success follows this distribution.
-- : normpdf (X)
-- : normpdf (X, MU, SIGMA)
For each element of X, compute the probability density function
(PDF) at X of the normal distribution with mean MU and standard
deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : normcdf (X)
-- : normcdf (X, MU, SIGMA)
For each element of X, compute the cumulative distribution function
(CDF) at X of the normal distribution with mean MU and standard
deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : norminv (X)
-- : norminv (X, MU, SIGMA)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the normal distribution with mean MU and standard
deviation SIGMA.
Default values are MU = 0, SIGMA = 1.
-- : poisspdf (X, LAMBDA)
For each element of X, compute the probability density function
(PDF) at X of the Poisson distribution with parameter LAMBDA.
-- : poisscdf (X, LAMBDA)
For each element of X, compute the cumulative distribution function
(CDF) at X of the Poisson distribution with parameter LAMBDA.
-- : poissinv (X, LAMBDA)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the Poisson distribution with parameter LAMBDA.
-- : stdnormal_pdf (X)
For each element of X, compute the probability density function
(PDF) at X of the standard normal distribution (mean = 0, standard
deviation = 1).
-- : stdnormal_cdf (X)
For each element of X, compute the cumulative distribution function
(CDF) at X of the standard normal distribution (mean = 0, standard
deviation = 1).
-- : stdnormal_inv (X)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the standard normal distribution (mean = 0, standard
deviation = 1).
-- : tpdf (X, N)
For each element of X, compute the probability density function
(PDF) at X of the T (Student) distribution with N degrees of
freedom.
-- : tcdf (X, N)
For each element of X, compute the cumulative distribution function
(CDF) at X of the t (Student) distribution with N degrees of
freedom.
-- : tinv (X, N)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the t (Student) distribution with N degrees of
freedom.
This function is analogous to looking in a table for the t-value of
a single-tailed distribution.
-- : unidpdf (X, N)
For each element of X, compute the probability density function
(PDF) at X of a discrete uniform distribution which assumes the
integer values 1–N with equal probability.
Warning: The underlying implementation uses the double class and
will only be accurate for N < ‘flintmax’ (2^{53} on IEEE 754
compatible systems).
-- : unidcdf (X, N)
For each element of X, compute the cumulative distribution function
(CDF) at X of a discrete uniform distribution which assumes the
integer values 1–N with equal probability.
-- : unidinv (X, N)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the discrete uniform distribution which assumes the
integer values 1–N with equal probability.
-- : unifpdf (X)
-- : unifpdf (X, A, B)
For each element of X, compute the probability density function
(PDF) at X of the uniform distribution on the interval [A, B].
Default values are A = 0, B = 1.
-- : unifcdf (X)
-- : unifcdf (X, A, B)
For each element of X, compute the cumulative distribution function
(CDF) at X of the uniform distribution on the interval [A, B].
Default values are A = 0, B = 1.
-- : unifinv (X)
-- : unifinv (X, A, B)
For each element of X, compute the quantile (the inverse of the
CDF) at X of the uniform distribution on the interval [A, B].
Default values are A = 0, B = 1.
-- : wblpdf (X)
-- : wblpdf (X, SCALE)
-- : wblpdf (X, SCALE, SHAPE)
Compute the probability density function (PDF) at X of the Weibull
distribution with scale parameter SCALE and shape parameter SHAPE.
This is given by
shape * scale^(-shape) * x^(shape-1) * exp (-(x/scale)^shape)
for X ≥ 0.
Default values are SCALE = 1, SHAPE = 1.
-- : wblcdf (X)
-- : wblcdf (X, SCALE)
-- : wblcdf (X, SCALE, SHAPE)
Compute the cumulative distribution function (CDF) at X of the
Weibull distribution with scale parameter SCALE and shape parameter
SHAPE.
This is defined as
1 - exp (-(x/scale)^shape)
for X ≥ 0.
Default values are SCALE = 1, SHAPE = 1.
-- : wblinv (X)
-- : wblinv (X, SCALE)
-- : wblinv (X, SCALE, SHAPE)
Compute the quantile (the inverse of the CDF) at X of the Weibull
distribution with scale parameter SCALE and shape parameter SHAPE.
Default values are SCALE = 1, SHAPE = 1.