Mata is a programming language that looks a lot like Java and C, but adds direct support for matrix programming. Mata is a compiled language, which makes it fast. You can use Mata interactively when you want to quickly perform matrix calculations, or you can use Mata when you need to write complex programs. Mata has the structures, pointers, and classes that you expect in your programming language. In fact, Mata is Stata’s development language. Most new features of Stata are written in Mata. This includes multilevel modeling, latent class analysis, Bayesian estimation, and even the core algorithms of the graphical SEM Builder. But Mata is not just for Stata developers; you too can take advantage of this powerful programming language.

ENVIRONMENT

• Interactive—type matrix expressions and see results
• Development—full development environment for developing programs and commands
• Automatically compiled code

GENERAL FEATURES AND MATRIX OPERATORS

• Matrices with more than 2 billion rows and columns in Stata/MP
• Matrices with up to 2 billion rows and columns in Stata/SE and Stata/IC
• Support for real and complex values
• Joining by rows or columns
• Addition, subtraction, multiplication, and scalar division
• Elementwise arithmetic
• Transposition and reshaping
• Inner and outer products

OPTIMIZATION FEATURES

• Code the function, function and gradient, or function, gradient, and Hessian
• Newton–Raphson, BFGS, DFP, BHHH, Nelder–Mead, and Gauss–Newton techniques
• Versions for general problems and statistical problems like maximum likelihood
• Covariance matrix based on Hessian, outer product of gradients, or robust/sandwich
• Linear programming

MATHEMATICAL AND MATRIX FUNCTIONS

• LAPACK numerical analysis routines
• Intel® Math Kernel Library (MKL)
• Hundreds of mathematical, string, and matrix utility functions
• Expansive date and time functions
• Unicode-aware string functions
• Locale-based sorting and string comparison
• Symmetric, nonsymmetric, and generalized inverses
• Cholesky, LU, QR, and SVD solvers
• Trigonometric and other transcendental functions
• Gamma and factorial functions
• Density and distribution functions
• Polynomial evaluation, arithmetic, and calculus
• Hilbert, Toeplitz, and Vandermonde matrices
• Duplication, commutation, and elimination matrices
• Random-number generation
• Fast Fourier analysis
• Cubic splines
• Means, sums, minimums and maximums of matrices
• Numerical first and second derivatives
• Numerical integration
• Vectorized numerical integration

STATA INTERFACE

• Convert Stata datasets to matrices and vice versa
• Virtual matrix views onto dataset

• Access and set estimation-class and other macros
• Manipulate dataset value labels
• Access and manipulate Stata data frames

COMPILED LANGUAGE

• C/C++-like syntax
• Classes
• Structures
• Pointers
• Numeric and string types
• Matrices as an intrinsic type, including row and column vectors and full matrices

OBJECT-ORIENTED PROGRAMMING

• Inheritance
• Virtual functions
• Encapsulation of data structures and programs

DECOMPOSITIONS

• Eigenvalues and eigenvectors
• Cholesky
• LU and LUD
• LDL
• QR
• Schur
• Hessenberg
• Singular value
• Permutation matrices

DATA ACCUMULATION

• Cross products
• Cross products of deviations from means
• Weighted and GLS-type cross products
• Support for quad-precision cross products

NONLINEAR SYSTEM SOLVER

• Fixed-point and root-finding problems
• Gauss–Seidel, Broyden–Powell, and Newton–Raphson methods

CREATION OF WORD, EXCEL, AND PDF FILES