Announcement

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

  • Using margins with a double DiD continuous estimator

    I'm using individual cross-sectional survey data to estimate the impact of a continuous variable ("intervention") on a binary employment outcome variable ("employed"). I'm comparing between two years ("year", 2020 and 2021) and two sets of months ("half", where Jan-Jun=1 and Jul-Dec=2).

    I'd like to calculate the marginal effect and CIs of just the double DiD term for values of intervention between 1 and 100: 2021.year#2.half.#c.intervention

    The below code I tried is close but not right. It generates the marginal effect at all levels of year and half for each intervention value. I want the double difference between year = 2021 and year = 2020 as well as half = 2 and half = 1.

    Code:
    logit employed i.year##i.half##c.intervention
    margins year#half, at(intervention=(1(1)100))

  • #2
    To clarify further here, what I'd essentially like is the marginal effect (and CIs) across the values 1-100of intervention for (2021.year#2.half - 2021.year#1.half) - (2020.year#2.half - 2020.year#1.half)

    Comment


    • #3
      You may need Puhani's formula to compute the marginal effect. Here is a recent post regarding the issue.

      For your case, it would be something like

      Code:
      gen year_half = (year == 2021) * (half == 2)
      logit employed i.(year half)##c.intervention i.year_half i.year_half#c.intervention
      margins, dydx(year_half) at(year = 2021 half = 2 intervention=(1(1)100)) subpop(if year == 2021 & half == 2) vce(unconditional)

      Comment


      • #4
        Originally posted by Fei Wang View Post
        You may need Puhani's formula to compute the marginal effect. Here is a recent post regarding the issue.

        For your case, it would be something like

        Code:
        gen year_half = (year == 2021) * (half == 2)
        logit employed i.(year half)##c.intervention i.year_half i.year_half#c.intervention
        margins, dydx(year_half) at(year = 2021 half = 2 intervention=(1(1)100)) subpop(if year == 2021 & half == 2) vce(unconditional)
        Thank you for the response! This makes sense and looks promising.

        Comment

        Working...
        X