BayES BayES

B.11 Probability and cumulative density functions

The following two tables describe statements that are used to evaluate probability density/mass and cumulative density functions (pdfs and cdfs) of some popular distributions.




Syntax

Mathematical expression

Arguments and return values




W = betapdf(X, alpha, beta);
W = betacdf(X, alpha, beta);

f x = xα−1 ⋅1 − xβ−1 B α,β

F x = ∫ 0xtα−1 ⋅1 − tβ−1dt B α,β

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the beta distribution with shape parameters alpha and beta, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with entries between zero and one
  • If X contains negative entries or entries above one an error is produced
  • alpha must be a positive number
  • beta must be a positive number




W = chi2pdf(X, p);
W = chi2cdf(X, p);

f x = xp 2 −1 ⋅ e−x 2 2p 2 ⋅ Γ p2

F x = ∫ 0xtp 2 −1 ⋅ e−t 2 dt 2p 2 ⋅ Γ p2

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the chi-squared distribution with p degrees of freedom, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • p must be a positive number




W = exppdf(X, lambda);
W = expcdf(X, lambda);

f x = λe−λx

F x = 1 − e−λx

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the exponential distribution with rate parameter lambda, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • lambda must be a positive number




W = evpdf(X, mu, sigma);
W = evcdf(X, mu, sigma);

f x = 1 σexp −z − e−z

F x = exp −e−z

where:
z = x−μ σ

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the type-I extreme-value distribution with location parameter mu and scale parameter sigma, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset
  • mu must be a number
  • sigma must be a positive number




W = fpdf(X, p1, p2);
W = fcdf(X, p1, p2);

f x = p1xp1p 2p2 p1x+p2 p1+p2 1 2 xB p1 2 , p2 2

F x = ∫ 0 p1x p1x+p2 tp1 2 −1 1 −tp2 2 −1dt B p1 2 , p1 2

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of Fisher’s F distribution with numerator degrees of freedom p1 and denominator degrees of freedom p2, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • p1 must be a positive number
  • p2 must be a positive number




W = gampdf(X, alpha, beta);
W = gamcdf(X, alpha, beta);

f x = βα ⋅ xα−1 ⋅ e−βx Γ α

F x = βα ∫ 0xtα−1 ⋅ e−βtdt Γ α

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the gamma distribution with shape parameter alpha and rate parameter beta, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • alpha must be a positive number
  • beta must be a positive number




W = logisticpdf(X, mu, s);
W = logisticcdf(X, mu, s);

f x = e−x−μ s s ⋅1 + e−x−μ s 2

F x = 1 1 + e−x−μ s

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the logistic distribution with mean mu and scale parameter s (variance equal to s2π2 3 ), evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset
  • mu must be a number
  • s must be a positive number




W = logitnpdf(X, mu, sigma);
W = logitncdf(X, mu, sigma);

f x = exp −log x 1−x−μ2 2σ2 x 1 − x2πσ2

F x = ∫ 0x exp −log t 1−t−μ2 2σ2 t 1 − t2πσ2 dt

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of logit-Normal distribution with location parameter mu and scale parameter sigma, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with entries between zero and one
  • If X contains negative entries or entries greater than one an error is produced
  • mu must be a number
  • sigma must be a positive number




W = lognpdf(X, mu, sigma);
W = logncdf(X, mu, sigma);

f x = exp −logx−μ2 2σ2 x2πσ2

F x = ∫ 0x exp −logt−μ2 2σ2 t2πσ2 dt

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the log-Normal distribution with location parameter mu and scale parameter sigma, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • mu must be a positive number
  • sigma must be a positive number




W = normpdf(X, mu, sigma);
W = normcdf(X, mu, sigma);

f x = exp −x−μ2 σ2 2πσ2

F x = ∫ −∞x exp −t−μ2 σ2 2πσ2 dt

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the normal distribution with mean parameter mu and standard deviation sigma, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset
  • mu must be number
  • sigma must be a positive number




W = tpdf(X, p);
W = tcdf(X, p);

f x = Γ p+1 2 pπΓ p 2 1 + x2 p −p+1 2

F x = ∫ −∞x Γ p+1 2 pπΓ p 2 1 + t2 p −p+1 2 dt

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the t distribution with p degrees of freedom, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset
  • p must be a positive number




W = truncnpdf(X, mu, sigma);
W = truncncdf(X, mu, sigma);

f x = 1 σϕ −μ σ 1 − Φ −μ σ

F x = Φ x−μ σ − Φ −μ σ 1 − Φ −μ σ

where:
ϕ is the standard normal pdf
Φ is the standard normal cdf

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of a Normal distribution with location parameter mu and scale parameter sigma, truncated from below at zero and evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • mu must be a number
  • sigma must be a positive number




W = wblpdf(X, alpha, beta);
W = wblcdf(X, alpha, beta);

f x = α β x βα−1e−x βα

F x = 1 − e−x βα

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the Weibull distribution with shape parameter alpha and scale parameter beta, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative entries
  • If X contains negative entries an error is produced
  • alpha must be a positive number
  • beta must be a positive number






Syntax

Mathematical expression

Arguments and return values




W = binompdf(X, n, p);
W = binomcdf(X, n, p);

f x = n! x! n − x!px 1 − pn−x

F x = ∑ k=0x n! k! n − k!pk 1 − pn−k

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the binomial distribution with n of trials and probability of success in each trial p, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with integer entries between zero and n
  • If X contains negative entries or entries above n an error is produced
  • n must be a non-negative number
  • p must be a number between zero and one

Note that the function allows for non-integer values of n by replacing the factorials in the expression by the Gamma function.




W = nbinompdf(X, n, p);
W = nbinomcdf(X, n, p);

f x = x + n −1! x! n −1! px 1 − pn

F x = ∑ k=0x x + n −1! x! n −1! px 1 − pn

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the negative-binomial distribution with n failures until stopping and probability of success in each trial p, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative integer entries
  • If X contains negative entries an error is produced
  • n must be a positive number
  • p must be a number between zero and one

Note that the function allows for non-integer values of n by replacing the factorials in the expression by the Gamma function.




W = poissonpdf(X, lambda);
W = poissoncdf(X, lambda);

f x = λxe−λ x!

F x = λke−λ k!

W is a matrix with dimensions equal to those of X and entries equal to the pdf/cdf of the Poisson distribution with rate parameter lambda, evaluated at each entry of X. The function works element-wise.

  • X must be a matrix or dataset with non-negative integer entries
  • If X contains negative entries an error is produced
  • lambda must be a positive number



Share this content:
Facebook Twitter LinkedIn Email
© 2016–20 Grigorios Emvalomatis