线性方程组中的非线性约束
Non-linear constraint in a system of linear equations
我正在尝试使用 Stata 14 中的 sureg
命令估计夫妻内的同时劳动力供应系统(女性称为 eq1
,男性称为 eq2
)Windows。
当我尝试添加线性约束时,回归有效。但是,我需要对四个系数施加非线性约束,但是一旦我添加它,我就会收到以下错误消息:
the constraint caused an error
您可以在下面找到一个可重现的示例:
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
估计中实现非线性约束,我确实需要在我的模型中施加非线性约束。
您可以 re-cast 您的 non-linear 约束作为两个线性约束并包含在 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]
我正在尝试使用 Stata 14 中的 sureg
命令估计夫妻内的同时劳动力供应系统(女性称为 eq1
,男性称为 eq2
)Windows。
当我尝试添加线性约束时,回归有效。但是,我需要对四个系数施加非线性约束,但是一旦我添加它,我就会收到以下错误消息:
the constraint caused an error
您可以在下面找到一个可重现的示例:
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
估计中实现非线性约束,我确实需要在我的模型中施加非线性约束。
您可以 re-cast 您的 non-linear 约束作为两个线性约束并包含在 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]