### 26.4 Distributions

— Function File: betacdf (x, a, b)

> For each element of x, returns the CDF at x of the beta distribution with parameters a and b, i.e., PROB (beta (a, b) <= x).

— Function File: betainv (x, a, b)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the Beta distribution with parameters a and b.

— Function File: betapdf (x, a, b)

> For each element of x, returns the PDF at x of the beta distribution with parameters a and b.

— Function File: betarnd (a, b, r, c)
— Function File: betarnd (a, b, sz)

> Return an r by c or `size (`sz`)` matrix of random samples from the Beta distribution with parameters a and b. Both a and b must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of a and b.

— Function File: binocdf (x, n, p)

> For each element of x, compute the CDF at x of the binomial distribution with parameters n and p.

— Function File: binoinv (x, n, p)

> For each element of x, compute the quantile at x of the binomial distribution with parameters n and p.

— Function File: 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.

— Function File: binornd (n, p, r, c)
— Function File: binornd (n, p, sz)

> Return an r by c or a `size (`sz`)` matrix of random samples from the binomial distribution with parameters n and p. Both n and p must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of n and p.

— Function File: cauchy_cdf (x, lambda, sigma)

> For each element of x, compute the cumulative distribution function (CDF) at x of the Cauchy distribution with location parameter lambda and scale parameter sigma. Default values are lambda = 0, sigma = 1.

— Function File: cauchy_inv (x, lambda, sigma)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the Cauchy distribution with location parameter lambda and scale parameter sigma. Default values are lambda = 0, sigma = 1.

— Function File: cauchy_pdf (x, lambda, sigma)

> For each element of x, compute the probability density function (PDF) at x of the Cauchy distribution with location parameter lambda and scale parameter sigma > 0. Default values are lambda = 0, sigma = 1.

— Function File: cauchy_rnd (lambda, sigma, r, c)
— Function File: cauchy_rnd (lambda, sigma, sz)

> Return an r by c or a `size (`sz`)` matrix of random samples from the Cauchy distribution with parameters lambda and sigma which must both be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of lambda and sigma.

— Function File: chi2cdf (x, n)

> For each element of x, compute the cumulative distribution function (CDF) at x of the chisquare distribution with n degrees of freedom.

— Function File: chi2inv (x, n)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the chisquare distribution with n degrees of freedom.

— Function File: chisquare_pdf (x, n)

> For each element of x, compute the probability density function (PDF) at x of the chisquare distribution with n degrees of freedom.

— Function File: chi2rnd (n, r, c)
— Function File: chi2rnd (n, sz)

> Return an r by c or a `size (`sz`)` matrix of random samples from the chisquare distribution with n degrees of freedom. n must be a scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the size of n.

— Function File: 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.

— Function File: discrete_inv (x, v, p)

> For each component 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.

— Function File: 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.

— Function File: discrete_rnd (n, v, p)
— Function File: discrete_rnd (v, p, r, c)
— Function File: discrete_rnd (v, p, sz)

> Generate a row vector containing a random sample of size n from the univariate distribution which assumes the values in v with probabilities p. n must be a scalar.

> If r and c are given create a matrix with r rows and c columns. Or if sz is a vector, create a matrix of size sz.

— Function File: 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.

— Function File: 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.

— Function File: 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.

— Function File: empirical_rnd (n, data)
— Function File: empirical_rnd (data, r, c)
— Function File: empirical_rnd (data, sz)

> Generate a bootstrap sample of size n from the empirical distribution obtained from the univariate sample data.

> If r and c are given create a matrix with r rows and c columns. Or if sz is a vector, create a matrix of size sz.

— Function File: expcdf (x, lambda)

> For each element of x, compute the cumulative distribution function (CDF) at x of the exponential distribution with parameter lambda.

> The arguments can be of common size or scalar.

— Function File: expinv (x, lambda)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the exponential distribution with parameter lambda.

— Function File: exppdf (x, lambda)

> For each element of x, compute the probability density function (PDF) of the exponential distribution with parameter lambda.

— Function File: exprnd (lambda, r, c)
— Function File: exprnd (lambda, sz)

> Return an r by c matrix of random samples from the exponential distribution with parameter lambda, which must be a scalar or of size r by c. Or if sz is a vector, create a matrix of size sz.

> If r and c are omitted, the size of the result matrix is the size of lambda.

— Function File: fcdf (x, m, n)

> For each element of x, compute the CDF at x of the F distribution with m and n degrees of freedom, i.e., PROB (F (m, n) <= x).

— Function File: finv (x, m, n)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the F distribution with parameters m and n.

— Function File: 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.

— Function File: frnd (m, n, r, c)
— Function File: frnd (m, n, sz)

> Return an r by c matrix of random samples from the F distribution with m and n degrees of freedom. Both m and n must be scalar or of size r by c. If sz is a vector the random samples are in a matrix of size sz.

> If r and c are omitted, the size of the result matrix is the common size of m and n.

— Function File: gamcdf (x, a, b)

