Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Margins in STATA 12 - how to use at () for dichotomous variables?


From   Neeraj Iyer <iyeranna@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Margins in STATA 12 - how to use at () for dichotomous variables?
Date   Wed, 19 Dec 2012 12:08:22 -0500

Thank you Mr. Luedicke.  I ran the codes that you sent.  Here is my
understanding of the output:

1) When gender is held at value=1, the marginal effect of x1 is for
either all men or all women.
2) When gender is held at its mean, the marginal effect of x1 is
controlling for gender based on the proportion of those coded as '1'.
3) When gender is averaged over men and women, the marginal effect of
x1 is the arithmetic mean of the marginal effect of men and that of
women.

I reckon from a substantive standpoint, 1) or 3) are more informative
than 2).  If I were interested in the marginal effect of x1 at 10 year
intervals of age, would it then be prudent to use 3)?

Thank you,

Regards,
Neeraj

On Fri, Dec 14, 2012 at 11:05 AM, Joerg Luedicke
<joerg.luedicke@gmail.com> wrote:
>
> clear
> set obs `=1e4'
> set seed 1234
> gen x1 = rnormal()
> gen gender = runiform()>.5
>
> //Count component
> gen xb = 2 + 0.5*x1 - 0.5*gender
> gen a = .5
> gen ia = 1/a
> gen exb = exp(xb)
> gen xg = rgamma(ia, a)
> gen xbg = exb * xg
> gen nby = rpoisson(xbg)
>
> //Binary component
> gen pi =1/(1+exp(-(0.5*x1 + 0.5*gender + 0.2)))
> gen bernoulli = runiform()>pi
> gen zy = bernoulli*nby
> rename zy y
>
> //Model fit
> zinb y x1 gender, inflate(x1 gender)
>
> //OP's -margins- statements
> margins, dydx(x1) at(gender=1)
> margins, dydx(x1) at((mean) gender)
>
> //Now consider the following which is similar to your second statement:
> sum gender
> margins, dydx(x1) at(gender=.4983)
>
> //And compare it to the following, where the marginal effects are
> averaged over men and women:
> margins, dydx(x1)




--
Neeraj
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index