Announcement

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

  • diff in diff, xtreg, treatment variable, database construction

    Good morning,
    My question is very simple, but I have a strong doubt which I would like to clarify.
    I am using a panel database of only two periods to set up a diff in diff ( 2 groups in two periods), to simply let's considered that regression:

    Code:
    xtreg DependVariable TREAT##FEMALE
    The interaction with females is in because I wanna study that particular subgroup.
    My question is: what is the correct form of constructing the variable "treat" that I use to see the treatment effect:
    1. it must indicate the treated individuals (so for those that are treated assume value 1 in both periods and the difference is given from time comparison of in xtreg)
    2. It must indicate the treatment (so assume value zero for all in T0 and value 1 for treated only in T1)
    Many thanks in advance for your time and for replying at this very "beginners" question, but but a deep doubt has arisen in me.
    Wishing you all a great weekend

  • #2
    Please show your example data using dataex

    Comment


    • #3
      Chiara:
      see https://www.princeton.edu/~otorres/DID101.pdf.
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Carlo Many thanks for the useful advice: the interaction in that way is my common way to work whit simple reg.
        My issue is to deal with the command xtreg, does that strategy hold? I have only two periods so the variable which corresponds to the treatment period is exactly the same as the one which indicates the Time in my xtset. it's here that I get stuck and I started on thinking in my assumption N° 2 as above (that in my case already corresponds to the interaction term)...
        Last edited by Chiara Tasselli; 29 Apr 2022, 08:09.

        Comment


        • #5
          Chiara:
          you should have two categorical predictors for DID:
          group (0=not treated; 1=treated);
          time (before something=0; after something=1).

          I do not see timevar in your code, that seems aimed at investigating whether gender mediates treatment effect: this is perfectly legal, but, in my opinion, is somethng different from a DID.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            It seems to me that we need to understand why you are using -xtreg- instead of -regress- It would help to see an extract of your data as Jared Greathouse suggests and to know how your data is -xtset-.

            Do your fixed effects include both a panel variable (like e.g. the cluster number) as well as a time variable or only a time variable. If you have a time variable with only two values, before and after, but you have no panel variable, then you don't need to use a fixed-effects (or random-effects) model. The analysis could simply be:

            Code:
            reg depvar  i.TIME##i.TREAT if female==0 
            reg depvar  i.TIME##i.TREAT if female==1
            Then you compare the treatment effect (the estimated interaction coefficient) across genders.

            You will get similar results with a single combined model:

            Code:
            reg depvar  i.TIME##i.TREAT#i.female
            But if you have a panel variable for clusters or households or countries etc, then you can -xtset panelvar- followed by using -xtreg- like this:

            Code:
            xtset panelvar 
            xtreg depvar  i.TIME##i.TREAT if female==0 
            xtreg depvar  i.TIME##i.TREAT if female==1

            Comment


            • #7
              Many thanks to both for the useful advice, yes I think that I need to go more in deep the xtset comprehension and management, as a start I'll follow for sure your guides!
              Once again thank you a lot and wishing you a pleasant week ahead.

              Comment

              Working...
              X