Program written, modified, or edited at StatSoft, Inc.}
RandomAccess;
NoDataFileVariableNames;
if
DisplayMessageBox (MB_OKCANCEL, 'Nonparametric Multiple Comparisons',
'This program runs on the Kruskal-Wallis ANOVA by Ranks results. ' +
'This must be the top Scrollsheet on the Screen')
= IDCANCEL then stop;
Kruskal := GetScrollsheet(0);
Alpha := 0.05;
if
DisplayNumericInputBox ('Significance Level', 'Please enter the overall significance level', Alpha)
= 0 then stop;
{get number of groups from the Scrollsheet}
NumGroups := ScrollsheetGetNbRows (Kruskal);
ReDim Diff(NumGroups,NumGroups);
ReDim Test(NumGroups,NumGroups);
ReDim ValN(NumGroups);
{calculate the approximate Z-score}
Z := Abs(VNormal (1-(Alpha/(Numgroups*(Numgroups-1))), 0, 1));
ScrollsheetGetMatrix (Kruskal, 1, 2, ValN);
ValSum (ValN, 1, NumGroups, NumTotal);
{calculate the constant part of the critical value}
AlwaysSame := Z*Sqrt((NumTotal*(NumTotal+1))/12);
{loop through the comparisons}
for i := 1 to NumGroups-1 do
for j := 1+i to NumGroups do begin
ScrollsheetGetValue (Kruskal, i, 3, Sum1);
ScrollsheetGetValue (Kruskal, i, 2, Num1);
ScrollsheetGetValue (Kruskal, j, 3, Sum2);
ScrollsheetGetValue (Kruskal, j, 2, Num2);
Diff(i,j) := Abs((Sum1/Num1) - (Sum2/Num2));
Diff(j,i) := Diff(i,j);
{create the critical value depending upon sample sizes}
If Diff(i,j) > AlwaysSame*Sqrt((1/Num1)+(1/Num2))
then Test(i,j) := 1 else Test(i,j) := 0;
Test(j,i) := Test(i,j);
end;
{get Scrollsheet titles}
for i:= 1 to NumGroups do begin
ScrollsheetGetRowName (Kruskal, i, TempName$);
FullNames$ := FullNames$ + TempName$;
if i < NumGroups then FullNames$ := FullNames$ + '|';
end;
Title$ := 'Absolute Differences between Mean Rank' +
'|Approx. significant if highlighted ' +
'|at ' + str (Alpha, 3, 2) + ' significance level';
{create Scrollsheet}
Results := NewScrollsheet (NumGroups, NumGroups, Diff, Title$, FullNames$, FullNames$);
{highlight those above the critical value}
for i := 1 to NumGroups do
for j := 1 to NumGroups do begin
if Test(i,j) =1 then ScrollsheetSetHilite (Results, i, j, 1);
if i = j then ScrollsheetSetTextValue (Results, i, j, '---');
end;
| Back to List of Programs |
![[StatSoft]](../../../images/sssmall.gif)
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217
e-mail: info@statsoft.com
©Copyright StatSoft, Inc., 1984-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.