1、成都市中考满分作文 SPSS试验设计案例附例1:非参数检验及其多重比较典型案例【例11.6】对某种疾病采用一穴、二穴、三穴作针刺治疗,治疗效果分为控制、显效、有效、无效4级。治疗结果见表11-6第(2)、(3)、(4)栏。问3种针刺治疗方式疗效有无显著差异?表11-6 3种针刺方式治疗效果及秩和检验等 级一穴二穴三穴合计秩次范围平均秩次各组秩和一穴二穴三穴控 制2130106116131.0651.0930.0310.0显 效181022506211186.51557.0865.01903.0有 效1581134112145128.51927.51028.01413.5无 效528151461
2、60153.0765.0306.01224.0合 计59(n1)50(n2)51(n3)160(n)4900.5(R1)3129.0(R2)4850.5(R3)Test Procedure in SPSS1)create a new file as follows;3)dataweight cases, weight the variable “freq” in the data file.Click Analyze Nonparametric Tests Legacy Dialogs K Independent Samples. on the top menu as shown below:
3、 4)You will be presented with the following: 5) Transfer the dependent variable that you are interested in analyzing into the Test Variable List: box. In our example, we need to transfer the variable response into this box. The independent variable acupuncture needs to be transfered into the Groupin
4、g Variable: box. There are two ways transfer your variables. You can either highlight drag-and-drop each variable into the respective boxes or you highlight the variable by using the cursor and clicking the button. Make sure that the Kruskal-Wallis H checkbox is ticked in the Test Type box.You will
5、end up with a screen similar to the one below: 6) Press the button and type 1 into the Minimum box and 3 into the Maximum box. This is defining the range of the values for the categories of the independent variables. In this case there are 3 groups/categories called Drug A, Drug B and Drug C. If the
6、re had been 4 groups but you did not want to include the first group in the analysis then you would have entered 2 and 4 into the Minimum and Maximum boxes, respectively (assuming you ordered the groups numerically). Click the button.7) Click the button. Tick the Descriptive checkbox if you want des
7、criptives and/or Quartiles if you want quartiles. You will be presented with the following if you select Descriptives: Click the button.SPSS Output for the Kruskal-Wallis H TestYou will be presented with the following output (Descriptives excluded):The Ranks table shows the mean rank of the Pain_Sco
8、re for each drug group. The Test Statistics table presents the Chi-square value (Kruskal-Wallis H), the degrees of freedom and the significance level.Reporting the Output of the Kruskal-Wallis H TestIn our example, we can report that there was a statistically significant difference between the diffe
9、rent drug treatments (H(2) = 14.086, P = 0.001) with a mean rank of 83.06 for 1 acupuncture, 62.58 for 2 acupuncture and 95.11 foracupuncture.How to run a Kruskal-Wallis test using SPSSs new nonparametric procedure along with post-hoc tests to determine where differences lie ?Post-hoc TestsTo examin
10、e where the differences actually occur, you need to run separate Wilcoxon Signed-Rank Tests on the different combinations of related groups. So, in this example, you would compare the following combinations:1) One acupuncture to 2 acupuncture 2) One acupuncture to 3 acupuncture 3) two acupuncture to
11、 3 acupuncture You need to use a Bonferroni adjustment on the results you get from the Wilcoxon tests as you are making multiple comparisons, which makes it more likely that you will declare a result significant when you should not (a Type I error). Luckily, the Bonferroni adjustment is very easy to
12、 calculate; simply take the significance level you were initially using (in this case 0.05) and divide it by the number of tests you are running. So in this example, we have a new significance level of 0.05/3 = 0.017. This means that if the P value is larger than 0.017 then we do not have a statisti
13、cally significant result.Running these tests on the results from this example then you get the following result:Click “paste” button, and open the syntax. We can muctiply the syntax by copying and some slight modification.Then, from drag-to-drop, run all.This table shows the output of the Wilcoxon S
14、igned-Rank Test on each of our combinations. It is important to note that the significance values have not been adjusted in SPSS to compensate for multiple comparisons - you must manually compare the significance values produced by SPSS to the Bonferroni-adjusted significance level you have calculat
15、ed. We can see that at the P 0.017 significance level the curing effects between 1 acupuncture and 2 acupuncture (P = 0.015) as well as 2 acupuncture and 3 acupuncture (P=0.000189) were statistically significantly different.Reporting the Output of the Friedman Test (with post-hoc tests)You can repor
16、t the Friedman Test with post-hoc tests results as follows: There was a statistically significant difference in the curing effects depending on which type of acupuncture protocol was adopted, 2(2) = 14.086, P = 0.001. Post-hoc analysis with Wilcoxon Signed-Rank Tests was conducted with a Bonferroni
17、correction applied, resulting in a significance level set at P 0.017. Medians for the 1 acupunture, 2 acupuncture and 3 acupuncture treatment were 83.06, 62.58 and 95.11, respectively. There were no significant differences between the 1 acupuncture and 2 acupuncture trials (Z = -1.404, P = 0.160) de
18、spite an overall reduction in curing effect in the 1 acupuncture vs. 3 acupuncture trials. However, there was a statistically significant diffrences in effects in the 1-2 acupuncture (P = 0.015) and 1-3 acupuncture trials (P=0.000189).注释:教材“卡方检验“一章独立检验中多题均属于依变量为有序变量者,进行卡方检验,实属”欠文化”的表现,应采用秩和检验或Logist
19、ic回归。同学们可自练一番。附例2SPSS 进行随机化实验设计分组随机化(randomization) 分组是指将受试对象按照随机的原则进行分组,是实验设计中保证非处理因素均衡的一个重要手段。只有通过随机分组,才能避免出现各种人为的客观因素和主观因素的偏性,提高统计检验效能(林汉生等,2005)。1. 、完全随机设计分组SPSS 编程File New Syntax。如果已经建立了程序, 则可以通过File Open Syntax 直接打开。在语句编辑窗口,用键盘输入程序,也可以在Word 或者其他文本编辑软件中编辑以下程序,然后通过复制将程序粘贴到语句编辑窗口。程序中的英文字母不分大小写。一般
20、随机化程序:SET SEED = 12345.INPUT PROGRAM.LOOP NUMBER = 1 TO N.COMPUTE RANDOM = UNIFORM(N). END CASE.END LOOP.END FILE.END INPUT PROGRAM.AUTORECODE VARIABLES = RANDOM/ INTO RANKSORT CASES BY RANK(A) .在语句编辑窗口,通过菜单选择: Run All 运行所有命令后,在数据编辑窗口就产生了完全随机设计分组结果。第1 句中的SET SEED 是设定种子,取值在1 到200000 之间,其作用在于一旦设定后,每次运
21、行得出同样结果。如果希望重复同样的分组结果,则可以设置该命令,否则可以省略该句。2. 、完全随机设计分组【例12.1】 现有同品种、同性别、同年龄、体重相近的健康绵羊18只,试用完全随机的方法分成甲、乙两组。绵羊编号123456789101112131415161718随机数字调整组别160744998311463224201485884510937288 SPSS首先将18 只绵羊按体重顺序从1 到18编号。在Syntax Editor 窗口内编写和运行如下SPSS 程序:INPUT PROGRAM.LOOP NUMBER = 1 TO 18.COMPUTE RANDOM = UNIFORM
22、(18).END CASE.END LOOP.END FILE.END INPUT PROGRAM.AUTORECODE VARIABLES = RANDOM/ INTO RANK.SORT CASES BY RANK(A) .RECODE RANK(1 THRU 9 = 1) (10 THRU 18= 2) INTO GROUP.EXECU TE.程序说明与结果解释:运行该程序后,产生观察单位编号(number) 和随机数字(random) ,并将全部随机数字从小到大编序号(rank),按预先规定的序号19为第1 组(group),序号1018为第2 组。结果如图所示,编号为15、17、4、
23、18、11、5、9、1、13的羊只被纳入了第1组。由于在上述程序中没有设定种子,即忽略了SET SEED 命令。因此,每次运行上述程序均随机产生不同的分组结果。【例12.2】 设有同品种、同性别、体重相近的健康仔猪18头,按体重大小依次编为1、2、3、18号,试用完全随机的方法,把它们等分成甲、乙、丙三组。SPSS首先将18只绵羊按体重顺序从1 到18编号。在Syntax Editor 窗口内编写和运行如下SPSS 程序:INPUT PROGRAM.LOOP NUMBER = 1 TO 18.COMPUTE RANDOM = UNIFORM(18).END CASE.END LOOP.END
24、FILE.END INPUT PROGRAM.AUTORECODE VARIABLES = RANDOM/ INTO RANK.SORT CASES BY RANK(A) .RECODE RANK(1 THRU 6 = 1) (7 THRU 12= 2) (13 THRU 18 = 3)INTO GROUP.EXECU TE.程序说明与结果解释:运行该程序后,产生观察单位编号(number) 和随机数字(random) ,并将全部随机数字从小到大编序号(rank),按预先规定的序号16为第1 组(group),序号712为第2 组,序号1318为第3 组。结果如图所示,编号为10、4、15、1
25、7、18、14的羊只被纳入了第1组。由于在上述程序中没有设定种子,即忽略了SET SEED 命令。因此,每次运行上述程序均随机产生不同的分组结果。3、随机区组设计分组的SPSS 编程INPUT PROGRAM. LOOP NUMBER = 1 TO N. COMPUTE BLOCK = RND ( (NUMBER - 1) / K + 0.5) . END CASE. END LOOP. END FILE. END INPUT PROGRAM. COMPUTE RANDOM = UNIFORM(N) . RANK VARIABLES = RANDOM BY BLOCK.上述程序中,N 为观察单
26、位总数, K 为处理组数。第(2) 语句产生1N 的观察单位编号,number;第(3)语句产生观察单位对应的区组编号block (1 K) ;第(8) 语句产生随机数字random(取值在0N 之间) ;第(9) 语句是以区组block 为分组变量,将随机数字random 编秩,并自动赋值给新变量rrandom。当N 为偶数,处理组数K= 2 时,即为配对设计。【例12.3】 5种中草药饲料添加剂分别以A1、A2、A3、A4、A5表示,供试4窝仔猪分别按体重依次编号为:1-5号为第组,6-10号为第组,11-15号为第组,16-20为第组。试按随机单位组设计将试验仔猪分组。本例K=5, N=
27、20. 先将每窝5 只仔猪配成一个区组,将不同区组的仔猪依区组先后顺序排号。将第2 行和第8 行的N = 20 ,第3 行的K= 5 ,代入上述随机区组设计SPSS分组程序,然后运行之。语法如下:INPUT PROGAM. LOOP NUMBER = 1 TO 20. COMPUTE BLOCK = RND ( (NUMBER - 1) / 5 + 0.5) . END CASE. END LOOP. END FILE. END INPUT PROGRAM. COMPUTE RANDOM = UNIFORM(20) . RANK VARIABLES = RANDOM BY BLOCK.numb
28、er 为仔猪的编号,block 为配伍组号,共有4组,每个配伍组有体重相近的5只仔猪;random 是按从小到大顺序排列的随机数字; rrandom 是每个区组中随机数字的排列序号,序号范围是15 。按事先规定,序号为1、2、3、4、5的分别分配到A1、A2、A3、A4、A5组。表12-3 5种饲料添加剂试验随机单位组设计试验动物分组表添加剂单 位 组A1A2A3A4A51214387106914111513121618191720 完全随机化设计、随机区组设计是试验设计和临床试验设计中广泛采用的方法。传统上常用的随机化分组方法有随机数字表法和随机排列表法,虽简单易行,但不适用于大样本,试验规
29、模大时操作繁琐、工作效率低下,并且容易出错。运用SPSS 编程可以轻松自如地解决上述随机分组中的问题,具有很强的可操作性,可提高工作效率,减少误差。注意,由于随机化时多不设定随机种子,故结果没有重复性,也不必与教材上所陈列结果一致。例,现有同一品种的供试家畜18头,分别将性别、年龄相同,体重相似的两头家畜配成对子,共9对,编号为1-9号。试用随机方法将每个对子中的两头家畜分到甲、乙两个处理组中。INPUT PROGRAM.LOOP NUMBER = 1 TO 18. COMPUTE BLOCK = RND ( (NUMBER - 1) / 2 + 0.5) . END CASE. END LO
30、OP. END FILE. END INPUT PROGRAM. COMPUTE RANDOM = UNIFORM(18) . RANK VARIABLES = RANDOM BY BLOCK.number 为家畜的编号,block 为配伍组号,共有9组,每个配伍组有体重相近的2只家畜;random 是按从小到大顺序排列的随机数字; rrandom 是每个区组中随机数字的排列序号,序号范围是125。按事先规定,序号为1、2的分别分配到A1、A2组。5.正交设计【例12.8】 某一种抗菌素的发酵培养基由A、B、C 3种成分组成,各有两个水平,除考察A、B、C三个因素的主效外,还考察A与B、B与C的交互作用。试安排一个正交试验方案并进行结果分析。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1