twinklerise 发表于 2010-4-27 15:44 
各位朋友,如果用sas做回归
model y1 y2 = x1 x2;
即做回归方程
y1=a1+b11*x1+b12*x2
y2=a2+b21*x1+b22*x2
现在我想做限制:a1+a2=0, b11+b21=1, 应该怎么处理
我只知道要限制b11+b12=1可以使用restrict
非常急,请大家帮忙,谢谢了
I believe that you have to get it done in proc model. Here is an example with simulation data. Hope this helps.
data t1;
do i = 1 to 50;
x1=rannor(789);x2=rannor(789);
e1=rannor(789);e2=rannor(789);
y1=1+1*x1+0.2*x2+e1;
y2=-1+0.3*x1+1*x2+e2;
output;
end;
run;
proc model data=t1;
y1=c1+ a1*x1 +b1*x2;
y2=c2+ a2*x1 +b2*x2;
restrict b1+b2=1;
restrict a1+a2=0;
fit y1 y2;
run;
quit;
********************************************
The SAS System 20:30 Tuesday, April 27, 2010 12
The MODEL Procedure
Nonlinear OLS Summary of Residual Errors
DF DF Adj
Equation Model Error SSE MSE Root MSE R-Square R-Sq
y1 2 48 59.7186 1.2441 1.1154 0.2178 0.2015
y2 2 48 76.1907 1.5873 1.2599 0.3865 0.3737
Nonlinear OLS Parameter Estimates
Approx Approx
Parameter Estimate Std Err t Value Pr > |t| Label
c1 0.916766 0.1597 5.74 <.0001
a1 0.29072 0.1272 2.29 0.0267
b1 0.04525 0.1167 0.39 0.6998
c2 -1.13091 0.1799 -6.29 <.0001
a2 -0.29072 0.1272 -2.29 0.0267
b2 0.95475 0.1167 8.18 <.0001
Restrict1 -15.6386 3.9341 -3.98 <.0001 a1+a2=0
Restrict0 -2.31167 4.2889 -0.54 0.5952 b1+b2=1
Number of Observations Statistics for System
Used 50 Objective 2.7182
Missing 0 Objective*N 135.9093