LazStats: some refactoring of BlkANOVAUnit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7487 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-06-23 17:16:32 +00:00
parent 6dff879d57
commit f8a14ebfe1

View File

@@ -710,49 +710,45 @@ end;
procedure TBlksAnovaFrm.OneWayPlot; procedure TBlksAnovaFrm.OneWayPlot;
var var
i : integer; i : integer;
maxmean : double; maxmean : double;
XValue : DblDyneVec; plottype : integer;
setstring : string[11];
plottype : integer;
begin begin
plottype := 2; plotType := 2;
SetLength(XValue,Nf1cells); if PlotMeans.Checked then plottype := 2;
if PlotMeans.Checked then plottype := 2; if Plot2DLines.Checked then plottype := 5;
if Plot2DLines.Checked then plottype := 5; if Plot3DLines.Checked then plottype := 6;
if Plot3DLines.Checked then plottype := 6;
maxmean := 0.0; GraphFrm.SetLabels[1] := 'FACTOR A';
setstring := 'FACTOR A'; SetLength(GraphFrm.YPoints,1,NF1cells);
GraphFrm.SetLabels[1] := setstring; SetLength(GraphFrm.Xpoints,1,NF1cells);
SetLength(GraphFrm.YPoints,1,NF1cells);
SetLength(GraphFrm.Xpoints,1,NF1cells); maxmean := 0.0;
for i := 1 to NF1cells do for i := 1 to NF1cells do
begin begin
cellsums[i-1] := cellsums[i-1] / cellcnts[i-1]; cellsums[i-1] := cellsums[i-1] / cellcnts[i-1];
GraphFrm.Ypoints[0,i-1] := cellsums[i-1]; GraphFrm.Ypoints[0,i-1] := cellsums[i-1];
if cellsums[i-1] > maxmean then maxmean := cellsums[i-1]; if cellsums[i-1] > maxmean then maxmean := cellsums[i-1];
XValue[i-1] := minF1 + i - 1; GraphFrm.Xpoints[0,i-1] := minF1 + i - 1;
GraphFrm.Xpoints[0,i-1] := XValue[i-1]; end;
end; GraphFrm.nosets := 1;
GraphFrm.nosets := 1; GraphFrm.nbars := NF1cells;
GraphFrm.nbars := NF1cells; GraphFrm.Heading := Factor1.Text;
GraphFrm.Heading := Factor1.Text; GraphFrm.XTitle := 'FACTOR A LEVEL';
GraphFrm.XTitle := 'FACTOR A LEVEL'; GraphFrm.YTitle := 'Mean';
GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5;
GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false;
GraphFrm.AutoScaled := false; GraphFrm.miny := 0.0;
GraphFrm.miny := 0.0; GraphFrm.maxy := maxmean;
GraphFrm.maxy := maxmean; GraphFrm.GraphType := plottype; // 3d Vertical Bar Chart
GraphFrm.GraphType := plottype; // 3d Vertical Bar Chart GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.BackColor := clYellow; GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.WallColor := clBlack; GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.FloorColor := clLtGray; GraphFrm.ShowBackWall := true;
GraphFrm.ShowBackWall := true; GraphFrm.ShowModal;
GraphFrm.ShowModal;
XValue := nil; GraphFrm.Xpoints := nil;
GraphFrm.Xpoints := nil; GraphFrm.Ypoints := nil;
GraphFrm.Ypoints := nil;
end; end;
procedure TBlksAnovaFrm.Calc2Way; procedure TBlksAnovaFrm.Calc2Way;
@@ -1047,124 +1043,116 @@ end;
procedure TBlksAnovaFrm.TwoWayPlot; procedure TBlksAnovaFrm.TwoWayPlot;
var var
i, j : integer; i, j : integer;
maxmean, XBar : double; maxmean, XBar : double;
XValue : DblDyneVec; plottype : integer;
title : string;
plottype : integer;
setstring : string[11];
begin begin
if CompError then if CompError then
exit; exit;
SetLength(XValue,Nf1cells+Nf2cells); plottype := 2;
plottype := 2; if PlotMeans.Checked then plottype := 2;
if PlotMeans.Checked then plottype := 2; if Plot2DLines.Checked then plottype := 5;
if Plot2DLines.Checked then plottype := 5; if Plot3DLines.Checked then plottype := 6;
if Plot3DLines.Checked then plottype := 6;
// do Factor A first // do Factor A first
setstring := 'FACTOR A'; GraphFrm.SetLabels[1] := 'FACTOR A';
GraphFrm.SetLabels[1] := setstring; SetLength(GraphFrm.Xpoints, 1, NF1cells);
maxmean := 0.0; SetLength(GraphFrm.Ypoints, 1, NF1cells);
SetLength(GraphFrm.Xpoints,1,NF1cells);
SetLength(GraphFrm.Ypoints,1,NF1cells);
for i := 1 to NF1cells do
begin
RowSums[i-1] := RowSums[i-1] / RowCount[i-1];
GraphFrm.Ypoints[0,i-1] := RowSums[i-1];
if RowSums[i-1] > maxmean then maxmean := RowSums[i-1];
XValue[i-1] := minF1 + i - 1;
GraphFrm.Xpoints[0,i-1] := XValue[i-1];
end;
GraphFrm.nosets := 1;
GraphFrm.nbars := NF1cells;
GraphFrm.Heading := Factor1.Text;
title := Factor1.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlack;
GraphFrm.FloorColor := clLtGray;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
// do Factor B next
setstring := 'FACTOR B';
GraphFrm.SetLabels[1] := setstring;
maxmean := 0.0;
SetLength(GraphFrm.Xpoints,1,NF2cells);
SetLength(GraphFrm.Ypoints,1,NF2cells);
for i := 1 to NF2cells do
begin
ColSums[i-1] := ColSums[i-1] / ColCount[i-1];
GraphFrm.Ypoints[0,i-1] := ColSums[i-1];
if ColSums[i-1] > maxmean then maxmean := ColSums[i-1];
XValue[i-1] := minF1 + i - 1;
GraphFrm.Xpoints[0,i-1] := XValue[i-1];
end;
GraphFrm.nosets := 1;
GraphFrm.nbars := NF2cells;
GraphFrm.Heading := Factor2.Text;
title := Factor2.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlack;
GraphFrm.FloorColor := clLtGray;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
// do Factor A x B Interaction next maxmean := 0.0;
maxmean := 0.0; for i := 1 to NF1cells do
SetLength(GraphFrm.Ypoints,NF1cells,NF2cells); begin
SetLength(GraphFrm.Xpoints,1,NF2cells); RowSums[i-1] := RowSums[i-1] / RowCount[i-1];
for i := 1 to NF1cells do GraphFrm.Ypoints[0,i-1] := RowSums[i-1];
begin if RowSums[i-1] > maxmean then maxmean := RowSums[i-1];
setstring := Factor1.Text + ' ' + IntToStr(i); GraphFrm.Xpoints[0,i-1] := minF1 + i - 1;
GraphFrm.SetLabels[i] := setstring; end;
for j := 1 to NF2cells do
begin
XBar := sums[i-1,j-1] / counts[i-1,j-1];
if XBar > maxmean then maxmean := XBar;
GraphFrm.Ypoints[i-1,j-1] := XBar;
end;
end;
for j := 1 to NF2cells do
begin
XValue[j-1] := minF2 + j - 1;
GraphFrm.Xpoints[0,j-1] := XValue[j-1];
end;
GraphFrm.nosets := NF1cells; GraphFrm.nosets := 1;
GraphFrm.nbars := NF2cells; GraphFrm.nbars := NF1cells;
GraphFrm.Heading := 'Factor A x Factor B'; GraphFrm.Heading := Factor1.Text;
title := Factor2.Text + ' Codes'; GraphFrm.XTitle := Factor1.Text + ' Codes';
GraphFrm.XTitle := title; GraphFrm.YTitle := 'Mean';
GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5;
GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false;
GraphFrm.AutoScaled := false; GraphFrm.miny := 0.0;
GraphFrm.miny := 0.0; GraphFrm.maxy := maxmean;
GraphFrm.maxy := maxmean; GraphFrm.GraphType := plottype;
GraphFrm.GraphType := plottype; GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.BackColor := clYellow; GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.WallColor := clBlack; GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.FloorColor := clLtGray; GraphFrm.ShowBackWall := true;
GraphFrm.ShowBackWall := true; if GraphFrm.ShowModal <> mroK then
GraphFrm.ShowModal; exit;
XValue := nil;
GraphFrm.Xpoints := nil; // do Factor B next
GraphFrm.Ypoints := nil; GraphFrm.SetLabels[1] := 'FACTOR B';
SetLength(GraphFrm.Xpoints, 1, NF2cells);
SetLength(GraphFrm.Ypoints, 1, NF2cells);
maxmean := 0.0;
for i := 1 to NF2cells do
begin
ColSums[i-1] := ColSums[i-1] / ColCount[i-1];
GraphFrm.Ypoints[0,i-1] := ColSums[i-1];
if ColSums[i-1] > maxmean then maxmean := ColSums[i-1];
GraphFrm.Xpoints[0,i-1] := minF1 + i - 1;
end;
GraphFrm.nosets := 1;
GraphFrm.nbars := NF2cells;
GraphFrm.Heading := Factor2.Text;
GraphFrm.XTitle := Factor2.Text + ' Codes';
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.ShowBackWall := true;
if GraphFrm.ShowModal <> mrOK then
exit;
// do Factor A x B Interaction next
SetLength(GraphFrm.Ypoints, NF1cells, NF2cells);
SetLength(GraphFrm.Xpoints, 1, NF2cells);
maxmean := 0.0;
for i := 1 to NF1cells do
begin
GraphFrm.SetLabels[i] := Factor1.Text + ' ' + IntToStr(i);
for j := 1 to NF2cells do
begin
XBar := sums[i-1,j-1] / counts[i-1,j-1];
if XBar > maxmean then maxmean := XBar;
GraphFrm.Ypoints[i-1,j-1] := XBar;
end;
end;
for j := 1 to NF2cells do
GraphFrm.Xpoints[0,j-1] := minF2 + j - 1;
GraphFrm.nosets := NF1cells;
GraphFrm.nbars := NF2cells;
GraphFrm.Heading := 'Factor A x Factor B';
GraphFrm.XTitle := Factor2.Text + ' Codes';
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
GraphFrm.Xpoints := nil;
GraphFrm.Ypoints := nil;
end; end;
procedure TBlksAnovaFrm.Calc3Way; procedure TBlksAnovaFrm.Calc3Way;
@@ -1806,239 +1794,218 @@ end;
procedure TBlksAnovaFrm.ThreeWayPlot; procedure TBlksAnovaFrm.ThreeWayPlot;
var var
i, j, k : integer; i, j, k : integer;
maxmean, XBar : double; maxmean, XBar : double;
XValue : DblDyneVec; plottype : integer;
title : string;
plottype : integer;
setstring : string[11];
begin begin
if CompError then exit; if CompError then exit;
SetLength(XValue,totcells);
plottype := 2;
if PlotMeans.Checked then plottype := 2;
if Plot2DLines.Checked then plottype := 5;
if Plot3DLines.Checked then plottype := 6;
// do Factor A first plottype := 2;
setstring := 'FACTOR A'; if PlotMeans.Checked then plottype := 2;
GraphFrm.SetLabels[1] := setstring; if Plot2DLines.Checked then plottype := 5;
maxmean := 0.0; if Plot3DLines.Checked then plottype := 6;
SetLength(GraphFrm.Xpoints,1,NF1cells);
SetLength(GraphFrm.Ypoints,1,NF1cells);
for i := 0 to NF1cells-1 do
begin
RowSums[i] := RowSums[i] / RowCount[i];
GraphFrm.Ypoints[0,i] := RowSums[i];
if RowSums[i] > maxmean then maxmean := RowSums[i];
XValue[i] := minF1 + i;
GraphFrm.Xpoints[0,i] := XValue[i];
end;
GraphFrm.nosets := 1;
GraphFrm.nbars := NF1cells;
GraphFrm.Heading := Factor1.Text;
title := Factor1.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlack;
GraphFrm.FloorColor := clLtGray;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
// do Factor B next // do Factor A first
setstring := 'FACTOR B'; GraphFrm.SetLabels[1] := 'FACTOR A';
GraphFrm.SetLabels[1] := setstring; SetLength(GraphFrm.Xpoints,1,NF1cells);
maxmean := 0.0; SetLength(GraphFrm.Ypoints,1,NF1cells);
SetLength(GraphFrm.Xpoints,1,NF2cells); maxmean := 0.0;
SetLength(GraphFrm.Ypoints,1,NF2cells); for i := 0 to NF1cells-1 do
for i := 0 to NF2cells-1 do begin
begin RowSums[i] := RowSums[i] / RowCount[i];
ColSums[i] := ColSums[i] / ColCount[i]; GraphFrm.Ypoints[0,i] := RowSums[i];
GraphFrm.Ypoints[0,i] := ColSums[i]; if RowSums[i] > maxmean then maxmean := RowSums[i];
if ColSums[i] > maxmean then maxmean := ColSums[i]; GraphFrm.Xpoints[0,i] := minF1 + i;
XValue[i] := minF2 + i; end;
GraphFrm.Xpoints[0,i] := XValue[i];
end;
GraphFrm.nosets := 1;
GraphFrm.nbars := NF2cells;
GraphFrm.Heading := Factor2.Text;
title := Factor2.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlack;
GraphFrm.FloorColor := clLtGray;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
// do Factor C next GraphFrm.nosets := 1;
setstring := 'FACTOR C'; GraphFrm.nbars := NF1cells;
GraphFrm.SetLabels[1] := setstring; GraphFrm.Heading := Factor1.Text;
maxmean := 0.0; GraphFrm.XTitle := Factor1.Text + ' Codes';
SetLength(GraphFrm.Xpoints,1,NF3cells); GraphFrm.YTitle := 'Mean';
SetLength(GraphFrm.Ypoints,1,NF3cells); GraphFrm.barwideprop := 0.5;
for i := 0 to NF3cells-1 do GraphFrm.AutoScaled := false;
begin GraphFrm.miny := 0.0;
SlcSums[i] := SlcSums[i] / SlcCount[i]; GraphFrm.maxy := maxmean;
GraphFrm.Ypoints[0,i] := SlcSums[i]; GraphFrm.GraphType := plottype;
if SlcSums[i] > maxmean then maxmean := SlcSums[i]; GraphFrm.BackColor := GRAPH_BACK_COLOR;
XValue[i] := minF3 + i; GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.Xpoints[0,i] := XValue[i]; GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
end; GraphFrm.ShowBackWall := true;
GraphFrm.nosets := 1; if GraphFrm.ShowModal <> mrOK then
GraphFrm.nbars := NF3cells; exit;
GraphFrm.Heading := Factor3.Text;
title := Factor2.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlack;
GraphFrm.FloorColor := clLtGray;
GraphFrm.ShowBackWall := true;
GraphFrm.ShowModal;
// do Factor A x B Interaction within each slice next // do Factor B next
SetLength(GraphFrm.Ypoints,NF1cells,NF2cells); GraphFrm.SetLabels[1] := 'FACTOR B';
SetLength(GraphFrm.Xpoints,1,NF2cells); maxmean := 0.0;
for k := 0 to NF3cells-1 do SetLength(GraphFrm.Xpoints, 1, NF2cells);
begin SetLength(GraphFrm.Ypoints, 1, NF2cells);
maxmean := 0.0; for i := 0 to NF2cells-1 do
for i := 0 to NF1cells-1 do begin
begin ColSums[i] := ColSums[i] / ColCount[i];
setstring := Factor1.Text + ' ' + IntToStr(i+1); GraphFrm.Ypoints[0,i] := ColSums[i];
GraphFrm.SetLabels[i+1] := setstring; if ColSums[i] > maxmean then maxmean := ColSums[i];
for j := 0 to NF2cells-1 do GraphFrm.Xpoints[0,i] := minF2 + i;
begin end;
XBar := wsum[i,j,k] / ncnt[i,j,k]; GraphFrm.nosets := 1;
if XBar > maxmean then maxmean := XBar; GraphFrm.nbars := NF2cells;
GraphFrm.Ypoints[i,j] := XBar; GraphFrm.Heading := Factor2.Text;
end; GraphFrm.XTitle := Factor2.Text + ' Codes';
end; GraphFrm.YTitle := 'Mean';
for j := 0 to NF2cells-1 do GraphFrm.barwideprop := 0.5;
begin GraphFrm.AutoScaled := false;
XValue[j] := minF2 + j ; GraphFrm.miny := 0.0;
GraphFrm.Xpoints[0,j] := XValue[j]; GraphFrm.maxy := maxmean;
end; GraphFrm.GraphType := plottype;
GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.ShowBackWall := true;
if GraphFrm.ShowModal <> mrOK then
exit;
GraphFrm.nosets := NF1cells; // do Factor C next
GraphFrm.nbars := NF2cells; GraphFrm.SetLabels[1] := 'FACTOR C';
GraphFrm.Heading := 'Factor A x Factor B Within Slice' + IntToStr(k); maxmean := 0.0;
title := Factor2.Text + ' Codes'; SetLength(GraphFrm.Xpoints, 1, NF3cells);
GraphFrm.XTitle := title; SetLength(GraphFrm.Ypoints, 1, NF3cells);
GraphFrm.YTitle := 'Mean'; for i := 0 to NF3cells-1 do
GraphFrm.barwideprop := 0.5; begin
GraphFrm.AutoScaled := false; SlcSums[i] := SlcSums[i] / SlcCount[i];
GraphFrm.miny := 0.0; GraphFrm.Ypoints[0,i] := SlcSums[i];
GraphFrm.maxy := maxmean; if SlcSums[i] > maxmean then maxmean := SlcSums[i];
GraphFrm.GraphType := plottype; GraphFrm.Xpoints[0,i] := minF3 + i;
GraphFrm.BackColor := clYellow; end;
GraphFrm.WallColor := clBlack; GraphFrm.nosets := 1;
GraphFrm.FloorColor := clLtGray; GraphFrm.nbars := NF3cells;
GraphFrm.ShowBackWall := true; GraphFrm.Heading := Factor3.Text;
GraphFrm.ShowModal; GraphFrm.XTitle := Factor2.Text + ' Codes';
end; GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.ShowBackWall := true;
if GraphFrm.ShowModal <> mrOK then
exit;
// do Factor A x C Interaction within each Column next // do Factor A x B Interaction within each slice next
SetLength(GraphFrm.Ypoints,NF1cells,NF3cells); SetLength(GraphFrm.Ypoints, NF1cells, NF2cells);
SetLength(GraphFrm.Xpoints,1,NF3cells); SetLength(GraphFrm.Xpoints, 1, NF2cells);
for j := 0 to NF2cells-1 do for k := 0 to NF3cells-1 do
begin begin
maxmean := 0.0; maxmean := 0.0;
for i := 0 to NF1cells-1 do for i := 0 to NF1cells-1 do
begin begin
setstring := Factor1.Text + ' ' + IntToStr(i+1); GraphFrm.SetLabels[i+1] := Factor1.Text + ' ' + IntToStr(i+1);
GraphFrm.SetLabels[i+1] := setstring; for j := 0 to NF2cells-1 do
for k := 0 to NF3cells-1 do begin
begin XBar := wsum[i,j,k] / ncnt[i,j,k];
XBar := wsum[i,j,k] / ncnt[i,j,k]; if XBar > maxmean then maxmean := XBar;
if XBar > maxmean then maxmean := XBar; GraphFrm.Ypoints[i,j] := XBar;
GraphFrm.Ypoints[i,k] := XBar; end;
end; end;
end; for j := 0 to NF2cells-1 do
for k := 0 to NF3cells-1 do GraphFrm.Xpoints[0,j] := minF2 + j ;
begin
XValue[k] := minF3 + k;
GraphFrm.Xpoints[0,k] := XValue[k];
end;
GraphFrm.nosets := NF1cells; GraphFrm.nosets := NF1cells;
GraphFrm.nbars := NF3cells; GraphFrm.nbars := NF2cells;
GraphFrm.Heading := 'Factor A x Factor C Within Column ' + IntToStr(j+1); GraphFrm.Heading := 'Factor A x Factor B Within Slice' + IntToStr(k);
title := Factor3.Text + ' Codes'; GraphFrm.XTitle := Factor2.Text + ' Codes';
GraphFrm.XTitle := title; GraphFrm.YTitle := 'Mean';
GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5;
GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false;
GraphFrm.AutoScaled := false; GraphFrm.miny := 0.0;
GraphFrm.miny := 0.0; GraphFrm.maxy := maxmean;
GraphFrm.maxy := maxmean; GraphFrm.GraphType := plottype;
GraphFrm.GraphType := plottype; GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.BackColor := clYellow; GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.WallColor := clBlack; GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.FloorColor := clLtGray; GraphFrm.ShowBackWall := true;
GraphFrm.ShowBackWall := true; if GraphFrm.ShowModal <> mrOK then
GraphFrm.ShowModal; exit;
end; end;
// do Factor B x C Interaction within each row next // do Factor A x C Interaction within each Column next
SetLength(GraphFrm.Ypoints,NF2cells,NF3cells); SetLength(GraphFrm.Ypoints, NF1cells, NF3cells);
SetLength(GraphFrm.Xpoints,1,NF3cells); SetLength(GraphFrm.Xpoints, 1, NF3cells);
for i := 0 to NF1cells-1 do for j := 0 to NF2cells-1 do
begin begin
maxmean := 0.0; maxmean := 0.0;
for j := 0 to NF2cells-1 do for i := 0 to NF1cells-1 do
begin begin
setstring := Factor2.Text + ' ' + IntToStr(j+1); GraphFrm.SetLabels[i+1] := Factor1.Text + ' ' + IntToStr(i+1);
GraphFrm.SetLabels[j+1] := setstring; for k := 0 to NF3cells-1 do
for k := 0 to NF3cells-1 do begin
begin XBar := wsum[i,j,k] / ncnt[i,j,k];
XBar := wsum[i,j,k] / ncnt[i,j,k]; if XBar > maxmean then maxmean := XBar;
if XBar > maxmean then maxmean := XBar; GraphFrm.Ypoints[i,k] := XBar;
GraphFrm.Ypoints[j,k] := XBar; end;
end; end;
end; for k := 0 to NF3cells-1 do
for j := 0 to NF2cells-1 do GraphFrm.Xpoints[0,k] := minF3 + k;
begin
XValue[j] := minF2 + j;
GraphFrm.Xpoints[0,j] := XValue[j];
end;
GraphFrm.nosets := NF2cells; GraphFrm.nosets := NF1cells;
GraphFrm.nbars := NF3cells; GraphFrm.nbars := NF3cells;
GraphFrm.Heading := 'Factor B x Factor C Within Row ' + IntToStr(i+1); GraphFrm.Heading := 'Factor A x Factor C Within Column ' + IntToStr(j+1);
title := Factor3.Text + ' Codes'; GraphFrm.XTitle := Factor3.Text + ' Codes';
GraphFrm.XTitle := title; GraphFrm.YTitle := 'Mean';
GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5;
GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false;
GraphFrm.AutoScaled := false; GraphFrm.miny := 0.0;
GraphFrm.miny := 0.0; GraphFrm.maxy := maxmean;
GraphFrm.maxy := maxmean; GraphFrm.GraphType := plottype;
GraphFrm.GraphType := plottype; GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.BackColor := clYellow; GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.WallColor := clBlack; GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.FloorColor := clLtGray; GraphFrm.ShowBackWall := true;
GraphFrm.ShowBackWall := true; if GraphFrm.ShowModal <> mrOK then
GraphFrm.ShowModal; exit;
end; // next row end;
GraphFrm.Xpoints := nil;
GraphFrm.Ypoints := nil; // do Factor B x C Interaction within each row next
XValue := nil; SetLength(GraphFrm.Ypoints, NF2cells, NF3cells);
SetLength(GraphFrm.Xpoints, 1, NF3cells);
for i := 0 to NF1cells-1 do
begin
maxmean := 0.0;
for j := 0 to NF2cells-1 do
begin
GraphFrm.SetLabels[j+1] := Factor2.Text + ' ' + IntToStr(j+1);
for k := 0 to NF3cells-1 do
begin
XBar := wsum[i,j,k] / ncnt[i,j,k];
if XBar > maxmean then maxmean := XBar;
GraphFrm.Ypoints[j,k] := XBar;
end;
end;
for j := 0 to NF2cells-1 do
GraphFrm.Xpoints[0,j] := minF2 + j;
GraphFrm.nosets := NF2cells;
GraphFrm.nbars := NF3cells;
GraphFrm.Heading := 'Factor B x Factor C Within Row ' + IntToStr(i+1);
GraphFrm.XTitle := Factor3.Text + ' Codes';
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScaled := false;
GraphFrm.miny := 0.0;
GraphFrm.maxy := maxmean;
GraphFrm.GraphType := plottype;
GraphFrm.BackColor := GRAPH_BACK_COLOR;
GraphFrm.WallColor := GRAPH_WALL_COLOR;
GraphFrm.FloorColor := GRAPH_FLOOR_COLOR;
GraphFrm.ShowBackWall := true;
if GraphFrm.ShowModal <> mrOK then
exit;
end; // next row
GraphFrm.Xpoints := nil;
GraphFrm.Ypoints := nil;
end; end;
//------------------------------------------------------------------- //-------------------------------------------------------------------
procedure TBlksAnovaFrm.TwoWayContrasts(AReport: TStrings); procedure TBlksAnovaFrm.TwoWayContrasts(AReport: TStrings);