Stata
Products Purchase Support Company
Search
   >> Home >> Products >> Stata 10 >> Mata
order stataorder stata

Mata

For an introduction to Mata, click here.

Here’s what’s new in Stata 10

  1. New Stata command include is a variation on do and run and is useful for implementing #include for header files in advanced programming situations. See [P] include and type viewsource optimize.mata for an example of use.
  2. Mata now has structures, which will be of special interest to those writing large systems. See [M-2] struct and [M-5] liststruct().
  3. Mata now engages in more thorough type checking, and produces better code, for those who explicitly declare arguments and variables.
  4. Mata inherits all of Stata’s formats and functions for dealing with the new date/time variables and values; see [M-5] date() and [M-5] fmtwidth().
  5. New functions inbase() and frombase perform base conversions; see [M-5] inbase().
  6. New function floatround() returns values rounded to float precision. This is Mata’s equivalent of Stata’s float() function. See [M-5] floatround().
  7. New function nameexternal() returns the name of an external; see [M-5] findexternal().
  8. Concerning matrix manipulation,
    1. Matrix multiplication is now faster when one of the matrices contains many zeros, as is function cross().
    2. Appending rows or columns to a matrix using , and \ is now faster.
    3. New function _diag() replaces the principal diagonal of a matrix with a specified vector or scalar; see [M-5] _diag().
    4. New functions select() and st_select() select rows or columns of a matrix on the basis of a criterion; see [M-5] select().
    5. Existing functions rowsum(), colsum(), sum(), quadrowsum(), quadcolsum(), and quadsum() now allow an optional second argument that determines how missing values are handled; see [M-5] sum().
    6. New functions runningsum(), quadrunningsum(), _runningsum(), and _quadrunningsum() return the running sum of a vector; see [M-5] runningsum().
    7. New functions minindex() and maxindex() return the indices of minimums and maximums (including tied values) of a vector; see [M-5] minindex().
  9. Concerning statistics,
    1. New Mata function optimize() performs minimization and maximization. You can code just the function, the function and its first derivatives, or the function and its first and second derivatives. Optimization techniques include Newton–Raphson, Davidon–Fletcher–Powell, Broyden–Fletcher–Goldfarb–Shanno, Berndt–Hall–Hall–Hausman, and the simplex method Nelder–Mead. See [M-5] optimize().
    2. New function cvpermute() forms permutations; see [M-5] cvpermute().
    3. New function ghk() provides the Geweke–Hajivassiliou–Keane multivariate normal simulator; see [M-5] ghk(). New function ghkfast() is faster but a little more difficult to use; see [M-5] ghkfast().
    4. New functions halton(), _halton(), and ghalton() compute Halton and Hammersley sets; see [M-5] halton().
    5. The new density and probability functions available in Stata are also available in Mata, including binomial(), binomialtail(), gammaptail(), invgammaptail(), invbinomialtail(), ibetatail(), invibetatail(), lnnormal(), and lnnormalden(); see [M-5] normal(). Also, as in Stata, convergence and accuracy of many of the cumulatives, reverse cumulatives, and density functions have been improved.
    6. Existing Mata functions mean(), variance(), quadvariance(), meanvariance(), quadmeanvariance(), correlation(), and quadcorrelation() now make the weight argument optional. If not specified, unweighted estimates are returned. See [M-5] mean().
  10. Concerning string processing,
    1. New function stritrim() replaces multiple, consecutive internal spaces with one space; see [M-5] strtrim().
    2. New functions strtoreal() and _strtoreal() convert strings to numeric values; see [M-5] strtoreal().
    3. New function _substr() substitutes a substring into an existing string; see [M-5] _substr().
    4. New function invtokens() is the inverse of the existing function tokens(); see [M-5] invtokens().
    5. New function tokenget() performs advanced parsing; see [M-5] tokenget().
  11. Concerning I/O,
    1. New function adosubdir() returns the subdirectory in which Stata would search for a file; see [M-5] adosubdir(). New function pathsearchlist(fn) returns a row vector of full paths/filenames specifying all the locations, in order, where Stata would look for the specified fn along the official Stata ado-path; see [M-5] pathjoin().
    2. New function byteorder() returns 1 if the computer is HILO and returns 2 if the computer is LOHI; see [M-5] byteorder().
    3. New undocumented function st_fopen() makes opening files easier; see help mata st_fopen().
    4. New functions bufput() and bufget() copy elements into and out of buffers; see [M-5] bufio().
    5. Existing function cat() now allows optional second and third arguments that specify the beginning and ending lines of the file to read; see [M-5] cat().
  12. New functions ferrortext() and freturncode() obtain error messages and return codes following an I/O error; see [M-5] ferrortext().
  13. Concerning the Stata interface,
    1. New function stataversion() returns the version of Stata that you are running, and new function statasetversion() allows setting it. See [M-5] stataversion().
    2. New function setmore() allows turning more on and off. New function setmoreonexit() allows restoring more to its original setting when execution ends. See [M-5] more().
    3. New undocumented function st_lchar() allows storing exceedingly long strings (such as a varlist) in Stata dataset characteristics. See help mata st_lchar().

Back to highlights

Stata 10
Overview: Why use Stata?
Stata/MP
64-bit Stata
Capabilities
New in Stata 10
Highlights
Graph Editor
Mixed models
Exact statistics
Power analysis
Endogenous variables
Multivariate methods
Dynamic panel data
Choice models
Survey data
GUI
Time/date variables
Saved results
More statistics
Survival analysis
Time series
Panel data
Mata
Programming
Stata/MP
Interface
Supported platforms
Which Stata package?
Technical support
User comments
Products
Stata 10
Order Stata
Upgrade
NetCourses
Bookstore
Stata Journal
Stata Press
Stata News
STB
Stat/Transfer
Gift Shop

Site overview
Products
Resources & support
Company
Site index

© Copyright 1996–2008 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index