Function Type | Beginning of Name |
Cumulative distribution (CDF) | @c |
Density or probability | @d |
Quantile (inverse CDF) | @q |
Random number generator | @r |
Distribution | Functions | Density/Probability Function |
Beta | @cbeta(x,a,b[,n]), @dbeta(x,a,b), @qbeta(p,a,b), @rbeta(a,b) | for and for , where is the @beta function. |
Binomial | @cbinom(x,n,p), @dbinom(x,n,p), @qbinom(s,n,p), @rbinom(n,p) | if , and 0 otherwise, for . |
Chi-square | @cchisq(x,v[,n]), @dchisq(x,v), @qchisq(p,v), @rchisq(v) | where , and . Note that the degrees of freedom parameter need not be an integer. In addition, the @chisq(x,v) function may be used to obtain the p-values directly. |
Exponential | @cexp(x,m[,n]), @dexp(x,m), @qexp(p,m), @rexp(m) | for , and . |
Extreme Value (Type I-minimum) | @cextreme(x[,n]), @dextreme(x), @qextreme(p), @cloglog(p), @rextreme | for . |
F-distribution | @cfdist(x,v1,v2[,n]), @dfdist(x,v1,v2), @qfdist(p,v1,v2), @rfdist(v1,v1) | where , and . Note that the functions allow for fractional degrees of freedom parameters and . |
Gamma | @cgamma(x,b,r[,n]), @dgamma(x,b,r), @qgamma(p,b,r), @rgamma(b,r) | where , and . |
Generalized Error | @cged(x,r[,n]), @dged(x,r), @qged(p,r), @rged(r) | where , and . |
Laplace | @claplace(x[,n]), @dlaplace(x), @qlaplace(x), @rlaplace | for . |
Logistic | @clogistic(x[,n]), @dlogistic(x), @qlogistic(p), @rlogistic | for . |
Log-normal | @clognorm(x,m,s[,n]), @dlognorm(x,m,s), @qlognorm(p,m,s), @rlognorm(m,s) | , , and . |
Negative Binomial | @cnegbin(x,n,p), @dnegbin(x,n,p), @qnegbin(s,n,p), @rnegbin(n,p) | if , and 0 otherwise, for . |
Normal (Gaussian) | @cnorm(x[,n]), @dnorm(x), @qnorm(p), @rnorm, nrnd, @logcnorm | for . @logcnorm is a more numerically stable function for the computation of @log(@cnorm(x)) |
Poisson | @cpoisson(x,m), @dpoisson(x,m), @qpoisson(p,m), @rpoisson(m) | if , and 0 otherwise, for . |
Pareto | @cpareto(x,k,a[,n]), @dpareto(x,k,a), @qpareto(p,k,a), @rpareto(k,a) | for location parameter and shape parameter . |
Student's ‑distribution | @ctdist(x,v[,n]), @dtdist(x,v), @qtdist(p,v), @rtdist(v) | for , and . Note that , yields the Cauchy distribution. |
Uniform | @cunif(x,a,b), @dunif(x,a,b), @qunif(p,a,b), @runif(a,b), rnd | for and . |
Weibull | @cweib(x,m,a[,n]), @dweib(x,m,a), @qweib(p,m,a), @rweib(m,a) | where , and . |
Distribution | Functions | Density/Probability Function/Additional Info |
Bivariate Normal Distribution | @cbvnorm(x,y,r), @dbvnorm(x,y,r) | Compute the bivariate normal cumulative distribution and density functions at and for a distribution with means 0, variances 1, and correlation . |
Function Suffix | Additional Forms for Scale Matrix Input |
-c | Supply the Cholesky decomposition of . This form is more efficient when performing multiple draws from the same distribution (compute the Cholesky once, but sample many times). |
-i | Supply . This form is more efficient than explicitly inverting to supply . |
-ic | Supply the Cholesky decomposition of . This form combines the efficiencies of the above forms. |
Distribution | Functions | Density/Probability Function/Additional Info |
Multivariate Normal Distribution | @dmvnorm(x, S), @dmvnormc(x, S), @dmvnormi(x, S), @dmvnormic(x, S), @rmvnorm(S[, n]), @rmvnormc(S[, n]), @rmvnormi(S[, n]), @rmvnormic(S[, n]) | , where and covariance matrix is positive semi-definite. x is a vector, S is a sym object. @dmvnorm* returns a scalar. @rmvnorm* returns a vector or matrix. If the optional argument n is omitted, the function returns a vector containing a single draw from the distribution. If n is provided, n is the number of rows of the returned matrix, with each row representing a draw from the distribution. |
Wishart Distribution | @dwish(X, S, n), @dwishc(X, S, n), @dwishi(X, S, n), @dwishic(X, S, n), @rwish(S, n), @rwishc(S, n), @rwishi(S, n), @rwishic(S, n) | , where , X and are positive definite matrices, and the degrees-of-freedom parameter and . Conceptually, X is the accumulated scatter matrix of n random draws from , i.e., , , though the mathematical definition has been extended to cover real-valued n. X and S are sym objects, n is a scalar. @rwish* returns a sym object. @dwish* returns a scalar. |
Inverse Wishart Distribution | @riwish(S, n), @riwish(X, S, n), @riwishc(S, n), @riwishc(X, S, n), @riwishi(S, n), @riwishi(X, S, n), @riwishic(S, n), @riwishic(X, S, n), @diwish(X, S, n), @diwishc(X, S, n), @diwishi(X, S, n), @diwishic(X, S, n) | , where , X and are positive definite matrices, and the degrees-of-freedom parameter and . , so there are many relations among the Wishart and inverse Wishart functions, e.g., @riwish(S, n) and @inverse(@rwish(@inverse(S), n)) draw from the same distribution. X and S are sym objects, n is a scalar. @riwish* returns a sym object. @diwish* returns a scalar. |
Function | Distribution | Description |
@chisq(x,v) | Chi-square | Returns the probability that a Chi-squared statistic with degrees of freedom exceeds : @chisq(x,v)=1–@cchisq(x,d) |
@fdist(x,v1,v2) | F-distribution | Probability that an F-statistic with numerator degrees of freedom and denominator degrees of freedom exceeds : @fdist(x,v1,v2)=1–@cfdist(x,v1,v2) |
@tdist(x,v) | t-distribution | Probability that a t-statistic with degrees of freedom exceeds in absolute value (two-sided p-value): @tdist(x,v)=2*(1–@ctdist(@abs(x),v)) |