Search
>> Home >> Bookstore >> Documentation >> Mata Reference Manual

## Mata Reference Manual (2 volumes)

 Publisher: Stata Press Copyright: 2011 ISBN-13: 978-1-59718-086-3 Pages: 923 Price: \$85.00 Sample entries (pdf): [M-2] op_colon—Colon operators [M-5] qrd—QR decomposition Glossary (pdf) Subject and author index (pdf)

Brief Contents

 [M-0] Introduction to the Mata manual [M-1] Introduction and advice [M-2] Language definition [M-3] Commands for controlling Mata [M-4] Index and guide to functions [M-5] Mata functions [M-6] Mata glossary of common terms

[M-0] Introduction to the Mata manual

 intro (pdf) Introduction to the Mata manual

 intro Introduction and advice ado Using Mata with ado-files first (pdf) Introduction and first session help Obtaining online help how How Mata works interactive Using Mata interactively LAPACK The LAPACK linear-algebra routines limits Limits and memory utilization naming Advice on naming functions and variables permutation An aside on permutation matrices and vectors returnedargs Function arguments used to return results source Viewing the source code tolerance Use and specification of tolerances

[M-2] Language definition

 intro Language definition break Break out of for, while, or do loop class Object-oriented programming (classes) comments Comments continue Continue with next iteration of for, while, or do loop declarations Declarations and types do do ... while(exp) errors Error codes exp Expressions for for (exp1; exp2; exp3) stmt ftof Passing functions to functions goto goto label if if(exp)... else... op_arith Arithmetic operators op_assignment Assignment operator op_colon (pdf) Colon operators op_conditional Conditional operator op_increment Increment and decrement operators op_join Row- and column-join operators op_kronecker Kronecker direct-product operator op_logical Logical operators op_range Range operators op_transpose Conjugate transpose operator optargs Optional arguments pointers Pointers pragma Suppressing warning messages reswords Reserved words return return and return(exp) semicolons Use of semicolons struct Structures subscripts Use of subscripts syntax Mata language grammar and syntax version Version control void Void matrices while while (exp) stmt

[M-3] Commands for controlling Mata

 intro Commands for controlling Mata end End Mata and return to Stata mata Mata invocation command mata clear Clear Mata's memory mata describe Describe contents of Mata's memory mata drop Drop matrix or function mata help Obtain online help mata matsave Save and restore matrices mata memory Report on Mata's memory usage mata mlib Create function library mata mosave Save function's compiled code in object file mata rename Rename matrix or function mata set Set and display Mata system parameters mata stata Execute Stata command mata which Identify function namelists Specifying matrix and function names

[M-4] Index and guide to functions

 intro Index and guide to functions io I/O functions manipulation Matrix manipulation mathematical Important mathematical functions matrix Matrix functions programming Programming functions scalar Scalar mathematical functions solvers Functions to solve AX=B and to obtain A inverse standard Functions to create standard matrices stata Stata interface functions statistical Statistical functions string String manipulation functions utility Matrix utility functions

