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 |
Vũ Võ <hoangvu@ueh.edu.vn> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: How to store marginal effect value after using margin command? |

Date |
Sat, 8 Jun 2013 22:50:16 +0200 |

Hi everyone, I am writing a code in do file to calculate the marginal effect of x on y (log-linear model) The function form as following: Ln(Y) = a0 + a1*X + a2*X^2 + e ----> Y = exp(a0 + a1*X + a2*X^2) So, dY/dX = (a1 + 2*a2*X)*exp(a0 + a1*X + a2*X^2) eq(1) If I run the regression by command line as: reg lnY x c.x#c.x after that using margins command: margins, dydx(x). I will obtain the marginal effect of x on Ln(Y): (a1 + 2*a2*X). How can I calculate the dY/dX as in eq(1) by using the do file, not calculating manually? 2. Second question is: If I use command margins, predict(p) and obtain the results as following: Marginal effects after hetprob y = Pr(y) (predict, p) = .54284206 ------------------------------------------------------------------------------ variable | dy/dx Std. Err. z p>|z| [ 95% C.I. ] X ---------+-------------------------------------------------------------------- x | .3704576 .03237 11.44 0.000 .307015 .4339 .020114 xhet | -.0736092 .02423 -3.04 0.002 -.121095 -.026124 .502716 off1 | (offset1) 1.00516 off2 | (offset2) 1.09709 ------------------------------------------------------------------------------ The question is how to store the marginal effects value, say in this case is 0.3704576, in the scalar in stata? Thank you so much. Vo Duc Hoang Vu * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: How to store marginal effect value after using margin command?***From:*Sergiy Radyakin <serjradyakin@gmail.com>

- Prev by Date:
**st: need help to perform SEM for observed continuous and categorical data** - Next by Date:
**Re: st: Interpretation of interaction term in log linear (non linear) model** - Previous by thread:
**st: need help to perform SEM for observed continuous and categorical data** - Next by thread:
**Re: st: How to store marginal effect value after using margin command?** - Index(es):