Re: st: margins and interactions

 From jpitblado@stata.com (Jeff Pitblado, StataCorp LP) To statalist@hsphsun2.harvard.edu Subject Re: st: margins and interactions Date Tue, 01 Sep 2009 16:51:07 -0500

```Ed Levitas <levitas@uwm.edu> had a follow-up question about -margins-:

> Thanks for the response. So technically I can get the elasticity of the
> "main" iv2 effect but not the effect decomposed into iv2-squared and
> iv2-residual?

Yes.

-margins- produces marginal effects and elasticities for individual variables
in the dataset that were used as independent variables in the model fit.

Here is the break-down for what the marginal effects and elasticities options
mean in the -margins- command:

option		definition		simplification
---------------------------------------------------------------------
dydx()		     dy/dx
eyex()		d ln(y)/d ln(x)		dy/dx * (x/y)
eydx()		d ln(y)/dx		dy/dx * (1/y)
dyex()		     dy/d ln(x)		dy/dx * (x)

where 'y' denotes the user specified prediction, and 'x' is an indepvar.  By
'indepvar' I mean a single variable in the Stata dataset used to fit the
model.

As mentioned in the 'Expression derivatives as elasticities' subsection in the
'Remarks' section of '[R] margins',

eyex() is the proportional change in y for a proportional change in x

If 'x' appears in the model multiple times, as in Ed's orignal example

. xtreg dv iv1 c.iv2##c.iv2

which is a shortcut for

. xtreg dv iv1 iv2 c.iv2#c.iv2

then

. margins, eyex(iv2)

will compute the average of the proportional changes in the linear prediction
for proportional changes in 'iv2'.

-margins- is aware that 'iv2' is present in both linear and squared terms in
this model and computes the derivatives with respect to the variable 'iv2'.

--Jeff