Во второй модели вы не настраиваете взаимодействия соответствующим образом вручную.
Рассмотрите следующий пример, используя набор игрушек Stata nlswork
:
webuse nlswork, clear
xtset idcode
generate wks = 1 if wks_work <= 30
replace wks = 2 if wks_work > 30 & wks_work < 60
replace wks = 3 if wks_work > 59
xtreg ln_w age wks##i.race south, robust
Random-effects GLS regression Number of obs = 28,502
Group variable: idcode Number of groups = 4,710
R-sq: Obs per group:
within = 0.1135 min = 1
between = 0.2051 avg = 6.1
overall = 0.1621 max = 15
Wald chi2(10) = 1786.90
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. Err. adjusted for 4,710 clusters in idcode)
------------------------------------------------------------------------------
| Robust
ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | .0155126 .0006254 24.80 0.000 .0142868 .0167383
|
wks |
2 | .1220641 .0073903 16.52 0.000 .1075793 .1365488
3 | .1525508 .0093953 16.24 0.000 .1341364 .1709652
|
race |
black | -.0720868 .0141309 -5.10 0.000 -.0997828 -.0443908
other | .1073435 .0682385 1.57 0.116 -.0264015 .2410885
|
wks#race |
2#black | -.0158733 .0136542 -1.16 0.245 -.0426351 .0108885
2#other | -.0419947 .0518261 -0.81 0.418 -.1435719 .0595826
3#black | -.0179945 .0167701 -1.07 0.283 -.0508633 .0148743
3#other | -.0588866 .0681432 -0.86 0.388 -.1924448 .0746716
|
south | -.1231714 .0107808 -11.43 0.000 -.1443013 -.1020415
_cons | 1.179882 .0180816 65.25 0.000 1.144443 1.215321
-------------+----------------------------------------------------------------
sigma_u | .32371944
sigma_e | .30145969
rho | .53556032 (fraction of variance due to u_i)
------------------------------------------------------------------------------
Вы можетевручную создайте взаимодействия, используя устаревший префикс xi
:
xi: xtreg ln_w age i.wks*i.race south, robust
i.wks _Iwks_1-3 (naturally coded; _Iwks_1 omitted)
i.race _Irace_1-3 (naturally coded; _Irace_1 omitted)
i.wks*i.race _IwksXrac_#_# (coded as above)
Random-effects GLS regression Number of obs = 28,502
Group variable: idcode Number of groups = 4,710
R-sq: Obs per group:
within = 0.1135 min = 1
between = 0.2051 avg = 6.1
overall = 0.1621 max = 15
Wald chi2(10) = 1786.90
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. Err. adjusted for 4,710 clusters in idcode)
-------------------------------------------------------------------------------
| Robust
ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
age | .0155126 .0006254 24.80 0.000 .0142868 .0167383
_Iwks_2 | .1220641 .0073903 16.52 0.000 .1075793 .1365488
_Iwks_3 | .1525508 .0093953 16.24 0.000 .1341364 .1709652
_Irace_2 | -.0720868 .0141309 -5.10 0.000 -.0997828 -.0443908
_Irace_3 | .1073435 .0682385 1.57 0.116 -.0264015 .2410885
_IwksXrac_2_2 | -.0158733 .0136542 -1.16 0.245 -.0426351 .0108885
_IwksXrac_2_3 | -.0419947 .0518261 -0.81 0.418 -.1435719 .0595826
_IwksXrac_3_2 | -.0179945 .0167701 -1.07 0.283 -.0508633 .0148743
_IwksXrac_3_3 | -.0588866 .0681432 -0.86 0.388 -.1924448 .0746716
south | -.1231714 .0107808 -11.43 0.000 -.1443013 -.1020415
_cons | 1.179882 .0180816 65.25 0.000 1.144443 1.215321
--------------+----------------------------------------------------------------
sigma_u | .32371944
sigma_e | .30145969
rho | .53556032 (fraction of variance due to u_i)
-------------------------------------------------------------------------------