统计软件SAS简介及程序示例

上传人:hs****ma 文档编号:586342082 上传时间:2024-09-04 格式:PPT 页数:84 大小:229KB
返回 下载 相关 举报
统计软件SAS简介及程序示例_第1页
第1页 / 共84页
统计软件SAS简介及程序示例_第2页
第2页 / 共84页
统计软件SAS简介及程序示例_第3页
第3页 / 共84页
统计软件SAS简介及程序示例_第4页
第4页 / 共84页
统计软件SAS简介及程序示例_第5页
第5页 / 共84页
点击查看更多>>
资源描述

《统计软件SAS简介及程序示例》由会员分享,可在线阅读,更多相关《统计软件SAS简介及程序示例(84页珍藏版)》请在金锄头文库上搜索。

1、统计软件SAS简介及程序范例1. SAS2. 试验统计方法教材例题的试验统计方法教材例题的SAS程程序及运行结果序及运行结果1. SAS简介 SAS (Statistical Analysis System,统统计计分分析析系系统统)是是当当今今国国际际上上著著名名的的数数据据分分析析软软件件系系统统,其其基基本本部部分分是是SAS/BASE软软件件。20世世纪纪60年年代代末末期期,由由美美国国北北卡卡罗罗纳纳州州州州立立大大学学(North Carolina State University)的的A. J. Barr和和J. H. Goodnight两两位位教教授授开开始始开开发发,197

2、5年年创创建建了了美美国国SAS研研究究所所(SAS Institute Inc.)。之之后后,推推出出的的SAS系系统统,始始终终以以领领先先的的技技术术和和可可靠靠的的支支持持著著称称于于世世,通通过过不不断断发发展展和完善,目前已成为大型集成应用软件系统。和完善,目前已成为大型集成应用软件系统。 SAS系统具有统计分析方法丰富、信系统具有统计分析方法丰富、信息储存简单、语言编程能力强、能对数据息储存简单、语言编程能力强、能对数据连续处理、使用简单等特点。连续处理、使用简单等特点。SAS是一个是一个出色的统计分析系统,它汇集了大量的统出色的统计分析系统,它汇集了大量的统计分析方法,从简单的

3、描述统计到复杂的计分析方法,从简单的描述统计到复杂的多变量分析,编制了大量的使用简便的统多变量分析,编制了大量的使用简便的统计分析过程。计分析过程。SAS系统运行的几个重要前提条件 (一一)SAS系系统统运运行行时时要要同同时时打打开开的的文文件件较较多多,因因此此在在微微型型计计算算机机的的系系统统配配置置文文件件CONFIG.SYS中应指定中应指定FILES=50或以上;或以上; (二二)SAS系系统统软软件件有有时时间间租租期期限限制制,因因此此只只有有机机器器时时间间(DATE)在在软软件件有有效效期期内内才才能能运运行行。时时间间租租期期取取决决于于SAS出出售售版版本本日日期期,即

4、即所所谓谓的的SAS诞生日(诞生日(BIRTHDAY)。)。 (三)三)SAS系统应全部安装到硬盘的系统应全部安装到硬盘的SAS子目子目录下,硬盘应至少有录下,硬盘应至少有10M空间。空间。 SAS for Windows的启动与退出 (一)启动(一)启动 SAS for Windows的启动,按的启动,按如下步骤进行。开机后,直接用鼠标双击桌如下步骤进行。开机后,直接用鼠标双击桌面上面上SAS系统的快捷键图标,自动显示系统的快捷键图标,自动显示主画主画面面,即可进入,即可进入SAS系统。系统。 (二二)退出退出 当用完当用完SAS for Windows,需需要退出时,可以单击【要退出时,可

5、以单击【File】,】,选择【选择【Exit】,】,或者,单击或者,单击(关闭关闭)按钮,立即按钮,立即显示显示。 如果确认需要退出如果确认需要退出SAS for Windows,单击确定按钮;如果需要继续使用单击确定按钮;如果需要继续使用SAS for Windows,单击取消按钮。单击取消按钮。 2. 试验统计方法教材例题的SAS程序及运行结果t测验测验方差分析方差分析直线回归分析直线回归分析协方差分析协方差分析t检验样本平均数与总体平均数的差异显著性检验样本平均数与总体平均数的差异显著性检验 配对试验资料的配对试验资料的t t检验检验 非配对试验资料的非配对试验资料的t t检验检验样本平

