Statalist


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

Re: st: Re: moving from Stata to Mata


From   "Thomas Jacobs" <[email protected]>
To   [email protected]
Subject   Re: st: Re: moving from Stata to Mata
Date   Tue, 16 Oct 2007 09:20:24 -0500

Dear Dan,

Thanks.  I followed what you were saying once I spent a while in the
manual as to learn st_view, you really need to understand st_data.
The former creates a view similar to the way a database view works
while the latter actually creates a complete copy of the data on the
mata "side".  For my problem, which entails numerous computations on
each row, the manual indicated the calculation performance will be
more important than the memory use as using the view requires
gathering the data in each step.  In any case, I appreciate the
direction as I was really floundering at the point I got your post.

Sincerely,

Tom

On 10/16/07, [email protected] <[email protected]> wrote:
> For the record, my point was that Tom might be better off creating variables in Stata and then using them as matrices in Mata.
>
> Is a stata variable not a lot like a vector?
>
> Daniel
>
> -----Original Message-----
>
> From:  Kit Baum <[email protected]>
> Subj:  st: Re: moving from Stata to Mata
> Date:  Tue Oct 16, 2007 6:27 am
> Size:  1K
> To:  [email protected]
>
> Contrary to another poster's comment, st_view() will not help here.
> st_view allow you to access Stata's variables, not matrices or
> "vectors" (note that Stata does not have a vector data type; all
> "vectors" are matrices with a unit subscript on one dimension. Mata
> has true vectors, rowvectors and colvectors).
>
> st_local
> st_global
> st_numscalar
> st_matrix
>
> allow you to do the same with Stata's macros, scalars and matrices.
> They all have one- and two-argument forms. The one-argument form
> allows you to access the Stata object; the two-argument form allows
> you to update the contents (or indeed create) the Stata object. See
>
> help m4_stata
>
> for a complete list of the functions of this nature.
>
>
> 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
>
>
> On Oct 16, 2007, at 2:33 AM, statalist-digest wrote:
>
> >
> > If one is working with program or do file in Stata and wishes to move
> > to Mata within the program to use a Mata function for a matrix or
> > vector defined in the Stata program, is this possible?
>
> *
> *   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/
>
>
> *
> *   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/
>


-- 
Thomas Jacobs
*
*   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