wpking 发表于 2013-4-19 20:59 
你好!这样执行你看有什么不对的地方,执行出错了:
. constraint 1 p2>0
. cnsreg p p1 p2, constraints ...
如:设置x的回归系数为2,在stata中的命令如下
. constraint 1 x=2
. cnsreg y x, constraint(1)
Constrained linear regression Number of obs = 30
Root MSE = 1.405e+05
( 1) x = 2
------------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 2 (constrained)
_cons | -120471.5 25657.08 -4.70 0.000 -172946.1 -67996.89
------------------------------------------------------------------------------
你的命令是对的,可能是因为你设置的p2>0条件,会导致分析结果出错