0
$\begingroup$

Suppose the regression is y=beta_0+beta_1*x + epsilon. I obtain the eydx=.295 by magins eydx(x) command.

What does Stata really do? Does Stata actually regress logy on x? If so, can I interpret the result as one unit increase in x leads to 0.295 unit increase in y?

Stata manual suggests "proportional change in y for a change in x". Then should I interpret the result as "there is 0.295 unit proportional change in y for a change in x"?

I also notice that eydx is semi-elasticity. So should I interpret this result as " 1 unit increase in x leads to 29.5% in y" or maybe " 0.295% increase in y"?

Are the three interpretation equivalent?

Another issue is if I regress y on x and obtain eyex=a, is it equivalent to regress y on lgx and obtain eydx=b? In other words, does a equal b?

$\endgroup$
1
$\begingroup$

Your model is effectively $$E[y \vert x,w]=\hat y =\hat \alpha+\hat \beta \cdot x + \hat \gamma \cdot w.$$ With the eydx() option, margins calculates the average of $$\frac{\partial \hat y}{\partial x}\cdot\frac{1}{\hat y}= \frac{\hat \beta}{\hat y} \approx \frac{\frac{\Delta \hat y}{y}}{\Delta x}$$ in the estimation sample. This means the OLS coefficient is rescaled by the predicted value of the outcome and then averaged.

This is a kind of semi-elasticity, and can be interpreted as the percentage/proportionate change in the expected value of $y$ for a one unit change in $x$.

This is not exactly equivalent to running the logged outcome regression, though it will often yield fairly similar estimates. margins is a post-estimation command that relies on previous estimates and performs none of its own.

Similarly, eyex() calculates the average of $$\frac{\partial \hat y}{\partial x}\cdot \frac{x}{\hat y}= \hat \beta \cdot \frac{x}{\hat y} \approx \frac{\frac{\Delta \hat y}{\hat y}}{\frac{\Delta x}{x}},$$

which is percent change in $y$ for a percent change in $x$, the full elasticity.

Here's Stata code showing these claims:

. sysuse auto, clear
(1978 Automobile Data)

. reg price mpg weight

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(2, 71)        =     14.74
       Model |   186321280         2  93160639.9   Prob > F        =    0.0000
    Residual |   448744116        71  6320339.67   R-squared       =    0.2934
-------------+----------------------------------   Adj R-squared   =    0.2735
       Total |   635065396        73  8699525.97   Root MSE        =      2514

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -49.51222   86.15604    -0.57   0.567    -221.3025     122.278
      weight |   1.746559   .6413538     2.72   0.008      .467736    3.025382
       _cons |   1946.069    3597.05     0.54   0.590    -5226.245    9118.382
------------------------------------------------------------------------------

. margins, eydx(mpg)

Average marginal effects                        Number of obs     =         74
Model VCE    : OLS

Expression   : Linear prediction, predict()
ey/dx w.r.t. : mpg

------------------------------------------------------------------------------
             |            Delta-method
             |      ey/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0086381   .0151161    -0.57   0.569    -.0387787    .0215024
------------------------------------------------------------------------------

. margins, eyex(mpg)

Average marginal effects                        Number of obs     =         74
Model VCE    : OLS

Expression   : Linear prediction, predict()
ey/ex w.r.t. : mpg

------------------------------------------------------------------------------
             |            Delta-method
             |      ey/ex   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |   -.196516   .3468786    -0.57   0.573    -.8881724    .4951403
------------------------------------------------------------------------------

. 
. predict double yhat
(option xb assumed; fitted values)

. gen double se = _b[mpg]*1/yhat

. gen double e = _b[mpg]*mpg/yhat

. sum se e

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
          se |         74   -.0086381    .0024589  -.0145348  -.0050496
           e |         74    -.196516    .1110846  -.5834932  -.0605946

. 
. gen ln_p = ln(price)

. reg ln_p mpg weight

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(2, 71)        =     15.26
       Model |  3.37488699         2  1.68744349   Prob > F        =    0.0000
    Residual |  7.84864609        71  .110544311   R-squared       =    0.3007
-------------+----------------------------------   Adj R-squared   =    0.2810
       Total |  11.2235331        73  .153747029   Root MSE        =    .33248

------------------------------------------------------------------------------
        ln_p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0106498   .0113942    -0.93   0.353    -.0333692    .0120696
      weight |   .0002087   .0000848     2.46   0.016     .0000396    .0003778
       _cons |   8.237352   .4757123    17.32   0.000     7.288809    9.185896
------------------------------------------------------------------------------

The margins semi-elasticity is a 0.86% decrease in price for an additional mile per gallon, holding weight constant (I find it helpful to multiply $\frac{\Delta \hat y}{\hat y} = 0.0086$ by 100 here). The logged outcome model's semi-elasticity is a 1% decrease.

The elasticity is 19.65% reduction in price for a 1% increase in mpg. If you fit the log-log model, the difference between the margins approach will be starker than in the semi-elasticity case.

$\endgroup$
0
$\begingroup$

I got an answer from statalist.

Here is the answer by Clyde Schechter.

What does Stata really do? Does Stata actually regress logy on x?

I have not delved into the code of -margins- so I cannot be 100% certain, but it would be very surprising if Stata went to all that trouble. I imagine -margins- relies on the fact that d(log y)/dx = (1/y)*dydx and calculates the right hand side of that equation.

If so, can I interpret the result as one unit increase in x leads to 0.295 unit increase in y?

No. First of all, "leads to" is causal language, so the appropriateness of that depends on your study design. But in general one should not use causal language in these situations. Putting issues of causal/non causal aside, because it is eydx, it means that a unit increase in x is associated with a 0.295 increase in log y. In turn, increasing log y by 0.295 corresponds to multiplying y by exp(0.295), which is approximately 1.34. So a unit increase in x is associated with a 34.3% relative increase in y.

I also notice that eydx is semi-elasticity. So should I interpret this result as " 1 unit increase in x leads to 29.5% in y" or maybe " 0.295% increase in y"?

This is the general idea, but as I showed in the preceding paragraph, the actual percent increase is 34.3, not 29.5 When the number is small, the two will be very close. So if you had eydx = 0.10, exp(0.10_ = 1.105, so that there would be a 10.5% increase. For values up to about 0.10, the elasticity and the corresponding percentage increase are nearly identical. But as the elasticity gets larger, they start to diverge.

Another issue is if I regress y on x and obtain eyex=a, is it equivalent to regress y on lgx and obtain eydx=b? In other words, does a equal b?

No. To the extent that something like this would be true it would be "sort of" equivalent to regress log y on log x and expect that to approximate eyex calculated after regressing y on x. But the values will only be approximately equal because the modeling of error in the two regressions is different, and because at least one of the models y = b0 + b1*x and log y = c0 + c1* x must be a mis-specification of the x-y relationship. In particular, if the linear model y = b0 + b1*x + epsilon is correct, then the relationship between log y and log x is not linear and the elasticity ey/ex actually varies with the value of x. When you use -margins- to get ey/ex, if you do not specify the value of x that you want to get the elasticity at (using the -at()- option), then -margins- gives you an averaged value.

$\endgroup$
  • $\begingroup$ It is considered polite to let people know that you have cross-posted a question. On Statalist, this is a requirement. This keeps resources from being misallocated. Please do that in the future! $\endgroup$ – Dimitriy V. Masterov Nov 1 '16 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.