SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 925|回复: 4
打印 上一主题 下一主题

有关矩阵运算符“\”的问题!

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2004-6-4 17:17:12 | 只看该作者

有关矩阵运算符“\”的问题!

sas9的帮助文件中,有关图形绘制的示例程序中存在以下语句:
xx=xx\rg \baccent \ms *xx/n;

其中的运算符(不知是否为运算符还是选项,暂且如此称呼,各位不要见笑)“\”表示什么意思?好像矩阵运算符中没有此项,我找了半天也未找见。或者“\rg”、“\baccent”、“\ms”等作为整体以选项的形式发挥功能?发挥的是什么功能?

我将该完整程序拷入program editor中运行,结果给出错误提示,说“\”为非法操作符,不知又是何原因?

哪位了解此功能?还请多多赐教。谢谢!
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2004-6-4 23:18:00 | 只看该作者

baccent

从下面的程序来看“\baccent”好像是transpose的意思,其它的我估计也是一些选项。


A Module for Linear Regression
The previous method may be more familiar to statisticians when different notation is used. A linear model is usually written

y = Xb + e
where y is the vector of responses, X is the design matrix, and b is a vector of unknown parameters estimated by minimizing the sum of squares of e, the error or residual.
The following example illustrates the programming techniques involved in performing linear regression. It is not meant to replace regression procedures such as the REG procedure, which are more efficient for regressions and offer a multitude of diagnostic options.

Suppose that you have response data y measured at five values of the independent variable x and you want to perform a quadratic regression.

Submit the PROC IML statement to begin the procedure.

   > proc iml;

      IML Ready

Input the design matrix X and the data vector y as matrix literals.
   > x={1 1 1,
   >    1 2 4,
   >    1 3 9,
   >    1 4 16,
   >    1 5 25};


              X           5 rows      3 cols    (numeric)

                            1         1         1
                            1         2         4
                            1         3         9
                            1         4        16
                            1         5        25


   > y={1,5,9,23,36};

              Y           5 rows      1 col     (numeric)

                                      1
                                      5
                                      9
                                     23
                                     36

Compute the least-squares estimate of b using the traditional formula.
   > b=inv(x\baccent *x)*x\baccent *y;

              B             3 rows      1 col     (numeric)

                                        2.4
                                       -3.2
                                          2
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2004-6-4 23:54:01 | 只看该作者

示例程序能否正常运行?

感谢回复!

该示例程序能否正常运行呢?在您的机子上。
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
地板
 楼主| 发表于 2004-6-5 19:01:39 | 只看该作者

Re: 示例程序能否正常运行?

[quote="student":85167]感谢回复!

该示例程序能否正常运行呢?在您的机子上。[/quote:85167]
好像也不行,不知道什么原因。
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
5#
 楼主| 发表于 2010-12-31 14:00:35 | 只看该作者

Re: 有关矩阵运算符“\”的问题!

sashelp 中的对照关系

b=inv(x\baccent *x)*x\baccent *y;   ---- 伪码

xpxi=inv(t(x)*x);         /* inverse of X'X          */           --真实编码
beta=xpxi*(t(x)*y);       /* parameter estimate      */

x\baccent  <=====>t(x)        t(x) 既是转置  

用IML干什么呀?
工作只是 base stat  EM EG
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2026-2-3 14:44 , Processed in 0.070839 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表