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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

Subject |
AW: st: AW: Creating a variable taking the value of elasticity |

Date |
Tue, 8 Sep 2009 16:15:47 +0200 |

<> " Why is storage in a variable not recommended? " Generally, a constant value of whatever nature will take up an entire column in Stata, although each row carries the same -redundant- information. So you would be better off storing this thing in a -local- or using the solutions proposed in my earlier post. On -postfile- which is often neglected, you may want to consult http://www.stata-journal.com/article.html?article=pr0036 HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dorothy Bridges Gesendet: Dienstag, 8. September 2009 16:06 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: AW: Creating a variable taking the value of elasticity Perfect, thank you! That worked. Why is storage in a variable not recommended? I am doing this so that I can make a histogram comparing the elasticities (coefficients) from a dozen different regressions. On Tue, Sep 8, 2009 at 9:58 AM, Martin Weiss<martin.weiss1@gmx.de> wrote: > > <> > > Here is an example, although storage in a variable is not exactly > recommended. Note the last line which shows you how to get the correct name > for the coefficient... > > > ************* > sysuse auto, clear > > gen logmpg=ln(mpg) > gen loglength=log(len) > gen logturn=log(turn) > > reg logmpg loglength logturn > *store in variable > gen mycoeff=_b[loglength] > > l mycoeff in 1/10, noo > > reg, coeflegend > ************* > > > > HTH > Martin > > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dorothy Bridges > Gesendet: Dienstag, 8. September 2009 15:55 > An: statalist@hsphsun2.harvard.edu > Betreff: st: Creating a variable taking the value of elasticity > > Dear Statalist, > > I have a simple dataset containing two variables, x and y. I regress > ln(y) on ln(x) and observe the coefficient on x as elasticity. I then > want to create a variable taking the value of this coefficient. How > would I do this? Something like local elas=e(b); gen elas=`elas', > except e(b) contains all the coefficients, and I just want one. > > A related question: when I regress y on x and then input "mfx, eyex," > the ey/ex value is not the same as the coefficient I obtain using > regress ln(y) ln(x). Why? Also: how would I extract the ey/ex value > from the mfx output in order to create a variable taking that value? > > Thank you, > Dorothy > > * > * 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/ > * * 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: AW: Creating a variable taking the value of elasticity***From:*"Newson, Roger B" <r.newson@imperial.ac.uk>

**References**:**st: Creating a variable taking the value of elasticity***From:*Dorothy Bridges <dbstata@gmail.com>

**Re: st: AW: Creating a variable taking the value of elasticity***From:*Dorothy Bridges <dbstata@gmail.com>

- Prev by Date:
**AW: st: AW: Creating a variable taking the value of elasticity** - Next by Date:
**Re: st: AW: AW: Creating a variable taking the value of elasticity** - Previous by thread:
**AW: st: AW: Creating a variable taking the value of elasticity** - Next by thread:
**RE: st: AW: Creating a variable taking the value of elasticity** - Index(es):

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