I am using a sample of this dataset from an experiment (https://www.aeaweb.org/articles?id=1...aer.102.7.3317). The -dataex- of my subset is at the end of this post. Basically, subjects are assigned to groups, and groups are assigned to either treatment or control. The variable "y" is some response variable that subjects choose over time.
Pooling the data and running a random-effects regression aimed at finding the average treatment effect results in:
Code:
. xtreg y round i.treatment i.group_id, re baselevels note: 305.group_id omitted because of collinearity Random-effects GLS regression Number of obs = 150 Group variable: subject Number of groups = 30 R-sq: Obs per group: within = 0.0270 min = 5 between = 0.7425 avg = 5.0 overall = 0.5514 max = 5 Wald chi2(10) = 60.96 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- round | -.6 .3301812 -1.82 0.069 -1.247143 .0471432 | treatment | 0 | 0 (base) 1 | -6.666667 4.341019 -1.54 0.125 -15.17491 1.841574 | group_id | 101 | 0 (base) 102 | 9.333333 4.341019 2.15 0.032 .8250928 17.84157 103 | -6.666667 4.341019 -1.54 0.125 -15.17491 1.841574 104 | 10.66667 4.341019 2.46 0.014 2.158426 19.17491 105 | -2.666667 4.341019 -0.61 0.539 -11.17491 5.841574 301 | 6.666667 4.341019 1.54 0.125 -1.841574 15.17491 302 | -12 4.341019 -2.76 0.006 -20.50824 -3.491759 303 | -8 4.341019 -1.84 0.065 -16.50824 .5082406 304 | 6.666667 4.341019 1.54 0.125 -1.841574 15.17491 305 | 0 (omitted) | _cons | 15.13333 3.22543 4.69 0.000 8.811607 21.45506 -------------+---------------------------------------------------------------- sigma_u | 4.6610611 sigma_e | 5.7189057 rho | .39913545 (fraction of variance due to u_i) ------------------------------------------------------------------------------
Now, I change which group is the base level, I will see different values for the treatment variable, some positive, some negative, some significant, some not:
Code:
. qui levelsof group, local(groups) . foreach group in `groups' { 2. qui xtreg y round i.treatment ib(`group').group_id, re 3. di "estimated coefficient = " _b[1.treatment] 4. } estimated coefficient = -6.6666667 estimated coefficient = 2.6666667 estimated coefficient = -13.333333 estimated coefficient = 4 estimated coefficient = -9.3333333 estimated coefficient = -16 estimated coefficient = 2.6666667 estimated coefficient = -1.3333333 estimated coefficient = -16 estimated coefficient = -9.3333333
Code:
. tabstat y, by(group_id) stats(mean sd) nototal Summary for variables: y by categories of: group_id group_id | mean sd ---------+-------------------- 101 | 6.666667 9.759001 102 | 16 8.280787 103 | 0 0 104 | 17.33333 7.037316 105 | 4 8.280787 301 | 20 0 302 | 1.333333 5.163978 303 | 5.333333 9.154754 304 | 20 0 305 | 13.33333 9.759001 ------------------------------
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte treatment int group_id float subject byte(round y) 1 101 1101 1 20 1 101 1101 2 0 1 101 1101 3 20 1 101 1101 4 0 1 101 1101 5 0 1 102 1102 1 0 1 102 1102 2 20 1 102 1102 3 20 1 102 1102 4 20 1 102 1102 5 20 1 103 1103 1 0 1 103 1103 2 0 1 103 1103 3 0 1 103 1103 4 0 1 103 1103 5 0 1 104 1104 1 20 1 104 1104 2 20 1 104 1104 3 20 1 104 1104 4 20 1 104 1104 5 20 1 105 1105 1 0 1 105 1105 2 0 1 105 1105 3 0 1 105 1105 4 0 1 105 1105 5 0 0 301 1301 1 20 0 301 1301 2 20 0 301 1301 3 20 0 301 1301 4 20 0 301 1301 5 20 0 302 1302 1 0 0 302 1302 2 20 0 302 1302 3 0 0 302 1302 4 0 0 302 1302 5 0 0 303 1303 1 0 0 303 1303 2 0 0 303 1303 3 0 0 303 1303 4 0 0 303 1303 5 0 0 304 1304 1 20 0 304 1304 2 20 0 304 1304 3 20 0 304 1304 4 20 0 304 1304 5 20 0 305 1305 1 20 0 305 1305 2 20 0 305 1305 3 20 0 305 1305 4 20 0 305 1305 5 20 1 101 2101 1 20 1 101 2101 2 0 1 101 2101 3 20 1 101 2101 4 20 1 101 2101 5 0 1 102 2102 1 20 1 102 2102 2 20 1 102 2102 3 20 1 102 2102 4 20 1 102 2102 5 20 1 103 2103 1 0 1 103 2103 2 0 1 103 2103 3 0 1 103 2103 4 0 1 103 2103 5 0 1 104 2104 1 0 1 104 2104 2 0 1 104 2104 3 20 1 104 2104 4 20 1 104 2104 5 20 1 105 2105 1 0 1 105 2105 2 0 1 105 2105 3 0 1 105 2105 4 0 1 105 2105 5 0 0 301 2301 1 20 0 301 2301 2 20 0 301 2301 3 20 0 301 2301 4 20 0 301 2301 5 20 0 302 2302 1 0 0 302 2302 2 0 0 302 2302 3 0 0 302 2302 4 0 0 302 2302 5 0 0 303 2303 1 20 0 303 2303 2 0 0 303 2303 3 20 0 303 2303 4 0 0 303 2303 5 0 0 304 2304 1 20 0 304 2304 2 20 0 304 2304 3 20 0 304 2304 4 20 0 304 2304 5 20 0 305 2305 1 20 0 305 2305 2 20 0 305 2305 3 20 0 305 2305 4 20 0 305 2305 5 20 1 101 3101 1 0 1 101 3101 2 0 1 101 3101 3 0 1 101 3101 4 0 1 101 3101 5 0 1 102 3102 1 20 1 102 3102 2 20 1 102 3102 3 20 1 102 3102 4 0 1 102 3102 5 0 1 103 3103 1 0 1 103 3103 2 0 1 103 3103 3 0 1 103 3103 4 0 1 103 3103 5 0 1 104 3104 1 20 1 104 3104 2 20 1 104 3104 3 20 1 104 3104 4 20 1 104 3104 5 20 1 105 3105 1 20 1 105 3105 2 20 1 105 3105 3 20 1 105 3105 4 0 1 105 3105 5 0 0 301 3301 1 20 0 301 3301 2 20 0 301 3301 3 20 0 301 3301 4 20 0 301 3301 5 20 0 302 3302 1 0 0 302 3302 2 0 0 302 3302 3 0 0 302 3302 4 0 0 302 3302 5 0 0 303 3303 1 20 0 303 3303 2 0 0 303 3303 3 20 0 303 3303 4 0 0 303 3303 5 0 0 304 3304 1 20 0 304 3304 2 20 0 304 3304 3 20 0 304 3304 4 20 0 304 3304 5 20 0 305 3305 1 0 0 305 3305 2 0 0 305 3305 3 0 0 305 3305 4 0 0 305 3305 5 0 end
0 Response to understanding a treatment effect with group fixed effects
Post a Comment