PyMC provides 35 built-in probability distributions. For each distribution, it provides:
This section describes the likelihood functions of these distributions.
Bernoulli log-likelihood
The Bernoulli distribution describes the probability of successes (x=1) and failures (x=0).
| Parameters: |
|
|---|---|
| Example: | >>> bernoulli_like([0,1,0,1], .4)
-2.8542325496673584
|
Note


binomial_like(x, n, p)
Binomial log-likelihood. The discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p.
| Parameters: |
|
|---|
Note


categorical_like(x,p)
Categorical log-likelihood. The most general discrete distribution.
for
.
| Parameters: |
|
|---|
discrete_uniform_like(x, lower, upper)
Discrete uniform log-likelihood.
| Parameters: |
|
|---|
geometric_like(x, p)
Geometric log-likelihood. The probability that the first success in a sequence of Bernoulli trials occurs on the x’th trial.
| Parameters: |
|
|---|
Note


hypergeometric_like(x, n, m, N)
Hypergeometric log-likelihood. Discrete probability distribution that describes the number of successes in a sequence of draws from a finite population without replacement.
| Parameters: |
|
|---|
Note

negative_binomial_like(x, mu, alpha)
Negative binomial log-likelihood. The negative binomial distribution describes a Poisson random variable whose rate parameter is gamma distributed. PyMC’s chosen parameterization makes this mixture interpretation more convenient to work with.
x > 0, mu > 0, alpha > 0
Note
| math: | E[x]=mu |
|---|
In Wikipedia’s parameterization, :math: r=alpha :math: p=alpha/(mu+alpha) :math: mu=r(1-p)/p
poisson_like(x,mu)
Poisson log-likelihood. The Poisson is a discrete probability distribution. It is often used to model the number of events occurring in a fixed period of time when the times at which events occur are independent. The Poisson distribution can be derived as a limiting case of the binomial distribution.
| Parameters: |
|
|---|
Note


beta_like(x, alpha, beta)
Beta log-likelihood. The conjugate prior for the parameter :math: p of the binomial distribution.
| Parameters: |
|
|---|---|
| Example: | >>> beta_like(.4,1,2)
0.18232160806655884
|
Note


cauchy_like(x, alpha, beta)
Cauchy log-likelihood. The Cauchy distribution is also known as the Lorentz or the Breit-Wigner distribution.
| Parameters: |
|
|---|
Note
chi2_like(x, nu)
Chi-squared
log-likelihood.
| Parameters: |
|
|---|
Note


degenerate_like(x, k)
Degenerate log-likelihood.
| Parameters: |
|
|---|
exponential_like(x, beta)
Exponential log-likelihood.
The exponential distribution is a special case of the gamma distribution with alpha=1. It often describes the time until an event.
| Parameters: |
|
|---|
Note


exponweib_like(x,alpha,k,loc=0,scale=1)
Exponentiated Weibull log-likelihood.
The exponentiated Weibull distribution is a generalization of the Weibull family. Its value lies in being able to model monotone and non-monotone failure rates.
| Parameters: |
|
|---|
gamma_like(x, alpha, beta)
Gamma log-likelihood.
Represents the sum of alpha exponentially distributed random variables, each of which has mean beta.
| Parameters: |
|
|---|
Note


half_normal_like(x, tau)
Half-normal log-likelihood, a normal distribution with mean 0 and limited
to the domain
.
| Parameters: |
|
|---|
hypergeometric_like(x, n, m, N)
Hypergeometric log-likelihood. Discrete probability distribution that describes the number of successes in a sequence of draws from a finite population without replacement.
| Parameters: |
|
|---|
Note

inverse_gamma_like(x, alpha, beta)
Inverse gamma log-likelihood, the reciprocal of the gamma distribution.
| Parameters: |
|
|---|
Note
for
.
laplace_like(x, mu, tau)
Laplace (double exponential) log-likelihood.
The Laplace (or double exponential) distribution describes the difference between two independent, identically distributed exponential events. It is often used as a heavier-tailed alternative to the normal.
| Parameters: |
|
|---|
Note


