下面的程序:
proc iml;
reset deflib=resdat;
start F_BETTS(x);/*定义似然函数模块*/
use resdat.agarch;
read all var{r} into r;
read all var{v} into v;
read all var{lagr} into lagr;
read all var{lagv} into lagv;
read all var{dr} into dr;
read all var{dv} into dv;
c1=14.309529;c2=-0.010198;c3=-0.004288;c4=-0.001506;
sumx1=sum((x[1]**2*dr-dv)##2/(x[6]**2*lagr-lagv));
sumx2=sum(1/(x[6]**2*lagr-lagv));
sumx3=sum((x[6]**2*r-v)/(x[6]**2*lagr-lagv));
deltax=365/(x[6]##2-x[3]##2)#sumx1+x[1]##2#(1/365)#(x[6]##2-x[3]##2)#sumx2
+x[2]##2/(365#(x[6]##2-x[3]##2))#(x[6]##2#c1-c2)-2#x[1]#x[2]#655/365
-2#x[1]#sumx3+2#x[1]#655+2#x[2]#(x[6]##2#c3-c4)/(x[6]##2-x[3]##2);
f=deltax;
return(f);
finish F_BETTS;
con={-1 -1 -1 -1 -1 -1,1 1 1 1 1 1};
x={0 0 0 0 0 0};
optn={1 3};
call nlpnra(rc,xres,"F_BETTS",x,optn,con);
store xres;
quit;
是对f函数进行最大化,求出待估参数向量x,
可是运行的时候出现错误:
WARNING: Division by zero, result set to missing value.
operation : / at line 1242 column 17
operands : _TEM1001, _TEM1006
_TEM1001 1 row 1 col (numeric)
-69.94136
_TEM1006 1 row 1 col (numeric)
0
statement : ASSIGN at line 1242 column 1
traceback : module F_BETTS at line 1242 column 1
ERROR: Execution error as noted previously. (rc=100)
operation : NLPNRA at line 1249 column 1
operands : *LIT1031, X, OPTN, CON
*LIT1031 1 row 1 col (character, size 7)
F_BETTS
X 1 row 6 cols (numeric)
0 0 0 0 0 0
OPTN 1 row 2 cols (numeric)
1 3
CON 2 rows 6 cols (numeric)
-1 -1 -1 -1 -1 -1
1 1 1 1 1 1
statement : CALL at line 1249 column 1
1250 store xres;
NOTE: Opening storage library RESDAT.IMLSTOR
ERROR: Matrix XRES has not been set to a value.
statement : STORE at line 1250 column 1
1251 quit;
NOTE: Exiting IML.
NOTE: Storage library RESDAT.IMLSTOR closed.
NOTE: SAS 系统由于错误而停止了该步的处理。
NOTE: PROCEDURE IML 所用时间(总处理时间):
实际时间 0.01 秒
CPU 时间 0.01 秒
Rc100是什么意思?不懂啊。。。
请教高手,谢谢了先!
[此贴子已经被作者于2009-4-6 12:15:29编辑过]