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 ex 2 2p 2 Γ p2

F x = 0xtp 2 1 et 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 ez

F x = exp ez

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 = exμ s s 1 + exμ s 2

F x = 1 1 + exμ 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 1xμ2 2σ2 x 1 x2πσ2

F x = 0x exp log t 1tμ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 βα1ex βα

F x = 1 ex βα

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 pnx

F x = k=0x n! k! n k!pk 1 pnk

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