Perfect, thank you Martin, that also worked. But what I don't
understand is: the second method (using mfx, eyex) gives me a
different value than the first method (storing the coefficient on x
from *regress lny lnx*). Why?
On Tue, Sep 8, 2009 at 10:07 AM, Martin Weiss<[email protected]> wrote:
>
> <>
>
> Better example:
>
>
> *************
> vers 10.1
>
> sysuse auto, clear
> reg mpg length turn
>
> mfx, eyex
>
> mat A= e(Xmfx_eyex)
> gen mymargeffect= A[1,1]
> l mymargeffect in 1/10, noo
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Martin Weiss
> Gesendet: Dienstag, 8. September 2009 16:03
> An: [email protected]
> Betreff: st: AW: Creating a variable taking the value of elasticity
>
>
> <>
>
> To capture the marginal effect in a variable,
>
>
> *************
> vers 10.1
>
> sysuse auto, clear
> reg mpg length turn
>
> mfx
>
> mat A= e(Xmfx_dydx)
> gen mymargeffect= A[1,1]
> l mymargeffect in 1/10, noo
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Dorothy Bridges
> Gesendet: Dienstag, 8. September 2009 15:55
> An: [email protected]
> 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/