Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: programming with Stata


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: programming with Stata
Date   Sun, 4 May 2008 14:52:42 -0400

Tunga said

Thanks for your answer Maarten.
There are really not many people who can compare ox and mata languages.
Therefore I would like to further the question:

Is mata a clean language, as ox? What possibly would I be missing by not
going for Mata?
What would make me choose mata instead of ox? Or, so many people use matlab.
Why should I go for mata instead of matlab?

My question may not be easy to answer because I am simply asking an
objective comparison of programming languages.
There are articles which compare ox, gauss, s plus etc...
But stata is a different issue here. As one uses Stata's higher level
language capabilities,
it makes little sense to switch to another program for lower level
languages, if mata is as good as gauss or ox...

Also I don't really get objective advises. People advise one over other,
without giving clear reasons.
Perhaps this is because they are not able to compare, but they don't mention
this and advise the one they know.
This is not an advise I am seeking.
I will invest time into this. And I want to know for what I am investing my
time.
I want to know what I would be missing by leaving other options away.
Or would the differences be less than I am thinking of?


I have no knowledge of GAUSS (other than that the functions are exceedingly unpredictable in their calling sequences)-it has not been, generally, platform-independent. I have programmed in Ox for a number of projects, and done some MATLAB and Mathematica programming as well as extensive work in Fortran. Mata is IMHO an excellent solution for anyone needing the lower-level facilities of a matrix programming language without the hassle of dealing with all the fussy stuff of handling output, data manipulation, etc. Furthermore it is p- code, compiled on the fly (or it can be stored in compiled format) which makes for a **significant** speed improvement for most tasks over interpreted code. MATLAB is slow at many things unless it is compiled and apart from Jim LeSage's Econometrics Toolbox has virtually no built-in support for econometrics---you have to write it all yourself. Ox is very fast and C-like, but a bit fussy when it comes to things like data import/export. Mata is C-like to a large extent, with many of the features you would find in a C-like language: structures, pointers, header files, function passing, and the like. Furthermore it has the advantage of being very close, syntactically, to something like MATLAB, so that it is generally very easy to translate existing code in MATLAB (or Ox, or GAUSS, or even Fortran--see Bill Gould, Stata Journal article on that) into Mata. And if you want to share your code with others, no one makes that easier than Stata with -net from- and -ssc-.

I agree wholeheartedly with Maarten in that the combination of high level features in Stata's language (e.g., -syntax-, -simulate-, - bootstrap-, missing data handling) and low-level, efficient programming features in Mata are unparalleled. Those who suggest it is not a good platform for econometric work don't know enough about what they're saying to make an informed statement. The recent addition of -optimize- to Mata has given it hugely valuable capabilities in that regard: Mark Schaffer and I put together a GMM- CUE routine (see our paper with Stillman, SJ 7:4) that is a fraction of the ado-file code in -ivreg2- and runs from five to twelve times faster. The construction of that routine is illustrated in the last section of my forthcoming "Introduction to Stata Programming", soon to be available from Stata Press.

Kit

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index