楼主: mengqinqing
1965 11

[原创博文] 求助:sas产生hadamard矩阵 [推广有奖]

  • 8关注
  • 6粉丝

讲师

94%

还不是VIP/贵宾

-

威望
0
论坛币
64351 个
通用积分
8.1717
学术水平
7 点
热心指数
5 点
信用等级
4 点
经验
21974 点
帖子
468
精华
0
在线时间
645 小时
注册时间
2007-11-24
最后登录
2024-3-8
毕业学校
中山大学

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请问各位大虾有没有用过hadamard矩阵?
SAS有没有自带产生这个矩阵的函数?
非常感谢!
二维码

扫码加我 拉你入群

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

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

关键词:Adam dam Ama Had Mar

沙发
bobguy 发表于 2012-4-15 13:02:47 |只看作者 |坛友微信交流群
Here is the syntax of the function in SAS/IML

HADAMARD Function

returns a Hadamard matrix

    HADAMARD( n, <, i>)


The inputs to the HADAMARD function are as follows:

n
    specifies the order of the Hadamard matrix. Specify n such that n = 1, 2, or a multiple of 4 and any of the following hold:

        n \le 256
        n-1 is prime
        (n / 2) - 1 is prime and n / 2 = 2\; {\rm mod}\; 4
        n = 2 h, 4 h, 8 h, ..., 2^p h, where h is any n above



    When any other n is specified, the HADAMARD function returns a zero.

i
    specifies the row number to return. When i is not specified or i is negative, the full n x n matrix is returned.

The HADAMARD function returns a Hadamard matrix, which is an n x n matrix consisting entirely of the values 1 and - 1. The columns of a Hadamard matrix are all orthogonal. Hadamard matrices are frequently used to make orthogonal array experimental designs for two-level factors. For example, the following IML statements create a 12 x 12 Hadamard matrix:

  
    h = hadamard(12);
    print h[format=2.];


The results are as follows:

  
                                        H
  
                        1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
                        1  1 -1  1 -1 -1 -1  1  1  1 -1  1
                        1  1  1 -1  1 -1 -1 -1  1  1  1 -1
                        1 -1  1  1 -1  1 -1 -1 -1  1  1  1
                        1  1 -1  1  1 -1  1 -1 -1 -1  1  1
                        1  1  1 -1  1  1 -1  1 -1 -1 -1  1
                        1  1  1  1 -1  1  1 -1  1 -1 -1 -1
                        1 -1  1  1  1 -1  1  1 -1  1 -1 -1
                        1 -1 -1  1  1  1 -1  1  1 -1  1 -1
                        1 -1 -1 -1  1  1  1 -1  1  1 -1  1
                        1  1 -1 -1 -1  1  1  1 -1  1  1 -1
                        1 -1  1 -1 -1 -1  1  1  1 -1  1  1


The first column is an intercept and the next 11 columns form an orthogonal array experimental design for 11 two-level factors in 12 runs, 2^{11}.

To request the 17th row of a Hadamard matrix of order 448, use the following statement:

  
    h = hadamard(448, 17);

使用道具

藤椅
mengqinqing 发表于 2012-4-15 15:16:14 |只看作者 |坛友微信交流群
bobguy 发表于 2012-4-15 13:02
Here is the syntax of the function in SAS/IML

HADAMARD Function
请问是用这个语句吗?我试了一下有错误。
PROC IML;
h = hadamard(12);
print h;
RUN;
用自己的力量站在自己的位置

使用道具

板凳
bobguy 发表于 2012-4-16 00:30:03 |只看作者 |坛友微信交流群
mengqinqing 发表于 2012-4-15 15:16
请问是用这个语句吗?我试了一下有错误。
PROC IML;
h = hadamard(12);
Yes.

Replace the "run;" with "quit;".

使用道具

报纸
mengqinqing 发表于 2012-4-16 08:51:53 |只看作者 |坛友微信交流群
bobguy 发表于 2012-4-16 00:30
Yes.

Replace the "run;" with "quit;".
但是有错误,得不到结果:
1    PROC IML;
NOTE: IML Ready
2     h = hadamard(12);
ERROR: Invocation of unresolved module HADAMARD.
statement : ASSIGN at line 2 column 2
3     print h;
ERROR: Matrix H has not been set to a value.
statement : PRINT at line 3 column 2
4    quit;
NOTE: Exiting IML.
用自己的力量站在自己的位置

使用道具

地板
yanziwoaini 发表于 2012-4-16 22:25:20 |只看作者 |坛友微信交流群
不懂

使用道具

7
bobguy 发表于 2012-4-18 10:02:28 |只看作者 |坛友微信交流群
mengqinqing 发表于 2012-4-16 08:51
但是有错误,得不到结果:
1    PROC IML;
NOTE: IML Ready
Here is my log file. There is no error.

6840  PROC IML;
NOTE: IML Ready
6841  h = hadamard(12);
6842  print h;
6843  quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds

使用道具

8
mengqinqing 发表于 2012-4-18 11:53:09 |只看作者 |坛友微信交流群
bobguy 发表于 2012-4-18 10:02
Here is my log file. There is no error.

6840  PROC IML;
我的是SAS9.1,您的是什么版本?
用自己的力量站在自己的位置

使用道具

9
bobguy 发表于 2012-4-19 08:34:18 |只看作者 |坛友微信交流群
mengqinqing 发表于 2012-4-18 11:53
我的是SAS9.1,您的是什么版本?
我的是SAS9.3

使用道具

10
mengqinqing 发表于 2012-4-27 17:52:28 |只看作者 |坛友微信交流群
bobguy 发表于 2012-4-19 08:34
我的是SAS9.3
好高级啊。。。能否展示一下您用sas9.3得到的Hadamard(15)的结果,非常感谢!
用自己的力量站在自己的位置

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-19 10:59