6、均数与总体平均数的差异显著性检验样本平均数与总体平均数的差异显著性检验( (例例4.3)4.3)data testt1;input x;differ=x-27.5;cards;32.5 28.6 28.4 24.7 29.1 27.2 29.8 33.3 29.7;proc means n mean stderr t prt;run;运行结果 The MEANS ProcedureVariable N Mean Std Error t Value Pr |t| x 9 29.2555556 0.8623468 33.93 |t| 675.4666667 391.5253952 1.73 0.1

7、451非配对试验资料的非配对试验资料的t t检验检验( (例例4.54.5) )data testt3;input variety x;cards;1 18.68 1 20.67 1 18.42 1 18.00 1 17.44 1 15.952 18.68 2 23.22 2 21.42 2 19.00 2 18.92;proc ttest;class variety;var x;run;运行结果The TTEST ProcedureT-Tests Variable Method Variances DF t Value Pr |t| x Pooled Equal 9 -1.92 0.0868

8、 x Satterthwaite Unequal 7.51 -1.87 0.1001 Equality of Variances Variable Method Num DF Den DF F Value Pr F x Folded F 4 5 1.66 0.5880方差分析方差分析单因素完全随机化试验重复数相等资料单因素完全随机化试验重复数相等资料单因素完全随机化试验重复数不等资料单因素完全随机化试验重复数不等资料两因素交叉分组试验单独观测值资料两因素交叉分组试验单独观测值资料两因素交叉分组试验有重复观测值资料两因素交叉分组试验有重复观测值资料次级样本含量相等的二因素系统分组资料次级样本含量

9、相等的二因素系统分组资料单因素随机区组设计试验资料单因素随机区组设计试验资料 拉丁方设计试验结果拉丁方设计试验结果 两因素随机区组设计试验资料两因素随机区组设计试验资料 两因素裂区设计试验资料两因素裂区设计试验资料 单因素完全随机化试验重复数相等资料单因素完全随机化试验重复数相等资料的方差分析(教材【例的方差分析(教材【例5.3】)】) data anova1;input variety x;cards;1 12 1 10 1 14 1 16 1 12 1 182 8 2 10 2 12 2 14 2 12 2 163 14 3 16 3 13 3 16 3 10 3 154 16 4 18

10、4 20 4 16 4 14 4 16;proc anova;class variety;model x=variety;means variety/duncan;run;运行结果运行结果 The ANOVA Procedure Class Level Information Class Levels Values variety 4 1 2 3 4 Number of observations 24 The ANOVA ProcedureDependent Variable: x Sum of Source DF Squares Mean Square F Value Pr F Model

11、3 67.1666667 22.3888889 3.43 0.0369 Error 20 130.6666667 6.5333333 Corrected Total 23 197.8333333 R-Square Coeff Var Root MSE x Mean 0.339511 18.14939 2.556039 14.08333Source DF Anova SS Mean Square F Value Pr Fvariety 3 67.16666667 22.38888889 3.43 0.0369 The ANOVA Procedure Duncans Multiple Range

12、Test for x NOTE: This test controls the Type I comparisonwise error rate, not the experimentwise error rate. Alpha 0.05 Error Degrees of Freedom 20 Error Mean Square 6.533333 Number of Means 2 3 4 Critical Range 3.078 3.231 3.328 Means with the same letter are not significantly different. Duncan Gro

13、uping Mean N variety A 16.667 6 4 A B A 14.000 6 3 B A B A 13.667 6 1 B B 12.000 6 2单因素完全随机化试验重复数不等资料单因素完全随机化试验重复数不等资料的方差分析(教材【例的方差分析(教材【例5.4】)】) data anova2;input variety x;cards;1 21.5 1 19.5 1 20.0 1 22.0 1 18.0 1 20.02 16.0 2 18.5 2 17.0 2 15.5 2 20.0 2 16.03 19.0 3 17.5 3 20.0 3 18.0 3 17.04 21

14、.0 4 18.5 4 19.0 4 20.05 15.5 5 18.0 5 17.0 5 16.0;proc glm;class variety;model x=variety;means variety/duncan;run;运行结果运行结果 The GLM Procedure Class Level Information Class Levels Values variety 5 1 2 3 4 5 Number of observations 25 The GLM ProcedureDependent Variable: x Sum ofSource DF Squares Mean

