Dear Statalists,
I am trying to implement difference-to-difference estimation as a regression controlling for age and sex.
My dependent variable is unemp (unemployment), there are 5 cities (Miami, Houston, LA, Atlanta and Tamap) and 19 years (1973~1991).
I want to run the regression for white only.
The story of this data-set is to see the effect of immigration influx into Miami in 1980 on unemployment using the DD model.
The effects of the influx would only be seen from 1981 onwards.
Can you check if my command and regression model (with explanation) are appropriate please?
The following is the regression model with an explanation I wrote.
Ycjt = ðūc + ðt + ÎīDct + ðcjtð― + ðcjt
c is cities, t is years, j is gender and age.
Y is unemployment
ðūc is a dummy for each city
ðt is a dummy for each year
ðcjt includes dummies for age and gender.
Dct, is regressor of interest which indicates observations for people in Miami from 1981 onwards (after the immigration inflow)
The following is my code.
keep if race=="white"
gen Treat=0
replace Treat=1 if city=="Miami"
gen Post=0
replace Post=1 if year>=1981
gen TreatPost=Treat*Post
xi: reg unemp i.city i.year TreatPost sex age, cluster(city)
dataex
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(age sex) float(unemp earnwke) int year str11 city str5 race float(random insample)
27 1 0 883.3254 1981 "Houston" "white" 7.227906e-08 1
61 1 0 290.56458 1979 "Houston" "white" 2.4188146e-06 1
29 1 0 . 1986 "Los Angeles" "white" .000014601064 1
38 2 . . 1986 "Miami" "white" .000014895406 1
21 2 0 238 1980 "Tampa" "white" .000022920925 1
49 2 0 214.2079 1982 "Los Angeles" "white" .00002692327 1
23 2 1 . 1987 "Los Angeles" "white" .000035961937 1
17 1 . . 1976 "Los Angeles" "black" .00003809956 1
27 2 0 . 1982 "Los Angeles" "white" .00004490829 1
41 1 0 576.0571 1982 "Los Angeles" "white" .00005236123 1
18 2 0 165.45595 1983 "Atlanta" "black" .0000530285 1
50 1 0 618.728 1982 "Atlanta" "white" .0000607741 1
41 2 0 402.8021 1989 "Los Angeles" "white" .00006909582 1
36 2 0 . 1978 "Los Angeles" "white" .00007106316 1
25 1 0 190.2704 1977 "Los Angeles" "white" .00008627139 1
26 2 0 63.52652 1991 "Atlanta" "white" .00009095659 1
26 1 0 168.98384 1986 "Houston" "white" .00009336475 1
44 2 . . 1984 "Los Angeles" "black" .00010226935 1
33 2 . . 1983 "Tampa" "white" .00010233635 1
42 2 . . 1982 "Los Angeles" "white" .00010478571 1
35 2 0 200 1980 "Atlanta" "white" .00012447586 1
17 2 0 78.85912 1986 "Houston" "white" .0001266327 1
21 2 0 225.3118 1986 "Los Angeles" "black" .00013704416 1
24 2 0 98.75124 1981 "Atlanta" "black" .00014404001 1
61 1 0 . 1980 "Atlanta" "white" .000146857 1
19 2 0 137.32845 1983 "Tampa" "white" .00014901793 1
54 2 0 256.0254 1982 "Los Angeles" "white" .0001507864 1
37 2 . . 1981 "Los Angeles" "white" .000173829 1
0 Response to Regression Code
Post a Comment