[M-5] Mata functions

 intro Mata functions abbrev() Abbreviate strings abs() Absolute value (length) adosubdir() Determine ado-subdirectory for file all() Element comparisons args() Number of arguments asarray() Associative arrays ascii() Manipulate ASCII codes assert() Abort execution if false blockdiag() Block-diagonal matrix bufio() Buffered (binary) I/O byteorder() Byte order used by computer C() Make complex c() Access c() value callersversion() Obtain version number of caller cat() Load file into string matrix chdir() Manipulate directories cholesky() Cholesky square-root decomposition cholinv() Symmetric, positive-definite matrix inversion cholsolve() Solve AX=B for X using Cholesky decomposition comb() Combinatorial function cond() Condition number conj() Complex conjugate corr() Make correlation matrix from variance matrix cross() Cross products crossdev() Deviation cross products cvpermute() Obtain all permutations date() Date and time manipulation deriv() Numerical derivatives designmatrix() Design matrices det() Determinant of matrix _diag() Replace diagonal of a matrix diag() Create diagonal matrix diag0cnt() Count zeros on diagonal diagonal() Extract diagonal into column vector dir() File list direxists() Whether directory exists direxternal() Obtain list of existing external globals display() Display text interpreting SMCL displayas() Set display level displayflush() Flush terminal-output buffer Dmatrix Duplication matrix dsign() FORTRAN-like DSIGN() function e() Unit vectors editmissing() Edit matrix for missing values edittoint() Edit matrix for roundoff error (integers) edittozero() Edit matrix for roundoff error (zeros) editvalue() Edit (change) values in matrix eigensystem() Eigenvectors and eigenvalues eigensystemselect() Compute selected eigenvectors and eigenvalues eltype() Element type and organizational type of object epsilon() Unit roundoff error (machine precision) _equilrc() Row and column equilibration error() Issue error message errprintf() Format output and display as error message exit() Terminate execution exp() Exponentiation and logarithms factorial() Factorial and gamma function favorspeed() Whether speed or space is to be favored ferrortext() Text and return code of file error code fft() Fourier transform fileexists() Whether file exists _fillmissing() Fill matrix with missing values findexternal() Find, create, and remove external globals findfile() Find file floatround() Round to float precision fmtwidth() Width of %fmt fopen() File I/O fullsvd() Full singular value decomposition geigensystem() Generalized eigenvectors and eigenvalues ghessenbergd() Generalized Hessenberg decomposition ghk() Geweke–Hajivassiliou–Keane (GHK) multivariate normal simulator ghkfast() GHK multivariate normal simulator using pregenerated points gschurd() Generalized Schur decomposition halton() Generate a Halton or Hammersley set hash1() Jenkins' one-at-a-time hash function hessenbergd() Hessenberg decomposition Hilbert() Hilbert matrices I() Identity matrix inbase() Base conversion indexnot() Find character not in list invorder() Permutation vector manipulation invsym() Symmetric real matrix inversion invtokens() Concatenate string rowvector into string scalar isdiagonal() Whether matrix is diagonal isfleeting() Whether argument is temporary isreal() Storage type of matrix isrealvalues() Whether matrix contains only real values issymmetric() Whether matrix is symmetric (Hermitian) isview() Whether matrix is view J() Matrix of constants Kmatrix() Commutation matrix lapack() LAPACK linear-algebra functions liststruct() List structure's contents Lmatrix() Elimination matrix logit() Log odds and complementary log-log lowertriangle() Extract lower or upper triangle lud() LU decomposition luinv() Square matrix inversion lusolve() Solve AX=B for X using LU decomposition makesymmetric() Make square matrix symmetric (Hermitian) matexpsym() Exponentiation and logarithms of symmetric matrices matpowersym() Powers of a symmetric matrix mean() Means, variances, and correlations mindouble() Minimum and maximum nonmissing value minindex() Indices of minimums and maximums minmax() Minimums and maximums missing() Count missing and nonmissing values missingof() Appropriate missing value mod() Modulus moptimize() Model optimization more() Create –more– condition _negate() Negate real matrix norm() Matrix and vector norms normal() Cumulatives, reverse cumulatives, and densities optimize() Function optimization panelsetup() Panel-data processing pathjoin() File path manipulation pinv() Moore–Penrose pseudoinverse polyeval() Manipulate and evaluate polynomials printf() Format output qrd() (pdf) QR decomposition qrinv() Generalized inverse of matrix via QR decomposition qrsolve() Solve AX=B for X using QR decomposition quadcross() Quad-precision cross products range() Vector over specified range rank() Rank of matrix Re() Extract or real or imaginary part reldif() Relative/absolute difference rows() Number of rows and number of columns rowshape() Reshape matrix runiform() Uniform and nonuniform pseudorandom variates runningsum() Running sum of vector schurd() Schur decomposition select() Select rows or columns setbreakintr() Break-key processing sign() Sign and complex quadrant functions sin() Trigonometric and hyperbolic functions sizeof() Number of bytes consumed by object solve_tol() Tolerance used by solvers and inverters solvelower() Solve AX=B for X, A triangular sort() Reorder rows of matrix soundex() Convert string to soundex code spline3() Cubic spline interpolation sqrt() Square root st_addobs() Add observations to current Stata dataset st_addvar() Add variable to current Stata dataset st_data() Load copy of current Stata dataset st_dir() Obtain list of Stata objects st_dropvar() Drop variables or observations st_global() Obtain strings from and put strings into global macros st_isfmt() Whether valid %fmt st_isname() Whether valid Stata name st_local() Obtain strings from and put strings into Stata macros st_macroexpand() Expand Stata macros in string st_matrix() Obtain and put Stata matrices st_numscalar() Obtan values from and put values into Stata scalars st_nvar() Number of variables and observations st_rclear() Clear r(), e(), or s() st_store() Modify values stored in current Stata dataset st_subview() Make view from view st_tempname Temporary Stata names st_tsrevar() Create time-series op.varname variables st_updata Determine or set data-have-changed flag st_varformat() Obtain/set format, etc., of Stata variable st_varindex() Obtain variable indices from variable names st_varname() Obtain variable names from variable indices st_varrename() Rename Stata variable st_vartype() Storage type of Stata variable st_view() Make matrix that is a view onto current Stata dataset st_viewvars() Variables and observations of view st_vlexists() Use and manipulate value labels stata() Execute Stata command stataversion() Version of Stata being used strdup() String duplication strlen() Length of string strmatch() Determine whether string matches pattern strofreal() Convert real to string strpos() Find substring in string strreverse() Reverse string strtoname() Convert a string to a Stata name strtoreal() Convert string to real strtrim() Remove blanks strupper() Convert string to uppercase (lowercase) subinstr() Substitute text sublowertriangle() Return a matrix with zeros above a diagonal _substr() Substitute into string substr() Extract substring sum() Sums svd() Singular value decomposition svsolve() Solve AX=B for X using singular value decomposition swap() Interchange contents of variables Toeplitz() Toeplitz matrices tokenget() Advanced parsing tokens() Obtain tokens from string trace() Trace of square matrix _transpose() Transposition in place transposeonly() Transposition without conjugation trunc() Round to integer uniqrows() Obtain sorted, unique values unitcircle() Complex vector containing unit circle unlink() Erase file valofexternal() Obtain value of external global Vandermonde() Vandermonde matrices vec() Stack matrix columns

[M-6] Mata glossary of common terms

 Glossary (pdf) Subject and author index (pdf)