> For each element of x, compute the cumulative distribution function (CDF) at x of the Gamma distribution with parameters a and b.

> See also: gamma, gammaln, gammainc, gampdf, gaminv, gamrnd.

— Function File: gaminv (x, a, b)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the Gamma distribution with parameters a and b.

> See also: gamma, gammaln, gammainc, gampdf, gamcdf, gamrnd.

— Function File: gampdf (x, a, b)

> For each element of x, return the probability density function (PDF) at x of the Gamma distribution with parameters a and b.

> See also: gamma, gammaln, gammainc, gamcdf, gaminv, gamrnd.

— Function File: gamrnd (a, b, r, c)
— Function File: gamrnd (a, b, sz)

> Return an r by c or a `size (`sz`)` matrix of random samples from the Gamma distribution with parameters a and b. Both a and b must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of a and b.

> See also: gamma, gammaln, gammainc, gampdf, gamcdf, gaminv.

— Function File: geocdf (x, p)

> For each element of x, compute the CDF at x of the geometric distribution with parameter p.

— Function File: geoinv (x, p)

> For each element of x, compute the quantile at x of the geometric distribution with parameter p.

— Function File: geopdf (x, p)

> For each element of x, compute the probability density function (PDF) at x of the geometric distribution with parameter p.

— Function File: geornd (p, r, c)
— Function File: geornd (p, sz)

> Return an r by c matrix of random samples from the geometric distribution with parameter p, which must be a scalar or of size r by c.

> If r and c are given create a matrix with r rows and c columns. Or if sz is a vector, create a matrix of size sz.

— Function File: hygecdf (x, m, t, n)

> Compute the cumulative distribution function (CDF) at x of the hypergeometric distribution with parameters m, t, 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 m, t, and n must positive integers with m and n not greater than t.

— Function File: hygeinv (x, m, t, n)

> For each element of x, compute the quantile at x of the hypergeometric distribution with parameters m, t, and n.

> The parameters m, t, and n must positive integers with m and n not greater than t.

— Function File: hygepdf (x, m, t, n)

> Compute the probability density function (PDF) at x of the hypergeometric distribution with parameters m, t, 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 arguments must be of common size or scalar.

— Function File: hygernd (m, t, n, r, c)
— Function File: hygernd (m, t, n, sz)

> Return an r by c matrix of random samples from the hypergeometric distribution with parameters m, t, and n.

> The parameters m, t, and n must positive integers with m and n not greater than t.

— Function File: kolmogorov_smirnov_cdf (x, tol)

> Return the CDF at x of the Kolmogorov-Smirnov distribution,

