Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Eric Booth <ebooth@ppri.tamu.edu> |

To |
"<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Extracting specific elements from a matrix |

Date |
Mon, 5 Jul 2010 21:41:33 +0000 |

<> Or you can use -svmat- to get them all at once. e.g., ******************************! clear webuse auto ds price make, not regress price `r(varlist)' , nocons mat A = get(_b) matrix li A ***** preserve clear svmat A, names(beta_) g id = _n reshape long beta_, i(id) j(beta_num) drop id save betas.dta, replace restore ***** use betas.dta, clear ******************************! ~ Eric __ Eric A. Booth Public Policy Research Institute Texas A&M University ebooth@ppri.tamu.edu Office: +979.845.6754 On Jul 5, 2010, at 3:36 PM, Dani Tilley wrote: > Hi, > > I need to extract the first element of a matrix of coefficients and store it on a variable, and repeat the process i times. I can set up the for loop and do the storing, but I don't know how to access element [i,j] of a matrix A. > > In particular, my matrix is e(b), the vector of coefficients from a regression with k explanatory variables. I tried -e(b)[1,1]- but that didn't take me far. > > Any help is appreciated. > > Thanks, > DF Tilley > > > > > * > * 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/

**Follow-Ups**:**RE: st: Extracting specific elements from a matrix***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: Extracting specific elements from a matrix***From:*Dani Tilley <tilleydani@yahoo.com>

- Prev by Date:
**st: Re: Extracting specific elements from a matrix** - Next by Date:
**RE: st: Extracting specific elements from a matrix** - Previous by thread:
**st: RE: Extracting specific elements from a matrix** - Next by thread:
**RE: st: Extracting specific elements from a matrix** - Index(es):