15、Square F Value Pr FModel 4 46.49833333 11.62458333 5.99 0.0025Error 20 38.84166667 1.94208333Corrected Total 24 85.34000000 R-Square Coeff Var Root MSE x Mean 0.544860 7.565616 1.393587 18.42000 Source DF Type I SS Mean Square F Value Pr F variety 4 46.49833333 11.62458333 5.99 0.0025 Source DF Type

16、 III SS Mean Square F Value Pr Fvariety 4 46.49833333 11.62458333 5.99 0.0025 The GLM Procedure Duncans Multiple Range Test for x NOTE: This test controls the Type I comparisonwise error rate, not the experimentwise error rate. Alpha 0.05 Error Degrees of Freedom 20 Error Mean Square 1.942083 Harmon

17、ic Mean of Cell Sizes 4.83871 NOTE: Cell sizes are not equal. Number of Means 2 3 4 5 Critical Range 1.869 1.962 2.021 2.062 Means with the same letter are not significantly different. Duncan Grouping Mean N variety A 20.1667 6 1 A A 19.6250 4 4 A B A 18.3000 5 3 B B 17.1667 6 2 B B 16.6250 4 5两因素交叉

18、分组试验单独观测值资料的方差分析(教材【例5.5】) data anova3;input field method x;cards;1 1 71 1 2 73 1 3 77 2 1 90 2 2 90 2 3 923 1 59 3 2 70 3 3 80 4 1 75 4 2 80 4 3 825 1 65 5 2 60 5 3 67 6 1 82 6 2 86 6 3 85;proc anova;class field method;model x=field method;means field method/duncan;run;运行结果运行结果 The ANOVA Procedure

19、Class Level Information Class Levels Values field 6 1 2 3 4 5 6 method 3 1 2 3 Number of observations 18 The ANOVA ProcedureDependent Variable: x Sum ofSource DF Squares Mean Square F Value Pr FModel 7 1576.555556 225.222222 13.97 0.0002Error 10 161.222222 16.122222Corrected Total 17 1737.777778 R-S

20、quare Coeff Var Root MSE x Mean 0.907225 5.222144 4.015249 76.88889Source DF Anova SS Mean Square F Value Pr Ffield 5 1435.111111 287.022222 17.80 0.0001 method 2 141.444444 70.722222 4.39 0.0429The ANOVA Procedure Duncans Multiple Range Test for x NOTE: This test controls the Type I comparisonwise

21、error rate, not the experimentwise error rate. Alpha 0.05 Error Degrees of Freedom 10 Error Mean Square 16.12222 Number of Means 2 3 4 5 6 Critical Range 7.305 7.633 7.827 7.951 8.033Means with the same letter are not significantly different. Duncan Grouping Mean N field A 90.667 3 2 A B A 84.333 3

22、6 B B C 79.000 3 4 C D C 73.667 3 1 D D E 69.667 3 3 E E 64.000 3 5 The ANOVA Procedure Duncans Multiple Range Test for x NOTE: This test controls the Type I comparisonwise error rate, not the experimentwise error rate. Alpha 0.05 Error Degrees of Freedom 10 Error Mean Square 16.12222 Number of Mean

23、s 2 3 Critical Range 5.165 5.398Means with the same letter are not significantly different. Duncan Grouping Mean N method A 80.500 6 3 A B A 76.500 6 2 B B 73.667 6 1两因素交叉分组试验有重复观测值资料的方差分析(教材【例5.6】) data anova4;input density fert x;cards;1 1 27 1 2 26 1 3 31 1 4 30 1 5 25 1 1 29 1 2 25 1 3 30 1 4 30

24、 1 5 251 1 26 1 2 24 1 3 30 1 4 31 1 5 26 1 1 26 1 2 29 1 3 31 1 4 30 1 5 242 1 30 2 2 28 2 3 31 2 4 32 2 5 28 2 1 30 2 2 27 2 3 31 2 4 34 2 5 292 1 28 2 2 26 2 3 30 2 4 33 2 5 28 2 1 29 2 2 25 2 3 32 2 4 32 2 5 273 1 33 3 2 33 3 3 35 3 4 35 3 5 30 3 1 33 3 2 34 3 3 33 3 4 34 3 5 293 1 34 3 2 34 3 3

25、 37 3 4 33 3 5 31 3 1 32 3 2 35 3 3 35 3 4 35 3 5 30;proc anova;class density fert;model x=density fert density*fert;means density fert/duncan;means density*fert/lsd;run;运行结果运行结果 The ANOVA Procedure Class Level Information Class Levels Values density 3 1 2 3 fert 5 1 2 3 4 5 Number of observations 6

