程序一(7组):
data list free/Hc r1 r2 r3 r4 r5 r6 r7 N n1 n2 n3 n4 n5 n6 n7.
begin data
* 请于此行输入Kruskal-Wallis H 检验的结果(即Hc r1 r2 r3 r4 r5 r6 r7 N n1 n2 n3 n4 n5 n6 n7,尽量精确)
end data.
compute H=(12*((r1*n1)**2/n1+(r2*n2)**2/n2+(r3*n3)**2/n3+(r4*n4)**2/n4+(r5*n5)**2/n5+(r6*n6)**2/n6+(r7*n7)**2/n7))/(N*(N+1))-3*(N+1).
compute c=H/Hc.
compute x12=(r1-r2)**2/((N*(N+1)/12)*(1/n1+1/n2)*c).
compute x13=(r1-r3)**2/((N*(N+1)/12)*(1/n1+1/n3)*c).
compute x14=(r1-r4)**2/((N*(N+1)/12)*(1/n1+1/n4)*c).
compute x15=(r1-r5)**2/((N*(N+1)/12)*(1/n1+1/n5)*c).
compute x16=(r1-r6)**2/((N*(N+1)/12)*(1/n1+1/n6)*c).
compute x17=(r1-r7)**2/((N*(N+1)/12)*(1/n1+1/n7)*c).
compute x23=(r2-r3)**2/((N*(N+1)/12)*(1/n2+1/n3)*c).
compute x24=(r2-r4)**2/((N*(N+1)/12)*(1/n2+1/n4)*c).
compute x25=(r2-r5)**2/((N*(N+1)/12)*(1/n2+1/n5)*c).
compute x26=(r2-r6)**2/((N*(N+1)/12)*(1/n2+1/n6)*c).
compute x27=(r2-r7)**2/((N*(N+1)/12)*(1/n2+1/n7)*c).
compute x34=(r3-r4)**2/((N*(N+1)/12)*(1/n3+1/n4)*c).
compute x35=(r3-r5)**2/((N*(N+1)/12)*(1/n3+1/n5)*c).
compute x36=(r3-r6)**2/((N*(N+1)/12)*(1/n3+1/n6)*c).
compute x37=(r3-r7)**2/((N*(N+1)/12)*(1/n3+1/n7)*c).
compute x45=(r4-r5)**2/((N*(N+1)/12)*(1/n4+1/n5)*c).
compute x46=(r4-r6)**2/((N*(N+1)/12)*(1/n4+1/n6)*c).
compute x47=(r4-r7)**2/((N*(N+1)/12)*(1/n4+1/n7)*c).
compute x56=(r5-r6)**2/((N*(N+1)/12)*(1/n5+1/n6)*c).
compute x57=(r5-r7)**2/((N*(N+1)/12)*(1/n5+1/n7)*c).
compute x67=(r6-r7)**2/((N*(N+1)/12)*(1/n6+1/n7)*c).
compute p12=1-cdf.chisq(x12,2).
compute p13=1-cdf.chisq(x13,2).
compute p14=1-cdf.chisq(x14,2).
compute p15=1-cdf.chisq(x15,2).
compute p16=1-cdf.chisq(x16,2).
compute p17=1-cdf.chisq(x17,2).
compute p23=1-cdf.chisq(x23,2).
compute p24=1-cdf.chisq(x24,2).
compute p25=1-cdf.chisq(x25,2).
compute p26=1-cdf.chisq(x26,2).
compute p27=1-cdf.chisq(x27,2).
compute p34=1-cdf.chisq(x34,2).
compute p35=1-cdf.chisq(x35,2).
compute p36=1-cdf.chisq(x36,2).
compute p37=1-cdf.chisq(x37,2).
compute p45=1-cdf.chisq(x45,2).
compute p46=1-cdf.chisq(x46,2).
compute p47=1-cdf.chisq(x47,2).
compute p56=1-cdf.chisq(x56,2).
compute p57=1-cdf.chisq(x57,2).
compute p67=1-cdf.chisq(x67,2).
execute.
注:少于7组的,删掉相应的行与变量即可。
举例3组的如下:
程序二(3组):
data list free/Hc r1 r2 r3 N n1 n2 n3.
begin data
* 请于此行输入Kruskal-Wallis H 检验的结果(即Hc r1 r2 r3 N n1 n2 n3,尽量精确)
end data.
compute H=(12*((r1*n1)**2/n1+(r2*n2)**2/n2+(r3*n3)**2/n3))/(N*(N+1))-3*(N+1).
compute c=H/Hc.
compute x12=(r1-r2)**2/((N*(N+1)/12)*(1/n1+1/n2)*c).
compute x13=(r1-r3)**2/((N*(N+1)/12)*(1/n1+1/n3)*c).
compute x23=(r2-r3)**2/((N*(N+1)/12)*(1/n2+1/n3)*c).
compute p12=1-cdf.chisq(x12,2).
compute p13=1-cdf.chisq(x13,2).
compute p23=1-cdf.chisq(x23,2).
execute.
程序三(10组):
data list free/Hc r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 N n1 n2 n3 n4 n5 n6 n7 n8 n9 n10.
begin data
* 请于此行输入Kruskal-Wallis H 检验的结果(即Hc r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 N n1 n2 n3 n4 n5 n6 n7 n8 n9 n10,尽量精确)
end data.
compute H=(12*((r1*n1)**2/n1+(r2*n2)**2/n2+(r3*n3)**2/n3+(r4*n4)**2/n4+(r5*n5)**2/n5+(r6*n6)**2/n6+(r7*n7)**2/n7+(r8*n8)**2/n8+(r9*n9)**2/n9+(r10*n10)**2/n10))/(N*(N+1))-3*(N+1).
compute c=H/Hc.
compute x12=(r1-r2)**2/((N*(N+1)/12)*(1/n1+1/n2)*c).
compute x13=(r1-r3)**2/((N*(N+1)/12)*(1/n1+1/n3)*c).
compute x14=(r1-r4)**2/((N*(N+1)/12)*(1/n1+1/n4)*c).
compute x15=(r1-r5)**2/((N*(N+1)/12)*(1/n1+1/n5)*c).
compute x16=(r1-r6)**2/((N*(N+1)/12)*(1/n1+1/n6)*c).
compute x17=(r1-r7)**2/((N*(N+1)/12)*(1/n1+1/n7)*c).
compute x18=(r1-r8)**2/((N*(N+1)/12)*(1/n1+1/n8)*c).
compute x19=(r1-r9)**2/((N*(N+1)/12)*(1/n1+1/n9)*c).
compute x110=(r1-r10)**2/((N*(N+1)/12)*(1/n1+1/n10)*c).
compute x23=(r2-r3)**2/((N*(N+1)/12)*(1/n2+1/n3)*c).
compute x24=(r2-r4)**2/((N*(N+1)/12)*(1/n2+1/n4)*c).
compute x25=(r2-r5)**2/((N*(N+1)/12)*(1/n2+1/n5)*c).
compute x26=(r2-r6)**2/((N*(N+1)/12)*(1/n2+1/n6)*c).
compute x27=(r2-r7)**2/((N*(N+1)/12)*(1/n2+1/n7)*c).
compute x28=(r2-r8)**2/((N*(N+1)/12)*(1/n2+1/n8)*c).
compute x29=(r2-r9)**2/((N*(N+1)/12)*(1/n2+1/n9)*c).
compute x210=(r2-r10)**2/((N*(N+1)/12)*(1/n2+1/n10)*c).
compute x34=(r3-r4)**2/((N*(N+1)/12)*(1/n3+1/n4)*c).
compute x35=(r3-r5)**2/((N*(N+1)/12)*(1/n3+1/n5)*c).
compute x36=(r3-r6)**2/((N*(N+1)/12)*(1/n3+1/n6)*c).
compute x37=(r3-r7)**2/((N*(N+1)/12)*(1/n3+1/n7)*c).
compute x38=(r3-r8)**2/((N*(N+1)/12)*(1/n3+1/n8)*c).
compute x39=(r3-r9)**2/((N*(N+1)/12)*(1/n3+1/n9)*c).
compute x310=(r3-r10)**2/((N*(N+1)/12)*(1/n3+1/n10)*c).
compute x45=(r4-r5)**2/((N*(N+1)/12)*(1/n4+1/n5)*c).
compute x46=(r4-r6)**2/((N*(N+1)/12)*(1/n4+1/n6)*c).
compute x47=(r4-r7)**2/((N*(N+1)/12)*(1/n4+1/n7)*c).
compute x48=(r4-r8)**2/((N*(N+1)/12)*(1/n4+1/n8)*c).
compute x49=(r4-r9)**2/((N*(N+1)/12)*(1/n4+1/n9)*c).
compute x410=(r4-r10)**2/((N*(N+1)/12)*(1/n4+1/n10)*c).
compute x56=(r5-r6)**2/((N*(N+1)/12)*(1/n5+1/n6)*c).
compute x57=(r5-r7)**2/((N*(N+1)/12)*(1/n5+1/n7)*c).
compute x58=(r5-r8)**2/((N*(N+1)/12)*(1/n5+1/n8)*c).
compute x59=(r5-r9)**2/((N*(N+1)/12)*(1/n5+1/n9)*c).
compute x510=(r5-r10)**2/((N*(N+1)/12)*(1/n5+1/n10)*c).
compute x67=(r6-r7)**2/((N*(N+1)/12)*(1/n6+1/n7)*c).
compute x68=(r6-r8)**2/((N*(N+1)/12)*(1/n6+1/n8)*c).
compute x69=(r6-r9)**2/((N*(N+1)/12)*(1/n6+1/n9)*c).
compute x610=(r6-r10)**2/((N*(N+1)/12)*(1/n6+1/n10)*c).
compute x78=(r7-r8)**2/((N*(N+1)/12)*(1/n7+1/n8)*c).
compute x79=(r7-r9)**2/((N*(N+1)/12)*(1/n7+1/n9)*c).
compute x710=(r7-r10)**2/((N*(N+1)/12)*(1/n7+1/n10)*c).
compute x89=(r8-r9)**2/((N*(N+1)/12)*(1/n8+1/n9)*c).
compute x810=(r8-r10)**2/((N*(N+1)/12)*(1/n8+1/n10)*c).
compute x910=(r9-r10)**2/((N*(N+1)/12)*(1/n9+1/n10)*c).
compute p12=1-cdf.chisq(x12,2).
compute p13=1-cdf.chisq(x13,2).
compute p14=1-cdf.chisq(x14,2).
compute p15=1-cdf.chisq(x15,2).
compute p16=1-cdf.chisq(x16,2).
compute p17=1-cdf.chisq(x17,2).
compute p18=1-cdf.chisq(x18,2).
compute p19=1-cdf.chisq(x19,2).
compute p110=1-cdf.chisq(x110,2).
compute p23=1-cdf.chisq(x23,2).
compute p24=1-cdf.chisq(x24,2).
compute p25=1-cdf.chisq(x25,2).
compute p26=1-cdf.chisq(x26,2).
compute p27=1-cdf.chisq(x27,2).
compute p28=1-cdf.chisq(x28,2).
compute p29=1-cdf.chisq(x29,2).
compute p210=1-cdf.chisq(x210,2).
compute p34=1-cdf.chisq(x34,2).
compute p35=1-cdf.chisq(x35,2).
compute p36=1-cdf.chisq(x36,2).
compute p37=1-cdf.chisq(x37,2).
compute p38=1-cdf.chisq(x38,2).
compute p39=1-cdf.chisq(x39,2).
compute p310=1-cdf.chisq(x310,2).
compute p45=1-cdf.chisq(x45,2).
compute p46=1-cdf.chisq(x46,2).
compute p47=1-cdf.chisq(x47,2).
compute p48=1-cdf.chisq(x48,2).
compute p49=1-cdf.chisq(x49,2).
compute p410=1-cdf.chisq(x410,2).
compute p56=1-cdf.chisq(x56,2).
compute p57=1-cdf.chisq(x57,2).
compute p58=1-cdf.chisq(x58,2).
compute p59=1-cdf.chisq(x59,2).
compute p510=1-cdf.chisq(x510,2).
compute p67=1-cdf.chisq(x67,2).
compute p68=1-cdf.chisq(x68,2).
compute p69=1-cdf.chisq(x69,2).
compute p610=1-cdf.chisq(x610,2).
compute p78=1-cdf.chisq(x78,2).
compute p79=1-cdf.chisq(x79,2).
compute p710=1-cdf.chisq(x710,2).
compute p89=1-cdf.chisq(x89,2).
compute p810=1-cdf.chisq(x810,2).
compute p910=1-cdf.chisq(x910,2).
execute.