Testul Link-Wallace pentru compararea a k medii. Program aplicativ.
Costescu, Mihai-Radu
procedure Link_Wallace;
{Procedura realizeaza verificarea egalitatii
mediilor unui numar de maxim 8 sondaje,
fiecare de volum maxim 100}
type matr=array[1..8,1..100] of real;
vect=array[1..8] of real;
var n,k,i,j:integer;
x:matr;
ampl,xmed:vect;
sampl,amplmed,l_teoretic,medmin,medma
x,l_calculat:real;
procedure citire(i,n:integer;var
x:matr);
var j:integer;
begin {procedure citire}
for j:=1 to n do
begin
write('x(',j,')=');
readln(x[i,j]);
end;
end; {procedure citire}
function
amplitudine(i,n:integer;x:matr):real;
var xmax,xmin:real;
j:integer;
begin {function amplitudine}
xmax:=x[i,1];
xmin:=x[i,1];
for j:=2 to n do
begin
if x[i,j]>xmax then xmax:=x[i,j]
else
if x[i,j]<xmin then xmin:=x[i,j];
end;
amplitudine:=xmax-xmin;
end; {function amplitudine}
function
media(i,n:integer;x:matr):real;
var s:real;
j:integer;
begin; {function media}
s:=0;
for j:=1 to n do
s:=s+x[i,j];
media:=s/n;
end; {function media}
begin {procedure Link_Wallace}
write('Introduceti numarul sondajelor
k=');
readln(k);
write('Introduceti volumul egal al
sondajelor n=');
readln(n);
writeln('Introduceti valoarea tabelara
corespunzatoare volumului');
write(n,' al sondajelor si numarului ',k,'
de sondaje L=');
readln(l_teoretic);
for i:=1 to k do
begin
writeln(' Sondajul ',i);
citire(i,n,x);
end;
sampl:=0;
for i:=1 to k do
begin
ampl[i]:=amplitudine(i,n,x);
sampl:=sampl+ampl[i];
xmed[i]:=media(i,n,x);
end;
medmin:=xmed[1];
medmax:=xmed[1];
for i:=2 to k do
begin
if medmin>xmed[i] then
medmin:=xmed[i];
if medmax<xmed[i] then
medmax:=xmed[i];
end;
amplmed:=medmax-medmin;
l_calculat:=n*amplmed/sampl;
if l_calculat<l_teoretic
then
begin
writeln;
writeln('Deoarece L calculat =
',l_calculat:5:2,' < ', l_teoretic:5:2,' = L
teoretic');
writeln('cele ',k,' medii sunt
aproximativ egale')
end
else
begin
writeln;
writeln('Deoarece L calculat =
',l_calculat:5:2,' > ', l_teoretic:5:2,' = L
teoretic');
writeln('egalitate celor ',k,' medii
este respinsa');
end;
end;{procedure Link_Wallace}
Valorile critice pentru testul Link-Wallace ([alpha] = 0,05) n / k 2 3 4 5 6 7 8 5-9 1,50 1,18 0,96 0,81 0,70 0,61 0,55 10 1,52 1,20 0,98 0,83 0,72 0,63 0,57 15 1,62 1,28 1,05 0,89 0,77 0,68 0,61 20 1,72 1,36 1,12 0,95 0,82 0,73 0,65 30 1,92 1,52 1,24 1,05 0,91 0,81 0,73 40 2,08 1,66 1,35 1,14 0,99 0,88 0,79 50 2,23 1,77 1,45 1,22 1,06 0,94 0,85 100 2,81 2,23 1,83 1,55 1,34 1,19 1,07