全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2630 5
2011-08-11
在用SAS做矩阵运算,程序如下,但是提示有错误,麻烦各位帮忙指正。

赋值
%let c11=15440898; %let c12=1214053;  %let c13=28629633; %let c14=10549932; %let c15=2781941;  %let c16=59966;
%let c21=1214053;  %let c22=7074056;  %let c23=-1.456e8; %let c24=-5720831; %let c25=-208604;  %let c26=-181805;
%let c31=28629633; %let c32=-1.456e8; %let c33=3.4837e8; %let c34=2467840;  %let c35=-1624589; %let c36=6741274;
%let c41=10549932; %let c42=-5720831; %let c43=2467840;  %let c44=34762183; %let c45=-1816935; %let c46=2096463;
%let c51=2781941;  %let c52=-208604;  %let c53=-1624589; %let c54=-1816935; %let c55=3112999;  %let c56=-756615;
%let c61=59966;    %let c62=-181805;  %let c63=6741274;  %let c64=2096463;  %let c65=-756615;  %let c66=1684279;

程序
proc iml;
reset print;
use rescaled_u;
read all var{c_u0 c_u1 c_u2 c_u3 c_u4 c_u5} into c_u;
s=((c_u`) * c_u)/298;
ls=(root(s))`;
sigma={&c11 &c12 &c13 &c14 &c15 &c16,
       &c21 &c22 &c23 &c24 &c25 &c26,
       &c31 &c32 &c33 &c34 &c35 &c36,
       &c41 &c42 &c43 &c44 &c45 &c46,
       &c51 &c52 &c53 &c54 &c55 &c56,
       &c61 &c62 &c63 &c64 &c65 &c66};
lsigma=(root(sigma))`;
sigma2=lsigma*lsigma`;
a=(lsigma*inv(ls))`;
newu=c_u*a;
s1=((newu`)*newu)/298;
col={"new_u0" "new_u1" "new_u2" "new_u3" "new_u4" "new_u5"};
create sasuser.new_levlel_2_resd from newu [colname=col];
append from newu;
quit;
proc means data=sasuser.new_level_2_resd;
run;

错误提示
lsigma=(root(sigma))`;
ERROR: (execution) Matrix should be positive definite.
附件列表
2.jpg

原图尺寸 72.18 KB

错误提示

错误提示

QTS}E8RNZV@OKNGM)8L}5NT.jpg

原图尺寸 55.11 KB

程序

程序

二维码

扫码加我 拉你入群

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

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

全部回复
2011-8-11 17:48:01
先看看有没有语法、书写等错误吧! 上次的 o  0 很伤人啊! 哈哈
二维码

扫码加我 拉你入群

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

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

2011-8-11 17:49:33
zkymath 发表于 2011-8-11 17:48
先看看有没有语法、书写等错误吧! 上次的 o  0 很伤人啊! 哈哈
嘿嘿 语法没错。是sigma矩阵不正定。。。。
二维码

扫码加我 拉你入群

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

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

2011-8-14 08:27:22
The ROOT function performs the Cholesky decomposition of a symmetric and positive definite matrix. By definition a correlation(covariance) matrix is a symmetric and positive definite matrix.

The sigma matrix in pgm is not positive definite.
二维码

扫码加我 拉你入群

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

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

2011-8-14 09:42:28
bobguy 发表于 2011-8-14 08:27
The ROOT function performs the Cholesky decomposition of a symmetric and positive definite matrix. B ...
谢谢 问题已经解决
二维码

扫码加我 拉你入群

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

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

2020-5-15 10:48:38
求教解决方法
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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