Statistical functions
- Beta and noncentral beta distributions
- Cumulative beta distribution
- Probability density of the beta distribution
- Right-tailed beta distribution
- Inverse cumulative beta distribution
- Inverse of the upper-tailed distribution
- Cumulative noncentral beta distribution
- Probability density of the noncentral beta distribution
- Inverse cumulative noncentral beta distribution
- Binomial distribution
- Cumulative binomial distribution
- Probability mass of the binomial distribution
- Right-tailed binomial distribution
- Inverse cumulative binomial distribution
- Inverse of the upper-tailed binomial distribution
- Cauchy distribution
- Cumulative Cauchy distribution
- Probability density of the Cauchy distribution
- Reverse cumulative Cauchy distribution
- Inverse cumulative Cauchy distribution
- Inverse upper-tailed Cauchy distribution
- Natural log of the Cauchy density
- Chi-squared distribution
- Cumulative chi-squared distribution
- Probability density of chi-squared distribution
- Right-tailed chi-squared distribution
- Inverse cumulative chi-squared distribution
- Inverse of the upper-tailed chi-squared distribution
- Noncentral chi-squared distribution
- Cumulative noncentral chi-squared distribution
- Inverse cumulative noncentral chi-squared distribution
- Noncentrality parameter of the noncentral chi-squared distribution
- Probability density of noncentral chi-squared distribution
- Reverse cumulative noncentral chi-squared distribution
- Inverse of upper-tailed noncentral chi-squared distribution
- Dirichlet distribution
- Natural log of the Dirichlet density
- Dunnett's multiple range
- Cumulative Dunnett's multiple range distribution
- Inverse cumulative Dunnett's multiple range distribution
- Exponential distribution
- Probability density of the exponential distribution
- Cumulative exponential distribution
- Reverse cumulative exponential distribution
- Inverse cumulative exponential distribution
- Inverse upper-tailed exponential distribution
- F and noncentral F distributions
- Cumulative F distribution
- Probability density of the F distribution
- Right-tailed F distribution
- Inverse cumulative noncentral F distribution
- Inverse cumulative F distribution
- Inverse of the upper-tailed distribution
- Cumulative noncentral F distribution
- Probability density of the noncentral F
- Right-tailed noncentral F distribution
- Inverse upper-tailed noncentral F distribution
- Noncentrality parameter of the noncentral F distribution
- Gamma distribution
- Cumulative gamma distribution
- Probability density of the gamma distribution
- Right-tailed gamma distribution
- Inverse cumulative gamma distribution
- Inverse of the upper-tailed distribution
- Partial derivatives of the cumulative gamma distribution
- Second partial derivatives of the cumulative gamma distribution
- Natural log of the inverse gamma density
- Geometric distribution
- Natural log of the geometric density
- Hypergeometric distribution
- Cumulative hypergeometric distribution
- Probability mass of the hypergeometric distribution
- Inverse Gaussian distribution
- Cumulative inverse Gaussian distribution
- Probability density of the inverse Gaussian distribution
- Reverse cumulative inverse Gaussian distribution
- Inverse cumulative inverse Gaussian distribution
- Inverse upper-tailed inverse Gaussian distribution
- Natural log of the inverse Gaussian density
- Laplace distribution
- Cumulative Laplace distribution
- Probability density of the Laplace distribution
- Reverse cumulative Laplace distribution
- Inverse cumulative Laplace distribution
- Inverse upper-tailed Laplace distribution
- Natural log of the Laplace density
- Logistic distribution
- Probability density of the logistic distribution
- Cumulative logistic distribution
- Reverse cumulative logistic distribution
- Inverse cumulative logistic distribution
- Inverse upper-tailed logistic distribution
- Negative binomial distribution
- Cumulative negative binomial distribution
- Probability mass function of the negative binomial distribution
- Right-tailed negative binomial distribution
- Inverse cumulative negative binomial distribution
- Inverse of the upper-tailed negative binomial distribution
- Normal, log of the normal, and binormal distributions
- Cumulative bivariate normal distribution
- Cumulative standard normal distribution
- Probability density of the normal distribution
- Inverse cumulative standard normal distribution
- Log of the cumulative standard normal distribution
- Log of the probability density of the normal distribution
- Natural log of the multivariate normal density
- Pareto distribution
- Natural log of the Pareto density
- Poisson distribution
- Cumulative Poisson distribution
- Probability mass of the Poisson distribution
- Right-tailed Poisson distribution
- Inverse cumulative Poisson distribution
- Inverse of the upper-tailed Poisson distribution
- Student's t and noncentral Student's t distributions
- Cumulative Student's t distribution
- Probability density of the Student's t distribution
- Right-tailed Student's t distribution
- Inverse cumulative Student's t distribution
- Inverse of the upper-tailed Student's t distribution
- Cumulative noncentral Student's t distribution
- Probability density of the noncentral Student's t distribution
- Right-tailed noncentral Student's t distribution
- Inverse cumulative noncentral Student's t distribution
- Inverse of the upper-tailed noncentral Student's t distribution
- Noncentrality parameter of the noncentral Student's t distribution
- Tukey's Studentized range
- Cumulative Tukey's Studentized range distribution
- Inverse cumulative Tukey's Studentized range distribution
- Weibull distribution
- Probability density of the Weibull distribution
- Cumulative Weibull distribution
- Upper-tailed Weibull distribution
- Inverse cumulative Weibull distribution
- Inverse upper-tailed Weibull distribution
- Weibull (proportional hazards) distribution
- Probability density of the Weibull (proportional hazards) distribution
- Cumulative Weibull (proportional hazards) distribution
- Reverse cumulative Weibull (proportional hazards) distribution
- Inverse cumulative Weibull (proportional hazards) distribution
- Inverse upper-tailed Weibull (proportional hazards) distribution
- Wishart and inverse Wishart distributions
- Natural log of the density of the Wishart distribution
- Natural log of the density of the inverse Wishart distribution
Date and time functions Updated
- Complete suite of functions for manipulating dates and
datetimes, including support for business calendars and leap
seconds
- Convert dates and datetimes in string form to numeric form
with great flexibility, including support for any order of year,
month, day, hour, minute, second, and millisecond
- Extract day, day of week, week of year, month, quarter,
half-year, or year from specified date
- Extract hour, minute, second, or millisecond from specified
time or datetime, including optional adjustments for leap
seconds
- Convert between units of date and time
- Convert between business dates and regular dates
- Calculate durations such as age, factoring in leap days and leap seconds
- Find relative dates such as the first date of next month or the previous leap year
- Week-related functions New
Time-series functions
- Return whether time is within a specified range, excluding
the range's endpoints
- Return whether time is within a specified range, including
the range's endpoints
Matrix functions
Stata has a powerful matrix
language called Mata that contains hundreds of functions.
Below, we list some basic matrix functions that are
provided within Stata. All of the same functionality, and
more, is provided in Mata too. Mata is included with Stata.
- Determinant of matrix
- Trace of matrix
- Number of rows of matrix
- Number of columns of matrix
- Number of zeros on diagonal of matrix
- Floor of matrix element
- Check if matrix is symmetric
- Check for missing elements in matrix
- Relative difference of two matrices
- Column number associated with specified column name
- Row number associated with specified row name
- Identity matrix
- Inverse of matrix
- Cholesky decomposition
- Hadamard matrix
- Sweep matrix
- Correlation matrix of variance matrix
- Diagonal matrix from vector
- r x c matrix with each element equal to z
- r x c matrix with elements containing uniformly distributed
pseudorandom numbers in [0,1]
- Column vector from matrix
Random-number functions
- Uniform over interval (0,1)
- Uniform over interval (a,b)
- Uniform integers over interval [a,b]
- Standard normal
- Normal, mean m and std. deviation 1
- Normal, mean m and std. deviation s
- Beta
- Binomial
- Cauchy
- Chi-squared
- Dirichlet
- Exponential
- Gamma
- Geometric
- Hypergeometric
- Inverse Gaussian
- Laplace
- Logistic, mean 0 and std. deviation π/√3
- Logistic, mean 0, scale s, std. deviation sπ/√3
- Logistic, mean m, scale s, std. deviation sπ/√3
- Negative binomial
- Pareto
- Poisson
- Student's t
- Weibull, shape a, scale b
- Weibull, shape a, scale b, location g
- Weibull (proportional hazards), shape a, scale b
- Weibull (proportional hazards), shape a, scale b, location g
Random-number generators
- 64-bit Mersenne Twister generator
- Stream version of 64-bit Mersenne Twister
- Allow random numbers to be drawn correctly
on multiple machines or in multiple processes
- Each stream is independent of other streams
- When the stream generator is used, all random-number
functions automatically become stream enabled.
- 32-bit KISS generator
Mathematical functions
- Programming functions
- Absolute value
- Ceiling
- Combinatorial
- Floor
- Maximum
- Minimum
- Modulus
- Relative difference
- Round of x in units of y
- Running sum
- Sign
- Truncation
- Common transcendental functions
- Natural logarithm
- Base-10 logarithm
- Exponential
- Natural log of n factorial
- Complementary log-log
- Inverse of the complementary log-log
- Logit
- Inverse of the logit
- Square root
- Natural log of gamma
- digamma
- trigamma
- High-precision transcendental functions
- Exponential minus 1
- Natural logarithm of 1+x
- Natural logarithm of 1-x
Trigonometric functions
- Sine of radians
- Cosine of radians
- Tangent of radians
- Arcsine returning radians
- Arccosine returning radians
- Arctangent returning radians
- Two-argument arctangent
- Inverse hyperbolic sine
- Inverse hyperbolic cosine
- Inverse hyperbolic tangent
- Hyperbolic sine
- Hyperbolic cosine
- Hyperbolic tangent
String functions Updated
- Full Unicode (UTF-8) support
- Abbreviation
- Concatenation
- Duplication
- Reduce multiple, consecutive internal blanks to one blank
- Remove leading blanks
- Remove trailing blanks
- Remove both leading and trailing blanks
- Lowercase string
- Convert string to "proper" case
- Uppercase string
- Locale-aware "titlecase" string
- Pluralize string
- Reversed string
- Substitution of characters for pattern found in string
- Substitution of characters for word found in string
- Extract substring
- Length of string
- Position of first character in string in list of match characters
- Position of first character in string not in list of match characters
- Position of string in another string
- nth word of string
- Number of words in string
- Convert string to numeric
- Convert numeric to string
- Sort and compare Unicode strings based on locale
- Regular expression pattern matching
- Regular expression pattern replacement
- Regular expression pattern subexpressions
- Convert string to valid Stata name
- Wildcard pattern matching
- Convert strings to/from Unicode (UTF-8) and extended ASCII
- Escape and unescape Unicode (UTF-8) strings
- Unicode character for code point
- Code point for Unicode character
- ASCII character for decimal number
- Soundex code for string
- U.S. Census soundex code for string
- Advanced regular expression functions New
Low-level programming functions Updated
- Access data from linked frames Updated
- Partition interval into n equal-length intervals
- Recode number into one of several specified categories
- Byte order of computer architecture on which Stata is
currently running
- Version of caller of currently running program to assist
with backward compatibility version control
- Round if rounding does not exceed specified tolerance
- Convert number to single-precision floating-point value
- Restrict returned value to a range
- Conditional function to return one value if argument is true
and another value if argument is false
- Check for any missing value in set or arguments
- Access system parameters, system constants, and current
setting values Updated
- Access results of Stata commands
- Return whether observation is in estimation subsample
- Check whether value is in a list of arguments, string or
numeric
- Check whether value lies within a specified range of numbers
or strings
- Return maximum output width for value displayed with
specified display format
- Access machine precision of double- and single-precision
floating-point numbers
- Access cutoff value for normalized/denormalized IEEE
double-precision floating point numbers
- Access largest and smallest possible values of each
numeric Stata variable storage type
- Read contents of file into string
- Write string to file
- Check whether file exists
- Normalize Unicode strings
- Search for invalid UTF-8 sequences
- Encode and decode strings and files to and from Base64 format New
Additional resource
See the Mata Reference Manual for information on Mata functions.
See New in Stata 18 to learn about what was added in Stata 18.