Hi statalist,
I’m running a difference in difference model with time fixed effects. My sample includes women who were observed two or three times out of the three waves of my data. I have three survey waves (2006, 2012, 2018) and a treatment that occurs at different times (either 2006 or 2012). The treatment is whether or not a specific woman has given birth to a male child.
I created a dummy variable for when the treatment started – so that the year 2006 takes a value of 0 and 2012/2018 take value of 1. I created a second dummy variable for my treatment. Any women who has given birth between 2006-2012 or 2012-2018 is coded as 1, all other women who have not given birth to a son are coded 0. I then generated my difference-in-difference estimator and ran my regression
The treatment variable is omitted due collinearity- which I don’t think should happen.
Because I have more than one-time period, do I just add year dummies and interact that with my treatment variable without indicating whether the different years belong to the pre/post period?
Different women might have experienced the treatment at different times. I realise this question has been asked a few times, but I haven’t been able apply them to my specific dataset.
I’m running a difference in difference model with time fixed effects. My sample includes women who were observed two or three times out of the three waves of my data. I have three survey waves (2006, 2012, 2018) and a treatment that occurs at different times (either 2006 or 2012). The treatment is whether or not a specific woman has given birth to a male child.
I created a dummy variable for when the treatment started – so that the year 2006 takes a value of 0 and 2012/2018 take value of 1. I created a second dummy variable for my treatment. Any women who has given birth between 2006-2012 or 2012-2018 is coded as 1, all other women who have not given birth to a son are coded 0. I then generated my difference-in-difference estimator and ran my regression
Code:
gen year=round recode year 6=0 12=1 18=1 gen did = year*sonbirth xtreg C1 i.year i.sonbirth i.did [pweight= panel_wt_06_12_18] , fe
Because I have more than one-time period, do I just add year dummies and interact that with my treatment variable without indicating whether the different years belong to the pre/post period?
Different women might have experienced the treatment at different times. I realise this question has been asked a few times, but I haven’t been able apply them to my specific dataset.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double Findid byte round float year str3 sonCH float(sonbirth did) 601004603 6 0 ".10" 0 0 601004603 12 1 ".10" 0 0 601004603 18 1 ".10" 0 0 601005902 6 0 "000" 0 0 601005902 12 1 "000" 0 0 601005902 18 1 "000" 0 0 601019206 6 0 ".10" 0 0 601019206 12 1 ".10" 0 0 601019206 18 1 ".10" 0 0 601025702 6 0 "00." 0 0 601025702 12 1 "00." 0 0 601025702 18 1 "00." 0 0 601032309 6 0 ".10" 0 0 601032309 12 1 ".10" 0 0 601032309 18 1 ".10" 0 0 601033103 6 0 ".00" 0 0 601033103 12 1 ".00" 0 0 601033103 18 1 ".00" 0 0 601036602 6 0 "00." 0 0 601036602 12 1 "00." 0 0 601036602 18 1 "00." 0 0 601037505 6 0 ".10" 0 0 601037505 12 1 ".10" 0 0 601037505 18 1 ".10" 0 0 601051404 6 0 ".10" 0 0 601051404 12 1 ".10" 0 0 601051404 18 1 ".10" 0 0 601054402 6 0 "010" 1 0 601054402 12 1 "010" 1 1 601054402 18 1 "010" 1 1 601056302 6 0 "110" 1 0 601056302 12 1 "110" 1 1 601056302 18 1 "110" 1 1 601058302 6 0 "010" 1 0 601058302 12 1 "010" 1 1 601058302 18 1 "010" 1 1 601058602 6 0 "000" 0 0 601058602 12 1 "000" 0 0 601058602 18 1 "000" 0 0 601059402 6 0 "11." 1 0 601059402 12 1 "11." 1 1 601059402 18 1 "11." 1 1 601060002 6 0 "111" 1 0 601060002 12 1 "111" 1 1 601060002 18 1 "111" 1 1 601060202 6 0 "010" 1 0 601060202 12 1 "010" 1 1 601060202 18 1 "010" 1 1 601060302 6 0 "000" 0 0 601060302 12 1 "000" 0 0 601060302 18 1 "000" 0 0 601061802 6 0 "010" 1 0 601061802 12 1 "010" 1 1 601061802 18 1 "010" 1 1 601062002 6 0 "000" 0 0 601062002 12 1 "000" 0 0 601062002 18 1 "000" 0 0 601062602 6 0 "010" 1 0 601062602 12 1 "010" 1 1 601062602 18 1 "010" 1 1 601063102 6 0 "110" 1 0 601063102 12 1 "110" 1 1 601063102 18 1 "110" 1 1 601067002 6 0 "11." 1 0 601067002 12 1 "11." 1 1 601067002 18 1 "11." 1 1 601070802 6 0 "110" 1 0 601070802 12 1 "110" 1 1 601070802 18 1 "110" 1 1 601071602 6 0 "110" 1 0 601071602 12 1 "110" 1 1 601071602 18 1 "110" 1 1 601071702 6 0 "110" 1 0 601071702 12 1 "110" 1 1 601071702 18 1 "110" 1 1 601071902 6 0 "11." 1 0 601071902 12 1 "11." 1 1 601071902 18 1 "11." 1 1 601072002 6 0 "010" 1 0 601072002 12 1 "010" 1 1 601072002 18 1 "010" 1 1 601072702 6 0 "000" 0 0 601072702 12 1 "000" 0 0 601072702 18 1 "000" 0 0 601072902 6 0 "010" 1 0 601072902 12 1 "010" 1 1 601072902 18 1 "010" 1 1 601073102 6 0 "11." 1 0 601073102 12 1 "11." 1 1 601073102 18 1 "11." 1 1 601073402 6 0 "110" 1 0 601073402 12 1 "110" 1 1 601073402 18 1 "110" 1 1 601074502 6 0 "000" 0 0 601074502 12 1 "000" 0 0 601074502 18 1 "000" 0 0 601075502 6 0 "110" 1 0 601075502 12 1 "110" 1 1 601075502 18 1 "110" 1 1 601075902 6 0 "110" 1 0 end label values round yr label def yr 6 "2006", modify label def yr 12 "2012", modify label def yr 18 "2018", modify
Comment