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

Re: st: Taking mata views of ereturn stats?

From (William Gould, StataCorp LP)
Subject   Re: st: Taking mata views of ereturn stats?
Date   Fri, 18 Dec 2009 11:38:33 -0600

Skipper Seabold <> 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?


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


      .  webuse sysdsn1

      . mlogit insure age male nonwhite

      . 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
*   For searches and help try:

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