Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Gauss


From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: Gauss
Date   Wed, 20 Oct 2004 09:33:37 -0400

On Oct 20, 2004, at 2:33, Stephen wrote:


2. Does a procedure/process or method exist that can easily or with not
much difficulty convert Gauss code to Stata? If someone can point me in the
right direction, I will gladly create the Stata module and share.

GAUSS, like MATLAB, Octave and Ox, is a matrix language. Although Stata contains a matrix programming language, it is often not very handy to use it in the same way that one can in the true matrix languages due to the size constraint. On the other hand, to work in a true matrix language, you always have to do the housekeeping, recalling which column is which variable, etc. Stata uniquely makes that easy by labelling rows and columns (e.g. of e(V)). But given that matrix languages and procedural programming languages are quite different beasts, there is not (and IMHO not likely to be) a very straightforward way of doing that translation, any more than one can locate a COBOL-to-Java translator.

On the other hand there are various ways to skin the cat. Since Intercooled Stata cannot cope with more than 800 rows or columns in a matrix, straightforward translation often fails (or only works for Stata/SE)--although ingenious tricks like 'matrix accum' obviate the need for many matrix operations that would involve matrices which are too large. A return to earlier implementations, where possible, is one way out. The MATLAB implementation of the Hodrick-Prescott filter naturally uses matrices, and will fail for T>800. But I have just translated Ed Prescott's original FORTRAN code line for line into Stata. SInce FORTRAN does not have matrix operators, it is straightforward to represent the FORTRAN arrays as Stata variables, which means this version of the code will work for any T (It is surely not very fast, but it is faster than 'tabi' or many operations with 'gllamm'). My RA is validating its results vs. MATLAB, and when that is done I will put it up on SSC (hopefully ending the many threads on this list about 'why doesn't hpfilter work?!?) So if you can find FORTRAN or C code for an econometric procedure, you can translate it into Stata, just about line for line.

Kit Baum, Boston College Economics [email protected]
http://ideas.repec.org/e/pba1.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