Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Taking mata views of ereturn stats?


From   wgould@stata.com (William Gould, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Taking mata views of ereturn stats?
Date   Fri, 18 Dec 2009 11:38:33 -0600

Skipper Seabold <jsseabold@gmail.com> asks, 

> Is there a quick way to get e(V) into a matrix so that I can do
> element-wise operations like taking the square root of the diagonal?

and 

> For instance, say I want to do something like have a vector of the
> standard errors that I can access element-wise.  

Solution:

      .  webuse sysdsn1

      . mlogit insure age male nonwhite i.site

      . mata:

      : V = st_matrix("e(V)")

      : se = diagonal(V)

      : ... se[1] ... se[2] ...

      : end

      . _

To wit,

    1.  Think of Stata and Mata as separate things.
        For instance, you must somehow import into Mata Stata results.

    2.  All functions that are relevant for importing and exporting 
        have names that start with "st_".  

    3.  To find all the relevant funtion, 
             Type "help mata"
             Click on "[M-4] Index and Guide to Fucntions".
             Scroll down to "Stata interface".
             Click on "stata".
        Easier it just type "help m4 stata"

   4.  FYI, st_matrix() is found under the heading 
       "Accessing e(), r(), s(), macros, matrices, etc."

-- Bill
wgould@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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