Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: extract part of matrix e(b)


From   Joerg Luedicke <[email protected]>
To   [email protected]
Subject   Re: st: extract part of matrix e(b)
Date   Fri, 22 Jul 2011 12:32:27 -0400

You could grab it from the matrix by addressing row and column
numbers, for example:

scalar second=b[1,2]
scalar third=b[1,3]

J.


On Fri, Jul 22, 2011 at 12:03 PM, Mirko <[email protected]> wrote:
> Dear Statalisters,
>
> I wish to extract only some coefficients from the matrix e(b) and I
> wonder how this can be achieved.
>
> Here is a simple example.
>
> . regress mpg foreign i.rep78##c.weight headroom
> (output omitted)
>
> . margins, dydx(rep78)
> (output omitted)
>
> . mat b =e(b)
>
> This command extracts and saves the entire coefficients matrix e(b) as b.
>
> If you type:
>
> . mat li b
>
> you get:
>
> b[1,5]
>            1b.          2.          3.          4.          5.
>         rep78       rep78       rep78       rep78       rep78
> y1           0   .25956254  -.74363551  -.38630819  -6.5437415
>
>
> What should I do if I wish to grab only the second and third
> coefficients:  .25956254,  -.74363551 instead the all matrix?
>
> How this can be done?
>
> Mirko
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index