Announcement

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

  • ib# not giving the right reference

    Dear all,
    I am having a difficulty with the reference value in this regression (it is a DID regression, where Bpopulation is a continuous variable and child_year_birth takes the years from 2008 to 2018, provinceOfBirthFE are dummy vars for provinces and yearOfBirthFE are dummy vars for years):

    Code:
    reg birth_weight_kg c.Bpopulation#ib2012.child_year_birth  `provinceOfBirthFE' `yearOfBirthFE' ,  cluster(prov_birth_child_code)
    margins ib2012.child_year_birth, dydx(Bpopulation) noestimcheck post
    marginsplot, yline(0) level(95)
    (this is for testing PTA)
    Even though I want 2012 to be the ref, Stata is forcing the last year to be the ref. I wonder why is that (dropping dummy vars for years does not solve the problem).
    I appreciate your help.

  • #2
    You are abusing factor variable notation by specifying an interaction without the main effects. To have it your way, you will have to specify the interaction with no base level and exclude the declared "base" using the omission operator.

    Code:
    help fvvarlist

    Comment


    • #3
      Andrew Musau Thank you for your answer.

      I tried this,and it did not work
      Code:
      reg birth_weight_kg c.Bpopulation#o2012.child_year_birth `provinceOfBirthFE' `yearOfBirthFE' , cluster(prov_birth_child_code) 
       margins child_year_birth, dydx(Bpopulation) noestimcheck post marginsplot, yline(0) level(95)
      And can you please explain what do you mean by
      You are abusing factor variable notation by specifying an interaction without the main effects.
      Thank you.

      Comment


      • #4
        Originally posted by Marry Lee View Post
        Andrew Musau
        And can you please explain what do you mean by

        You are abusing factor variable notation by specifying an interaction without the main effects.
        Think of it in this way. You are multiplying a continuous variable with indicators of a categorical variable. The resulting variables are 0/continuous. There is no notion of a base absent the indicators of the main categorical variable. Therefore, specifying "c.var#ib.catvar" in the absence of "ib.catvar" in the equation is abuse of factor variable notation.

        I tried this,and it did not work
        You want:


        Code:
        reg birth_weight_kg  c.Bpopulation#ibn.child_year_birth o.Bpopulation#o2012.child_year_birth `provinceOfBirthFE' `yearOfBirthFE' , cluster(prov_birth_child_code)

        Comment


        • #5
          Andrew Musau Thank you! what you suggested works perfectly!

          Comment

          Working...
          X