Program written, modified, or edited at StatSoft, Inc.}
if
DisplayMessageBox (MB_OKCANCEL, 'Nonparametric Multiple Comparisons',
'This program runs on the Friedman ANOVA by Ranks results. ' +
'This must be the top Scrollsheet on the Screen')
= IDCANCEL then stop;
Friedman := GetScrollsheet (0);
{the formula can use either column in the output}
Test := DisplayButtonBox ('Which Type of Test', 'Average Rank|Sum of Ranks');
If Test = 0 then stop;
Alpha := 0.05;
if
DisplayNumericInputBox ('Significance Level', 'Please enter the overall significance level', Alpha)
= 0 then stop;
{get number of observations from the Scrollsheet}
ScrollsheetGetTitle (Friedman, 2, gettitle$);
ncases$ := Mid (gettitle$, 21, 6);
TheNCases := Val (ncases$);
{get number of groups from the Scrollsheet}
NumGroups := ScrollsheetGetNbRows (Friedman);
ReDim Diff(NumGroups,NumGroups);
{calculate the approximate Z-Score}
Z := Abs(VNormal (1-(Alpha/(NumGroups*(NumGroups-1))), 0, 1));
{calculate the correct critical value for the chosen test}
if Test = 1 then
Critical := Z*Sqrt((NumGroups*(NumGroups+1))/(6*TheNCases))
else
Critical := Z*Sqrt((TheNCases*NumGroups*(NumGroups+1))/6);
{loop through the comparisons}
for i := 1 to NumGroups-1 do
for j := i+1 to NumGroups do begin
ScrollsheetGetValue (Friedman, i, Test, Val1);
ScrollsheetGetValue (Friedman, j, Test, Val2);
Diff(i,j) := Abs(Val1-Val2);
Diff(j,i) := Diff(i,j);
end;
{get the titles for the Scrollsheet}
for i:= 1 to NumGroups do begin
ScrollsheetGetRowName (Friedman, i, TempName$);
FullNames$ := FullNames$ + TempName$;
if i < NumGroups then FullNames$ := FullNames$ + '|';
end;
if Test = 1 then
Title$ := 'Absolute Differences between Average Rank' +
'|Approx. significant if > ' + str(Critical, 4, 2) +
'|at ' + str (Alpha, 3, 2) + ' significance level'
else
Title$ := 'Absolute Differences between Sum of Ranks' +
'|Approx. significant if > ' + str(Critical, 4, 2) +
'|at ' + str (Alpha, 3, 2) + ' significance level';
{create the Scrollsheet}
Results := NewScrollsheet (NumGroups, NumGroups, Diff, Title$, FullNames$, FullNames$);
{highlight the values above the critical value}
for i := 1 to NumGroups do
for j := 1 to NumGroups do begin
if Diff(i,j) > Critical 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.