SAS中文论坛

标题: 对一个皮尔斯相关性的程序报错的疑问 [打印本页]

作者: shiyiming    时间: 2006-1-9 22:56
标题: 对一个皮尔斯相关性的程序报错的疑问
data setosa;
   title 'Fisher (1936) Iris Setosa Data';
   input sepallen sepalwid petallen petalwid @@;
   label sepallen='Sepal Length in mm.'
         sepalwid='Sepal Width  in mm.'
         petallen='Petal Length in mm.'
         petalwid='Petal Width  in mm.';
   cards;
50 33 14 02   46 34 14 03   46 36 .  02
51 33 17 05   55 35 13 02   48 31 16 02
52 34 14 02   49 36 14 01   44 32 13 02
50 35 16 06   44 30 13 02   47 32 16 02
48 30 14 03   51 38 16 02   48 34 19 02
50 30 16 02   50 32 12 02   43 30 11 .
58 40 12 02   51 38 19 04   49 30 14 02
51 35 14 02   50 34 16 04   46 32 14 02
57 44 15 04   50 36 14 02   54 34 15 04
52 41 15 .    55 42 14 02   49 31 15 02
54 39 17 04   50 34 15 02   44 29 14 02
47 32 13 02   46 31 15 02   51 34 15 02
50 35 13 03   49 31 15 01   54 37 15 02
54 39 13 04   51 35 14 03   48 34 16 02
48 30 14 01   45 23 13 03   57 38 17 03
51 38 15 03   54 34 17 02   51 37 15 04
52 35 15 02   53 37 15 02
;
run;
ods html;
   ods graphics on;
proc corr data=setosa nomiss nosimple cov plots=matrix ;
   var sepallen sepalwid;
   with petallen petalwid;
   title2 'Rectangular COV and CORR Matrices';
run;   
   
   ods graphics off;
   ods html close;

程序报错如下:

WARNING: No body file.  HTML output will not be created.
NOTE: SCL source line.
251     ods graphics on;
            --------
            180
NOTE: SCL source line.
252  proc corr data=setosa nomiss nosimple cov plots=matrix ;
                                               -----
                                               22
                                               76
ERROR 180-322: Statement is not valid or it is used out of proper order.
ERROR 22-322: Syntax error, expecting one of the following: ;, ALPHA, BEST, COV, CSSCP, DATA,
              DEBUG, EXCLNPWGT, HOEFFDING, KENDALL, NOCORR, NOMISS, NOPRINT, NOPROB, NOSIMPLE,
              OUTH, OUTK, OUTP, OUTS, PEARSON, RANK, SINGULAR, SPEARMAN, SSCP, VARDEF.
ERROR 76-322: Syntax error, statement will be ignored.
253     var sepallen sepalwid;
254     with petallen petalwid;
255     title2 'Rectangular COV and CORR Matrices';
256  run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE CORR used:
      real time           0.01 seconds
      cpu time            0.01 seconds

257
NOTE: SCL source line.
258     ods graphics off;
            --------
            180
ERROR 180-322: Statement is not valid or it is used out of proper order.
259     ods html close;


****************8888\

请求高手指点错误并帮忙改正!谢谢!!
作者: shiyiming    时间: 2006-1-10 09:43
标题: @
没有听说过皮尔斯相关,只有皮尔逊相关-考察的是变量间线性关系。

你想考察的是两组变量(sepallen sepalwid)和(petallen petalwid)的相关,应该用典型相关过程-cancorr过程

据我所知,cancorr过程语法中没有plots=matrix 选项。

[code:20212]data setosa;
title 'Fisher (1936) Iris Setosa Data';
input sepallen sepalwid petallen petalwid @@;
label sepallen='Sepal Length in mm.'
sepalwid='Sepal Width in mm.'
petallen='Petal Length in mm.'
petalwid='Petal Width in mm.';
cards;
50 33 14 02 46 34 14 03 46 36 . 02
51 33 17 05 55 35 13 02 48 31 16 02
52 34 14 02 49 36 14 01 44 32 13 02
50 35 16 06 44 30 13 02 47 32 16 02
48 30 14 03 51 38 16 02 48 34 19 02
50 30 16 02 50 32 12 02 43 30 11 .
58 40 12 02 51 38 19 04 49 30 14 02
51 35 14 02 50 34 16 04 46 32 14 02
57 44 15 04 50 36 14 02 54 34 15 04
52 41 15 . 55 42 14 02 49 31 15 02
54 39 17 04 50 34 15 02 44 29 14 02
47 32 13 02 46 31 15 02 51 34 15 02
50 35 13 03 49 31 15 01 54 37 15 02
54 39 13 04 51 35 14 03 48 34 16 02
48 30 14 01 45 23 13 03 57 38 17 03
51 38 15 03 54 34 17 02 51 37 15 04
52 35 15 02 53 37 15 02
;
run;

proc cancorr data=setosa ;
var sepallen sepalwid;
with petallen petalwid;
title2 'Rectangular COV and CORR Matrices';
run; [/code:20212]
作者: shiyiming    时间: 2006-1-12 12:42
标题: Re: 对一个皮尔斯相关性的程序报错的疑问
proc corr is correct for pearson correlation. but i am not sure how the options. go check the manual.
作者: shiyiming    时间: 2006-1-12 22:52
标题: 缩员
问题的源代码来自SAS的帮助,楼主挺有想象力的,把它给改了,不过SAS好象不支持这样的plot.
      报错是因为加了plots=matrix .
     不过还是很想问你一下,你的目标图是什么样子的?自变量和因变量各是什么?


Example 2: Computing Rectangular Correlation Statistics with Missing Data
[code:cb64d]options nodate pageno=1 linesize=80 pagesize=60;

    data setosa;
   input SepalLength SepalWidth PetalLength PetalWidth @@;
   label sepallength='Sepal Length in mm.'
         sepalwidth='Sepal Width in mm.'
         petallength='Petal Length in mm.'
         petalwidth='Petal Width in mm.';
   datalines;
50 33 14 02   46 34 14 03   46 36 .  02
51 33 17 05   55 35 13 02   48 31 16 02
52 34 14 02   49 36 14 01   44 32 13 02
50 35 16 06   44 30 13 02   47 32 16 02
48 30 14 03   51 38 16 02   48 34 19 02
50 30 16 02   50 32 12 02   43 30 11 .
58 40 12 02   51 38 19 04   49 30 14 02
51 35 14 02   50 34 16 04   46 32 14 02
57 44 15 04   50 36 14 02   54 34 15 04
52 41 15 .    55 42 14 02   49 31 15 02
54 39 17 04   50 34 15 02   44 29 14 02
47 32 13 02   46 31 15 02   51 34 15 02
50 35 13 03   49 31 15 01   54 37 15 02
54 39 13 04   51 35 14 03   48 34 16 02
48 30 14 01   45 23 13 03   57 38 17 03
51 38 15 03   54 34 17 02   51 37 15 04
52 35 15 02   53 37 15 02
;

    proc corr data=setosa sscp cov nosimple;

       var sepallength sepalwidth;
   with petallength petalwidth;

       title 'Fisher (1936) Iris Setosa Data';
run;[/code:cb64d]
作者: shiyiming    时间: 2006-1-13 09:22
标题: to winslow
请教:两组向量间能做Pearson相关?




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2