GNU Octave: Distributions

Next: Tests, Previous: Correlation and Regression Analysis, Up: Statistics [Contents][Index]

### 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 Distribution | `binopdf` | `binocdf` | `binoinv`
Cauchy Distribution | `cauchy_pdf` | `cauchy_cdf` | `cauchy_inv`
Chi-Square Distribution | `chi2pdf` | `chi2cdf` | `chi2inv`
Univariate Discrete Distribution | `discrete_pdf` | `discrete_cdf` | `discrete_inv`
Empirical Distribution | `empirical_pdf` | `empirical_cdf` | `empirical_inv`
Exponential Distribution | `exppdf` | `expcdf` | `expinv`
F Distribution | `fpdf` | `fcdf` | `finv`
Gamma Distribution | `gampdf` | `gamcdf` | `gaminv`
Geometric Distribution | `geopdf` | `geocdf` | `geoinv`
Hypergeometric Distribution | `hygepdf` | `hygecdf` | `hygeinv`
Kolmogorov Smirnov Distribution | Not Available | `kolmogorov_smirnov_cdf` | Not Available
Laplace Distribution | `laplace_pdf` | `laplace_cdf` | `laplace_inv`
Logistic Distribution | `logistic_pdf` | `logistic_cdf` | `logistic_inv`
Log-Normal Distribution | `lognpdf` | `logncdf` | `logninv`
Univariate Normal Distribution | `normpdf` | `normcdf` | `norminv`
Pascal Distribution | `nbinpdf` | `nbincdf` | `nbininv`
Poisson Distribution | `poisspdf` | `poisscdf` | `poissinv`
Standard Normal Distribution | `stdnormal_pdf` | `stdnormal_cdf` | `stdnormal_inv`
t (Student) Distribution | `tpdf` | `tcdf` | `tinv`
Univariate Discrete Distribution | `unidpdf` | `unidcdf` | `unidinv`
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.

Next: Tests, Previous: Correlation and Regression Analysis, Up: Statistics [Contents][Index]