全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1324 3
2009-12-29
67   proc iml;
NOTE: IML Ready
68   start newton;
69   a0=451-sum(a);
70   c0=1/a0+1/(902-a0);
71   do nrow=1 to 3;
72   ex=l[nrow]+log10(a0)+log10(n[nrow]-a[nrow])-log10(a[nrow])-log10(337-a0);
73   e[nrow]=ex;
74   c[nrow]=1/a[nrow]+1/(902-a[nrow]);
75   do ncol=1 to 3;
76   if nrow=ncol then
77   h[nrow,ncol]=c[nrow]+c0;
78   else h[nrow,ncol]=c0;
79   end;
80   a=a+inv(h)*e;
81   end;
82   finish newton;
NOTE: Module NEWTON defined.
83   do;
84   a={74,90,122};
85   n={167,186,212};
86   l={0.8,1.16,1.57};
87   run newton;
88   print a;
89   end;
ERROR: (execution) Matrix has not been set to a value.
operation : [ at line 73 column 2
operands  : E, NROW, EX

E      0 row       0 col     (type ?, size 0)

NROW      1 row       1 col     (numeric)
         1
EX      1 row       1 col     (numeric)
0.8812067
statement : ASSIGN at line 73 column 1
traceback : module NEWTON at line 73 column 1

NOTE: Paused in module NEWTON.
十分感谢。。。。

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-12-29 00:50:04
学习了,期待高手回复
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-12-29 08:00:43
Hi Guy,

There is two obvious errors caused by your putting statement "80   a=a+inv(h)*e;" in the wrong place. When codes was executed here, the e is just a numeric number NOT a vector, h was just assigned nrow TH row not a full 3 by 3 matrix.

If you can tell me the algorithm and your problem needed to be solved. I can  do it for you.

Happy Holiday and NEW YEAR.

Hope my reply is helpful for you.

Best,
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-12-29 09:26:12
Your algorithm is not clear. My guess:
71   do nrow=1 to 3;
72   ex=l[nrow]+log10(a0)+log10(n[nrow]-a[nrow])-log10(a[nrow])-log10(337-a0);
73   e[nrow]=ex;
just for vector e;

&&   do ncol=1 to 3;
76   if nrow=ncol then
77   h[nrow,ncol]=c[nrow]+c0;
78   else h[nrow,ncol]=c0;
79   end;

for matrix h,

80 in wrong place.

Strongly suggest use matrix operation to improve the efficience

No further suggestion before knowing what you want to do.  Your code looks a little weird. Sorry to say that.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群