Beta prime probability distribution

The beta prime distribution is a continuous univariate distribution with support \(x > 0\).

The probability density function is

\[f(x, a, b, \sigma) = \frac{x^{a - 1}(1 + x)^{-a-b}}{B(a,b)}\]

and the cumulative distribution function is

\[F(x, a, b, \sigma) = I_{ \frac{x/\sigma} {1+x/\sigma} }(a, b)\]

where \(B(a, b)\) is the beta function and \(I_{z}(a, b)\) is the regularized incomplete beta function.

Parameters \(a\) and \(b\) are shape parameters; \(\sigma\) is a scale parameter.

See https://en.wikipedia.org/wiki/Beta_prime_distribution

The functions defined here include a scale parameter, so according to the Wikipedia article, this is actually a generalization of the beta prime distribution known as the compound gamma distribution. If you want the “standard” beta prime distribution as described in the article, set the scale to 1.

mpsci.distributions.betaprime.cdf(x, a, b, scale)

Cumulative distribution function of the beta prime distribution.

mpsci.distributions.betaprime.invcdf(p, a, b, scale)

Inverse of the CDF of the beta prime distribution.

mpsci.distributions.betaprime.invsf(p, a, b, scale)

Inverse of the survival function of the beta prime distribution.

mpsci.distributions.betaprime.kurtosis(a, b, scale)

Excess kurtosis of the beta prime distribution.

If b <= 4, nan is returned.

mpsci.distributions.betaprime.logpdf(x, a, b, scale)

Natural logarithm of the PDF of the beta prime distribution.

mpsci.distributions.betaprime.mean(a, b, scale)

Mean of the beta prime distribution.

mpsci.distributions.betaprime.mle(x, *, a=None, b=None, scale=None)

Maximum likelihood estimate for the beta prime distribution.

x must be a sequence of nonnegative numbers.

Returns (a, b, scale), the maximum likelihood estimate.

A numerical equation solver (mpmath.mp.findroot) is used to solve for the maximum likelihood estimate. For some data, this solver may fail to converge. If that happens, different initial guesses for the parameter values may be given by passing instances of the mpsci.distributions.Initial class for a or b, e.g.:

from mpsci.distributions import Initial
ahat, bhat, scalehat = mle(x, b=Initial(12))

The default initial guess for all the parameters is 1.

mpsci.distributions.betaprime.mode(a, b, scale)

Mode of the beta prime distribution.

mpsci.distributions.betaprime.nll(x, a, b, scale)

Negative log-likelihood of the beta prime distribution.

x must be a sequence of nonnegative numbers.

mpsci.distributions.betaprime.noncentral_moment(n, a, b, scale)

Noncentral moment (i.e. raw moment) of the beta prime distribution.

n is the order of the moment. The moment is not defined if n >= b; nan is returned in that case.

mpsci.distributions.betaprime.pdf(x, a, b, scale)

Probability density function (PDF) for the beta prime distribution.

mpsci.distributions.betaprime.sf(x, a, b, scale)

Survival function of the beta prime distribution.

mpsci.distributions.betaprime.skewness(a, b, scale)

Skewness of the beta prime distribution.

mpsci.distributions.betaprime.support(a, b, scale)

Support of the beta prime distribution.

mpsci.distributions.betaprime.var(a, b, scale)

Variance of the beta prime distribution.