>                        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`.

— Function File: laplace_cdf (x)

> For each element of x, compute the cumulative distribution function (CDF) at x of the Laplace distribution.

— Function File: laplace_inv (x)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the Laplace distribution.

— Function File: laplace_pdf (x)

> For each element of x, compute the probability density function (PDF) at x of the Laplace distribution.

— Function File: laplace_rnd (r, c)
— Function File: laplace_rnd (sz);

> Return an r by c matrix of random numbers from the Laplace distribution. Or if sz is a vector, create a matrix of sz.

— Function File: logistic_cdf (x)

> For each component of x, compute the CDF at x of the logistic distribution.

— Function File: logistic_inv (x)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the logistic distribution.

— Function File: logistic_pdf (x)

> For each component of x, compute the PDF at x of the logistic distribution.

— Function File: logistic_rnd (r, c)
— Function File: logistic_rnd (sz)

> Return an r by c matrix of random numbers from the logistic distribution. Or if sz is a vector, create a matrix of sz.

— Function File: 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 = 1, sigma = 1.

— Function File: 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 `log (`mu`)` and variance sigma.

> Default values are mu = 1, sigma = 1.

— Function File: 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 = 1, sigma = 1.

— Function File: lognrnd (mu, sigma, r, c)
— Function File: lognrnd (mu, sigma, sz)

> Return an r by c matrix of random samples from the lognormal distribution with parameters mu and sigma. Both mu and sigma must be scalar or of size r by c. Or if sz is a vector, create a matrix of size sz.

> If r and c are omitted, the size of the result matrix is the common size of mu and sigma.

— Function File: normcdf (x, m, v)

> For each element of x, compute the cumulative distribution function (CDF) at x of the normal distribution with mean m and variance v.

> Default values are m = 0, v = 1.

— Function File: norminv (x, m, v)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the normal distribution with mean m and variance v.

> Default values are m = 0, v = 1.

— Function File: normpdf (x, m, v)

> For each element of x, compute the probability density function (PDF) at x of the normal distribution with mean m and variance v.

> Default values are m = 0, v = 1.

— Function File: normrnd (m, v, r, c)
— Function File: normrnd (m, v, sz)

> Return an r by c or `size (`sz`)` matrix of random samples from the normal distribution with parameters m and v. Both m and v must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of m and v.

— Function File: pascal_cdf (x, n, p)

> For each element of x, compute the CDF at x of the Pascal (negative binomial) distribution with parameters n and p.

> The number of failures in a Bernoulli experiment with success probability p before the n-th success follows this distribution.

— Function File: pascal_inv (x, n, p)

> For each element of x, compute the quantile at x of the Pascal (negative binomial) distribution with parameters n and p.

> The number of failures in a Bernoulli experiment with success probability p before the n-th success follows this distribution.

— Function File: pascal_pdf (x, n, p)

> For each element of x, compute the probability density function (PDF) at x of the Pascal (negative binomial) distribution with parameters n and p.

> The number of failures in a Bernoulli experiment with success probability p before the n-th success follows this distribution.

— Function File: pascal_rnd (n, p, r, c)
— Function File: pascal_rnd (n, p, sz)

> Return an r by c matrix of random samples from the Pascal (negative binomial) distribution with parameters n and p. Both n and p must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of n and p. Or if sz is a vector, create a matrix of size sz.

— Function File: poisscdf (x, lambda)

> For each element of x, compute the cumulative distribution function (CDF) at x of the Poisson distribution with parameter lambda.

— Function File: poissinv (x, lambda)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the Poisson distribution with parameter lambda.

— Function File: poisspdf (x, lambda)

> For each element of x, compute the probability density function (PDF) at x of the poisson distribution with parameter lambda.

— Function File: poissrnd (lambda, r, c)

> Return an r by c matrix of random samples from the Poisson distribution with parameter lambda, which must be a scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the size of lambda.

— Function File: stdnormal_cdf (x)

> For each component of x, compute the CDF of the standard normal distribution at x.

— Function File: stdnormal_inv (x)

> For each component of x, compute compute the quantile (the inverse of the CDF) at x of the standard normal distribution.

— Function File: stdnormal_pdf (x)

> For each element of x, compute the probability density function (PDF) of the standard normal distribution at x.

— Function File: stdnormal_rnd (r, c)
— Function File: stdnormal_rnd (sz)

> Return an r by c or `size (`sz`)` matrix of random numbers from the standard normal distribution.

— Function File: tcdf (x, n)

> For each element of x, compute the CDF at x of the t (Student) distribution with n degrees of freedom, i.e., PROB (t(n) <= x).

— Function File: tinv (x, n)

> For each component of x, compute the quantile (the inverse of the CDF) at x of the t (Student) distribution with parameter n.

— Function File: 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.

— Function File: trnd (n, r, c)
— Function File: trnd (n, sz)

> Return an r by c matrix of random samples from the t (Student) distribution with n degrees of freedom. n must be a scalar or of size r by c. Or if sz is a vector create a matrix of size sz.

> If r and c are omitted, the size of the result matrix is the size of n.

— Function File: unifcdf (x, a, b)

> Return the CDF at x of the uniform distribution on [a, b], i.e., PROB (uniform (a, b) <= x).

> Default values are a = 0, b = 1.

— Function File: unifinv (x, a, b)

> For each element of x, compute the quantile (the inverse of the CDF) at x of the uniform distribution on [a, b].

> Default values are a = 0, b = 1.

— Function File: unifpdf (x, a, b)

> For each element of x, compute the PDF at x of the uniform distribution on [a, b].

> Default values are a = 0, b = 1.

— Function File: unifrnd (a, b, r, c)
— Function File: unifrnd (a, b, sz)

> Return an r by c or a `size (`sz`)` matrix of random samples from the uniform distribution on [a, b]. Both a and b must be scalar or of size r by c.

> If r and c are omitted, the size of the result matrix is the common size of a and b.

— Function File: weibcdf (x, scale, shape)

> Compute the cumulative distribution function (CDF) at x of the Weibull distribution with shape parameter scale and scale parameter shape, which is

>               1 - exp(-(x/shape)^scale)

> for x >= 0.

— Function File: weibinv (x, scale, shape)

> Compute the quantile (the inverse of the CDF) at x of the Weibull distribution with shape parameter scale and scale parameter shape.

— Function File: weibpdf (x, scale, shape)

> Compute the probability density function (PDF) at x of the Weibull distribution with shape parameter scale and scale parameter shape which is given by

>                  scale * shape^(-scale) * x^(scale-1) * exp(-(x/shape)^scale)

> for x > 0.

— Function File: weibull_rnd (shape, scale, r, c)
— Function File: weibull_rnd (shape, scale, sz)

> Return an r by c matrix of random samples from the Weibull distribution with parameters scale and shape which must be scalar or of size r by c. Or if sz is a vector return a matrix of size sz.

> If r and c are omitted, the size of the result matrix is the common size of alpha and sigma.

— Function File: wienrnd (t, d, n)

> Return a simulated realization of the d-dimensional Wiener Process on the interval [0, t]. If d is omitted, d = 1 is used. The first column of the return matrix contains time, the remaining columns contain the Wiener process.

> The optional parameter n gives the number of summands used for simulating the process over an interval of length 1. If n is omitted, n = 1000 is used.