26、0 The ANOVA ProcedureDependent Variable: x Sum ofSource DF Squares Mean Square F Value Pr FModel 14 573.3333333 40.9523810 33.51 Fdensity 2 315.8333333 157.9166667 129.20 .0001fert 4 207.1666667 51.7916667 42.38 FModel 5 444.3500000 88.8700000 1720.06 Fplant 2 416.7800000 208.3900000 4033.35 .0001le

27、af(plant) 3 27.5700000 9.1900000 177.87 FModel 8 55.05833333 6.88229167 51.75 Fvariety 5 52.37833333 10.47566667 78.76 FModel 12 35.50320000 2.95860000 10.88 0.0001Error 12 3.26320000 0.27193333Corrected Total 24 38.76640000 R-Square Coeff Var Root MSE x Mean 0.915824 5.867150 0.521472 8.888000Sourc

28、e DF Type I SS Mean Square F Value Pr Fnd 4 32.20640000 8.05160000 29.61 FModel 9 332.6250000 36.9583333 17.06 Fa 3 98.7916667 32.9305556 15.20 0.0001b 1 77.0416667 77.0416667 35.56 .0001block 2 20.3333333 10.1666667 4.69 0.0276a*b 3 136.4583333 45.4861111 20.99 FModel 17 3765.737222 221.513954 33.3

29、9 F block 2 17.137222 8.568611 1.29 0.2991a 2 1309.723889 654.861944 98.71 .0001a*block 4 40.501111 10.125278 1.53 0.2368b 3 1975.956667 658.652222 99.28 .0001a*b 6 422.418333 70.403056 10.61 FModel 1 174.88878 174.88878 16.40 0.0049Error 7 74.66678 10.66668Corrected Total 8 249.55556 Root MSE 3.265

30、99 R-Square 0.7008 Dependent Mean 7.77778 Adj R-Sq 0.6581 Coeff Var 41.99128 Parameter Estimates Parameter StandardVariable DF Estimate Error t Value Pr |t| Intercept 1 48.54932 10.12779 4.79 0.0020 x 1 -1.09962 0.27157 -4.05 0.0049协方差分析 (教材【例9.3】) data anaocov1;input treat x y;cards;1 36 89 1 30 80

31、 1 26 74 1 23 80 1 26 851 30 68 1 20 73 1 19 68 1 20 80 1 16 582 28 64 2 27 81 2 27 73 2 24 67 2 25 772 23 67 2 20 64 2 18 65 2 17 59 2 20 573 28 55 3 33 62 3 26 58 3 22 58 3 23 663 20 55 3 22 60 3 23 71 3 18 55 3 17 484 32 52 4 23 58 4 27 64 4 23 62 4 27 544 28 54 4 20 55 4 24 44 4 19 51 4 17 51;pr

32、oc glm;class treat;model y=x treat/solution;means treat/duncan;lsmeans treat/stderr pdiff tdiff;run;运行结果运行结果The GLM Procedure Class Level Information Class Levels Values treat 4 1 2 3 4 Number of observations 40The GLM ProcedureDependent Variable: y Sum ofSource DF Squares Mean Square F Value Pr FMo

33、del 4 3086.892991 771.723248 18.31 F x 1 579.115634 579.115634 13.74 0.0007treat 3 2507.777357 835.925786 19.84 Fx 1 475.992991 475.992991 11.29 0.0019treat 3 2507.777357 835.925786 19.84 |t| Intercept 36.83792240 B 5.64210743 6.53 .0001 x 0.73591990 0.21897437 3.36 0.0019treat 1 20.55844806 B 2.906

34、17849 7.07 .0001treat 2 13.70951189 B 2.91318223 4.71 |t| Number 1 74.8192741 2.0628458 .0001 1 2 67.9703379 2.0598800 .0001 2 3 59.1495620 2.0555107 .0001 3 4 54.2608260 2.0541106 |t| Dependent Variable: y i/j 1 2 3 4 1 2.339936 5.367538 7.074049 0.0251 .0001 .0001 2 -2.33994 3.037509 4.706026 0.0251 0.0045 .0001 3 -5.36754 -3.03751 1.680852 .0001 0.0045 0.1017 4 -7.07405 -4.70603 -1.68085 .0001 .0001 0.1017NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 医学/心理学 > 基础医学

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号