logistic_like(x, mu, tau)
Logistic log-likelihood.
The logistic distribution is often used as a growth model; for example, populations, markets. Resembles a heavy-tailed normal distribution.
| Parameters: |
|
|---|
Note


lognormal_like(x, mu, tau)
Log-normal log-likelihood. Distribution of any random variable whose logarithm is normally distributed. A variable might be modeled as log-normal if it can be thought of as the multiplicative product of many small independent factors.
| Parameters: |
|
|---|
Note

normal_like(x, mu, tau)
Normal log-likelihood.
| Parameters: |
|
|---|
Note


skew_normal_like(x, mu, tau, alpha)
Azzalini’s skew-normal log-likelihood
where :math: Phi is the normal CDF and :math: phi is the normal PDF.
| Parameters: |
|
|---|
Note
t_like(x, nu)
Student’s T log-likelihood. Describes a zero-mean normal variable whose precision is gamma distributed. Alternatively, describes the mean of several zero-mean normal random variables divided by their sample standard deviation.
| Parameters: |
|
|---|
truncnorm_like(x, mu, tau, a, b)
Truncated normal log-likelihood.
where
.
| Parameters: |
|
|---|
uniform_like(x, lower, upper)
Uniform log-likelihood.
| Parameters: |
|
|---|
von_mises_like(x, mu, kappa)
von Mises log-likelihood.
where I_0 is the modified Bessel function of order 0.
| Parameters: |
|
|---|
Note

weibull_like(x, alpha, beta)
Weibull log-likelihood
| Parameters: |
|
|---|
Note


multivariate_hypergeometric_like(x, m)
The multivariate hypergeometric describes the probability of drawing x[i] elements of the ith category, when the number of items in each category is given by m.
where
and
.
| Parameters: |
|
|---|
multinomial_like(x, n, p)
Multinomial log-likelihood. Generalization of the binomial distribution, but instead of each trial resulting in “success” or “failure”, each one results in exactly one of some fixed finite number k of possible outcomes over n independent trials. ‘x[i]’ indicates the number of times outcome number i was observed over the n trials.
| Parameters: |
|
|---|
Note



dirichlet_like(x, theta)
Dirichlet log-likelihood.
This is a multivariate continuous distribution.
| Parameters: |
|
|---|
inverse_wishart_like(X, n, Tau)
Inverse Wishart log-likelihood. The inverse Wishart distribution is the conjugate prior for the covariance matrix of a multivariate normal distribution.
where
is the rank of X.
| Parameters: |
|
|---|
mv_normal_like(x, mu, tau)
Multivariate normal log-likelihood
| Parameters: |
|
|---|
See also
mv_normal_like(x, mu, tau)
Multivariate normal log-likelihood
| Parameters: | x : (n,k) mu : (k) sigma : (k,k) sigma lower triangular |
|---|
See also
mv_normal_cov_like(x, mu, C)
Multivariate normal log-likelihood
x: (n,k) mu: (k) C: (k,k) C positive definite
See also
wishart_like(X, n, Tau)
Wishart log-likelihood. The Wishart distribution is the probability distribution of the maximum-likelihood estimator (MLE) of the precision matrix of a multivariate normal distribution. If Tau=1, the distribution is identical to the chi-square distribution with n degrees of freedom.
For an alternative parameterization based on
, see
wishart_cov_like.
where
is the rank of X.
| Parameters: |
|
|---|
wishart_like(X, n, C)
Wishart log-likelihood. The Wishart distribution is the probability distribution of the maximum-likelihood estimator (MLE) of the covariance matrix of a multivariate normal distribution. If C=1, the distribution is identical to the chi-square distribution with n degrees of freedom.
For an alternative parameterization based on
, see
wishart_like.
where
is the rank of X.
| Parameters: |
|
|---|