home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
engineer
/
ksprob21.zip
/
KSMISC.EXE
/
KSWSRPDF.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-05-20
|
1KB
|
48 lines
program wsrpdf;
{ for given n < 30, wsr computes the pdf of the sum of
positive ranks for the Wilcoxon signed rank test}
uses dos,crt,ksutils;
var
i,j,n,maxsum : word;
kount : array[0..465] of longint;
pdf,tot,cumsum : real;
ofil : text;
ofiln : pathstr;
begin
clrscr;
gotoxy(1,1); write('n = ',' ':10);
gotoxy(6,1); readln(n);
if n > 30 then exit;
gotoxy(1,2); write('outfile: ');
ofiln := '';
gotoxy(10,2); readln(ofiln);
assign(ofil,ofiln);
if isfile(ofiln) then append(ofil) else rewrite(ofil);
writeln(ofil,'; ',n);
close(ofil);
maxsum := 1;
kount[0] := 1;
kount[1] := 1;
for i := 2 to 465 do kount[i] := 0;
for i := 2 to n do
begin
inc(maxsum,i);
for j := maxsum downto i do kount[j] := kount[j] + kount[j - i]
end;
tot := 0.0;
for i := 0 to maxsum do tot := tot + kount[i];
cumsum := 0.0;
assign(ofil,ofiln);
append(ofil);
for i := 0 to maxsum do
begin
pdf := kount[i] / tot;
writeln(ofil,i,' ',pdf:10:6)
end;
close(ofil)
end.