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

Re: st: ereturn question [Stata 8]

From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: ereturn question [Stata 8]
Date   Tue, 03 May 2005 18:17:37 -0500

Bryan W. Griffin <[email protected]> asks about getting access to
a element of a matrix in the e() results:

> Running Stata 8.2
> I am running a model in gllamm, and I want to access and save results from 
> one of the matrices. When I type
> matrix list e(nu)
> I get this result:
> e(nu)[1,2]
>          c1      c2
> r1   5550   1850
> I would like to be able to display and save one value at a time, such as
> di "what here?"
> to get 5550. With regression coefficients one can type "di _b[IV]" to 
> obtain a particular value. How do I issue the di command to get only r1,c1 
> instead of both values?

Both Richard Williams <[email protected]> and Nick Cox
<[email protected]> suggest the following:

> mat nu = e(nu)
> di nu[1,1]

But they also ask if this is possible without defining a new matrix.  The
answer is yes, use the -el()- matrix function:

	. di el(e(nu),1,1)

Note that this is allowed with any matrix in e() except for e(b) and e(V);
these two exceptions are special matrices that the el() function does not have
access to, but you can use [eqname]_b[indepvarname] system variable for the
elements of e(b) (and similarly use _se for the standard errors which are the
square roots fo the diagonal elements of e(V)).

[email protected]
*   For searches and help try:

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