Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about margins for sub-populations

    Hi,

    I would like to check the marginal effects for two different time periods, and whether there is a significant difference between the two time periods.

    I checked the STATA help and they mention the following:

    Do not specify marginlist when you mean over() margins has the same syntax when used with derivatives of responses as when used with responses. To obtain derivatives, one specifies the dydx() option. If we wanted to examine the response variable dy/d(tmt), we would specify margins’ dydx(tmt) option. The rest of the margins command has the same syntax as ordinarily, although one tends to specify different syntactical elements. For instance, one usually does not specify a marginlist. If we typed . margins sex, dydx(tmt) we would obtain dy/d(tmt) calculated first as if everyone were male and then as if everyone were female. At the least, we would probably want to specify . margins sex, dydx(tmt) grand so as also to obtain dy/d(tmt), the overall margin, the margin with everyone having their own value of sex. Usually, however, all we want is the overall margin, and because grand is the default when the marginlist is not specified, we would just type . margins, dydx(tmt) Alternatively, if we were interested in the decomposition by sex, then rather than type margins sex, dydx(tmt), we probably want to type . margins, over(sex) dydx(tmt) This command gives us the average effect of tmt for males and again for females rather than the average effect with everyone treated as male and then again with everyone treated as female.

    What do you suggest? Using a command like

    Code:
    margins period, dydx(*) atmeans
    or this one?

    Code:
    margins, dydx(*) over(period)
    Thank you in advance.

    Kind regards,

    Nikos

  • #2
    1
    Last edited by Tim Umbach; 19 Jul 2017, 14:40.

    Comment


    • #3
      Thank you. Do you mean the first option?

      Comment


      • #4
        Sorry, I don't know what happend there. Actually I think margins pwcompare is what you want,
        See the manual: http://www.stata.com/manuals13/rmarg...gins,pwcompare

        Comment


        • #5
          Thank you Tim. So, do you propose something like the following?

          Code:
           margins period, dydx(*) atmeans pwcompare

          Comment


          • #6
            Originally posted by Nikos Korompos View Post
            Thank you Tim. So, do you propose something like the following?

            Code:
            margins period, dydx(*) atmeans pwcompare
            Pretty much, although I think the dydx(*) atmeans options are unnecessary and/or outdated. I think you want:
            Code:
            margins period, pwcompare
            Note however that this compare ALL periods with each other, since you have a large T this might not be optimal. If you just want to compare specific years, try:
            Code:
            margins, at(period=(1950 1954)) pwcompare
            Hope that helped,
            Tim
            Last edited by Tim Umbach; 21 Jul 2017, 11:40.

            Comment


            • #7
              Thank you Tim. Really grateful for your advice.

              Comment

              Working...
              X