我正在尝试使用Windows的Stata 14中的eq1
命令来估计夫妻之间同时提供劳动力的系统(女性称为eq2
,男性称为sureg
)。
当我尝试添加线性约束时,回归有效。但是,我需要对四个系数施加非线性约束,但是一旦添加此约束,就会收到以下错误消息:
约束导致错误
下面您可以找到一个可复制的示例:
sysuse auto.dta
constraint 1 [Eq1]mpg*[Eq2]headroom = [Eq1]headroom*[Eq2]length
sureg (Eq1: price = mpg trunk weight rep78 headroom) ///
(Eq2 : price = headroom length), ///
corr constraint(1)
(note: constraint number 1 caused error r(131))
(note: constraint number 1 caused error r(131))
Seemingly unrelated regression
--------------------------------------------------------------------------
Equation Obs Parms RMSE "R-sq" chi2 P
--------------------------------------------------------------------------
Eq1 69 5 2392.918 0.3150 29.32 0.0000
Eq2 69 2 2581.831 0.2026 18.01 0.0001
--------------------------------------------------------------------------
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Eq1 |
mpg | -26.58347 29.65312 -0.90 0.370 -84.70252 31.53558
trunk | 31.52432 38.05785 0.83 0.407 -43.06769 106.1163
weight | 1.363126 .3241408 4.21 0.000 .7278219 1.99843
rep78 | 171.411 113.7883 1.51 0.132 -51.60992 394.432
headroom | -377.2506 360.8804 -1.05 0.296 -1084.563 330.062
_cons | 2687.868 1603.852 1.68 0.094 -455.6242 5831.361
-------------+----------------------------------------------------------------
Eq2 |
headroom | -325.9389 402.3103 -0.81 0.418 -1114.453 462.5749
length | 50.51478 12.27884 4.11 0.000 26.4487 74.58087
_cons | -2387.561 2125.435 -1.12 0.261 -6553.338 1778.215
------------------------------------------------------------------------------
Correlation matrix of residuals:
Eq1 Eq2
Eq1 1.0000
Eq2 0.9292 1.0000
Breusch-Pagan test of independence: chi2(1) = 59.574, Pr = 0.0000
使用真实数据时,出现相同的错误。这使得不可能在sureg
估计中实现非线性约束,我确实需要在模型中施加非线性约束。
答案 0 :(得分:1)
您可以将非线性约束重新转换为两个线性约束,并将两者都包含在sureg
中:
sysuse auto.dta, clear
constraint 1 [Eq1]mpg = [Eq1]headroom
constraint 2 [Eq2]headroom = [Eq2]length
sureg (Eq1: price = mpg trunk weight rep78 headroom) (Eq2: price = headroom length), ///
corr constraint(1 2)
然后您可以测试是否满足约束,如下所示:
assert _b[Eq1:mpg] * _b[Eq2:headroom] == _b[Eq1:headroom] * _b[Eq2:length]