LazStats: Inherit SuccIntUnit from BasicStatsReportFormUnit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7891 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-11-16 22:39:06 +00:00
parent 4a72eb5f1e
commit a5e228e9ea
10 changed files with 390 additions and 415 deletions

View File

@ -629,7 +629,7 @@
<Unit65> <Unit65>
<Filename Value="forms\analysis\measurement_programs\testscoreunit.pas"/> <Filename Value="forms\analysis\measurement_programs\testscoreunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="TestScoreFrm"/> <ComponentName Value="TestScoreForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestScoreUnit"/> <UnitName Value="TestScoreUnit"/>

View File

@ -405,7 +405,7 @@ begin
grp2 := StrToInt(Grp2CodeEdit.Text); grp2 := StrToInt(Grp2CodeEdit.Text);
end else end else
begin begin
GetMinMax(OS3MainFrm.DataGrid, colNoSelected[1], colNoSelected, minf, maxf); GetColMinMax(OS3MainFrm.DataGrid, colNoSelected[1], colNoSelected, minf, maxf);
grp1 := round(minf); grp1 := round(minf);
grp2 := round(maxf); grp2 := round(maxf);
end; end;

View File

@ -511,7 +511,7 @@ begin
colNoSelected[1] := GetVariableIndex(OS3MainFrm.DataGrid, YVarEdit.Text); colNoSelected[1] := GetVariableIndex(OS3MainFrm.DataGrid, YVarEdit.Text);
colNoSelected[2] := GetVariableIndex(OS3MainFrm.DataGrid, GroupVarEdit.Text); colNoSelected[2] := GetVariableIndex(OS3MainFrm.DataGrid, GroupVarEdit.Text);
GetMinMax(OS3MainFrm.DataGrid, colNoSelected[2], colNoSelected, minf, maxf); GetColMinMax(OS3MainFrm.DataGrid, colNoSelected[2], colNoSelected, minf, maxf);
grp1 := Round(minf); grp1 := Round(minf);
grp2 := Round(maxf); grp2 := Round(maxf);

View File

@ -1,192 +1,144 @@
object SuccIntFrm: TSuccIntFrm inherited SuccIntFrm: TSuccIntFrm
Left = 864 Left = 637
Height = 282 Height = 334
Top = 391 Top = 284
Width = 335 Width = 599
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/SuccessiveIntervalScaling.htm' HelpKeyword = 'html/SuccessiveIntervalScaling.htm'
AutoSize = True
Caption = 'Successive Interval Scaling' Caption = 'Successive Interval Scaling'
ClientHeight = 282 ClientHeight = 334
ClientWidth = 335 ClientWidth = 599
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 318
OnShow = FormShow ClientHeight = 318
Position = poMainFormCenter inherited CloseBtn: TButton
LCLVersion = '2.1.0.0' Top = 293
object Label1: TLabel TabOrder = 8
AnchorSideLeft.Control = VarList end
AnchorSideTop.Control = Owner inherited ComputeBtn: TButton
Left = 8 Top = 293
Height = 15 TabOrder = 7
Top = 8 end
Width = 97 inherited ResetBtn: TButton
BorderSpacing.Top = 8 Top = 293
Caption = 'Available Variables' TabOrder = 6
ParentColor = False end
inherited HelpBtn: TButton
Top = 293
TabOrder = 5
end
inherited ButtonBevel: TBevel
Top = 277
end
object Label1: TLabel[5]
AnchorSideLeft.Control = VarList
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 15
Top = 0
Width = 97
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel[6]
AnchorSideLeft.Control = ItemList
AnchorSideTop.Control = ParamsPanel
Left = 171
Height = 15
Top = 0
Width = 93
Caption = 'Selected Variables'
ParentColor = False
end
object VarList: TListBox[7]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 260
Top = 17
Width = 119
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn[8]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 132
Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 1
end
object OutBtn: TBitBtn[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 132
Height = 26
Top = 47
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 2
end
object AllBtn: TBitBtn[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 125
Height = 25
Top = 105
Width = 40
AutoSize = True
BorderSpacing.Top = 32
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 3
end
object ItemList: TListBox[11]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 171
Height = 260
Top = 17
Width = 120
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
ItemHeight = 0
MultiSelect = True
OnDblClick = ItemListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 4
end
end end
object Label2: TLabel inherited ParamsSplitter: TSplitter
AnchorSideLeft.Control = ItemList Height = 334
AnchorSideTop.Control = Owner
Left = 198
Height = 15
Top = 8
Width = 93
BorderSpacing.Top = 8
Caption = 'Selected Variables'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 208
Top = 25
Width = 128
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
Constraints.MinHeight = 200
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 153
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 1
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 153
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 2
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
AnchorSideTop.Side = asrCenter
Left = 144
Height = 25
Top = 117
Width = 46
AutoSize = True
Caption = 'ALL'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 3
end
object ItemList: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Bevel1
Left = 198
Height = 208
Top = 25
Width = 129
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 4
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 126
Height = 25
Top = 249
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 188
Height = 25
Top = 249
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 6
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 272
Height = 25
Top = 249
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 7
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 233
Width = 335
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end end
end end

View File

@ -1,6 +1,6 @@
// Test file: sucsintv.laz, use all variables. // Test file: sucsintv.laz, use all variables.
// TODO: Different output for VAR5 scale value in "Estimates of scale values..." // TODO: Different output from OpenStat for VAR5 scale value in "Estimates of scale values..."
unit SuccIntUnit; unit SuccIntUnit;
@ -9,19 +9,15 @@ unit SuccIntUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
MainUnit, OutputUnit, FunctionsLib, Globals, DataProcs; MainUnit, FunctionsLib, Globals, BasicStatsReportFormUnit;
type type
{ TSuccIntFrm } { TSuccIntFrm }
TSuccIntFrm = class(TForm) TSuccIntFrm = class(TBasicStatsReportForm)
Bevel1: TBevel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
InBtn: TBitBtn; InBtn: TBitBtn;
OutBtn: TBitBtn; OutBtn: TBitBtn;
AllBtn: TBitBtn; AllBtn: TBitBtn;
@ -30,20 +26,21 @@ type
ItemList: TListBox; ItemList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure ItemListDblClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
private private
{ private declarations }
FAutoSized: Boolean; protected
procedure UpdateBtnStates; procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
public public
{ public declarations } procedure Reset; override;
end; end;
var var
@ -51,52 +48,23 @@ var
implementation implementation
{$R *.lfm}
uses uses
Math, Utils; GridProcs;
{ TSuccIntFrm } { TSuccIntFrm }
procedure TSuccIntFrm.ResetBtnClick(Sender: TObject); procedure TSuccIntFrm.AdjustConstraints;
var
i: integer;
begin begin
VarList.Clear; inherited;
ItemList.Clear;
for i := 1 to NoVariables do ParamsPanel.Constraints.MinWidth := 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left;
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); ParamsPanel.Constraints.MinHeight := AllBtn.Top + AllBtn.Height +
UpdateBtnStates; VarList.BorderSpacing.Bottom + ButtonBevel.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
end; end;
procedure TSuccIntFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Max(
2*MaxValue([Label1.Width, Label2.Width]) + 2*AllBtn.Width + 4*VarList.BorderSpacing.Left, // 2 * AllBtn.Width to avoid window to get too narrow
3*w + 4*CloseBtn.BorderSpacing.Right
);
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TSuccIntFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TSuccIntFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSuccIntFrm.AllBtnClick(Sender: TObject); procedure TSuccIntFrm.AllBtnClick(Sender: TObject);
var var
@ -108,30 +76,33 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSuccIntFrm.ComputeBtnClick(Sender: TObject);
procedure TSuccIntFrm.Compute;
var var
i, j, k, col, X, NoSelected, MaxCat, count, subscript: integer; i, j, k, col, X, NoSelected, MaxCat, count, subscript: integer;
discrow: integer; discrow: integer;
CatCount: IntDyneVec; CatCount: IntDyneVec = nil;
ColNoSelected: IntDyneVec; ColNoSelected: IntDyneVec = nil;
FreqMat: IntDyneMat; FreqMat: IntDyneMat = nil;
RowTots: IntDyneVec; RowTots: IntDyneVec = nil;
PropMat, Zmatrix, WidthMat, TheorZMat, ThCumPMat, CumMat: DblDyneMat; PropMat: DblDyneMat = nil;
DiscDisp, Mean, StdDev, CumWidth, ScaleValue: DblDyneVec; Zmatrix: DblDyneMat = nil;
WidthMat: DblDyneMat = nil;
TheorZMat: DblDyneMat = nil;
ThCumPMat: DblDyneMat = nil;
CumMat: DblDyneMat = nil;
DiscDisp: DblDyneVec = nil;
Mean: DblDyneVec = nil;
StdDev: DblDyneVec = nil;
CumWidth: DblDyneVec = nil;
ScaleValue: DblDyneVec = nil;
RowLabels: StrDyneVec = nil;
ColLabels: StrDyneVec = nil;
d1, d2, C1, L1, L2, t3, sum, discrep, z, prop, maxdiscrep: double; d1, d2, C1, L1, L2, t3, sum, discrep, z, prop, maxdiscrep: double;
RowLabels, ColLabels: StrDyneVec;
outline: string; outline: string;
Save_Cursor: TCursor;
found: boolean; found: boolean;
lReport: TStrings; lReport: TStrings;
begin begin
if ItemList.Items.Count = 0 then
begin
ErrorMsg('No variables selected.');
exit;
end;
MaxCat := 0;
L1 := 0.01; L1 := 0.01;
L2 := 0.99; L2 := 0.99;
maxdiscrep := 0.0; maxdiscrep := 0.0;
@ -140,10 +111,14 @@ begin
SetLength(DiscDisp,NoVariables); SetLength(DiscDisp,NoVariables);
SetLength(ScaleValue,NoVariables); SetLength(ScaleValue,NoVariables);
SetLength(RowLabels,NoVariables); SetLength(RowLabels,NoVariables);
SetLength(ColNoSelected,NoVariables); // SetLength(ColNoSelected,NoVariables);
// Get items selected // Get items selected
NoSelected := ItemList.Items.Count; NoSelected := ItemList.Items.Count;
SetLength(ColNoSelected, NoSelected);
for i := 0 to NoSelected-1 do
ColNoSelected[i] := GetVariableIndex(OS3MainFrm.DataGrid, ItemList.Items[i]);
{
for i := 1 to NoSelected do for i := 1 to NoSelected do
begin begin
for j := 1 to NoVariables do for j := 1 to NoVariables do
@ -152,6 +127,7 @@ begin
if outline = OS3MainFrm.DataGrid.Cells[j,0] then ColNoSelected[i-1] := j; if outline = OS3MainFrm.DataGrid.Cells[j,0] then ColNoSelected[i-1] := j;
end; end;
end; end;
}
(* (*
OutputFrm.RichEdit.Lines.Add('check of parameters'); OutputFrm.RichEdit.Lines.Add('check of parameters');
@ -168,10 +144,18 @@ begin
OutputFrm.RichEdit.Clear; OutputFrm.RichEdit.Clear;
*) *)
//Find largest category value in data //Find largest category value in data
MaxCat := 0;
for j := 0 to NoSelected-1 do
begin
X := round(GetColMax(OS3MainFrm.DataGrid, ColNoSelected[j], ColNoSelected));
if X > MaxCat then MaxCat := X;
end;
{
GetColMax(OS3MainFrm.DataGrid,
for i := 1 to NoCases do for i := 1 to NoCases do
begin begin
if (not GoodRecord(i,NoSelected,ColNoSelected)) then continue; if (not GoodRecord(OS3MainFrm.DataGrid, i, ColNoSelected)) then continue;
for j := 1 to NoSelected do for j := 1 to NoSelected do
begin begin
col := ColNoSelected[j-1]; col := ColNoSelected[j-1];
@ -179,6 +163,7 @@ begin
if (X > MaxCat) then MaxCat := X; if (X > MaxCat) then MaxCat := X;
end; end;
end; end;
}
// Initialize arrays // Initialize arrays
SetLength(CatCount, MaxCat); SetLength(CatCount, MaxCat);
@ -195,43 +180,16 @@ begin
SetLength(CumWidth, MaxCat); SetLength(CumWidth, MaxCat);
SetLength(ColLabels, MaxCat); SetLength(ColLabels, MaxCat);
for i := 0 to NoSelected-1 do // Build frequency matrix
for i := 0 to NoCases-1 do
begin begin
RowTots[i] := 0; if (not GoodRecord(OS3MainFrm.DataGrid, i+1, ColNoSelected)) then continue;
DiscDisp[i] := 0.0; for j := 0 to NoSelected-1 do
ScaleValue[i] := 0.0;
for j := 0 to MaxCat-1 do
begin begin
FreqMat[i,j] := 0; col := ColNoSelected[j];
PropMat[i,j] := 0.0; X := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col, i+1])));
CumMat[i,j] := 0.0;
Zmatrix[i,j] := 0.0;
WidthMat[i,j] := 0.0;
TheorZMat[i,j] := 0.0;
ThCumPMat[i,j] := 0.0;
end;
end;
for j := 0 to MaxCat-1 do
begin
CumWidth[j] := 0.0;
StdDev[j] := 0.0;
Mean[j] := 0.0;
CatCount[j] := 0;
end;
Save_Cursor := Screen.Cursor; // save current cursor
Screen.Cursor := crHourGlass; // Show hourglass cursor
//Build frequency matrix
for i := 1 to NoCases do
begin
if (not GoodRecord(i,NoSelected,ColNoSelected)) then continue;
for j := 1 to NoSelected do
begin
col := ColNoSelected[j-1];
X := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i])));
if (X > 0) and (X <= MaxCat) then if (X > 0) and (X <= MaxCat) then
FreqMat[j-1, X-1] := FreqMat[j-1, X-1] + 1; FreqMat[j, X-1] := FreqMat[j, X-1] + 1;
end; end;
end; end;
@ -240,13 +198,13 @@ begin
begin begin
RowTots[i] := 0; RowTots[i] := 0;
for j := 0 to MaxCat-1 do for j := 0 to MaxCat-1 do
RowTots[i] := RowTots[i] + FreqMat[i,j]; RowTots[i] := RowTots[i] + FreqMat[i, j];
end; end;
// Convert frequencies to proportions of the row totals // Convert frequencies to proportions of the row totals
for i := 0 to NoSelected-1 do for i := 0 to NoSelected-1 do
for j := 0 to MaxCat-1 do for j := 0 to MaxCat-1 do
PropMat[i,j] := FreqMat[i,j] / RowTots[i]; PropMat[i, j] := FreqMat[i, j] / RowTots[i];
// Accumulate the proportions accross the categories // Accumulate the proportions accross the categories
for i := 1 to NoSelected do for i := 1 to NoSelected do
@ -312,25 +270,25 @@ begin
// Now, calculate interval widths // Now, calculate interval widths
for j := 2 to MaxCat - 1 do for j := 2 to MaxCat - 1 do
begin begin
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
if (Zmatrix[i-1, j-1] <> 99.0) and (Zmatrix[i-1, j-2] <> 99.0) then if (Zmatrix[i, j-1] <> 99.0) and (Zmatrix[i, j-2] <> 99.0) then
WidthMat[i-1, j-2] := Zmatrix[i-1, j-1] - Zmatrix[i-1, j-2] WidthMat[i, j-2] := Zmatrix[i, j-1] - Zmatrix[i, j-2]
else else
WidthMat[i-1, j-2] := 99.0; WidthMat[i, j-2] := 99.0;
end; end;
end; end;
//Calculate Means and Standard Deviations of category Widths //Calculate Means and Standard Deviations of category Widths
for j := 1 to MaxCat-2 do for j := 1 to MaxCat-2 do
begin begin
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
if (WidthMat[i-1,j-1] <> 99.0) then if (WidthMat[i,j-1] <> 99.0) then
begin begin
CatCount[j-1] := CatCount[j-1] + 1; CatCount[j-1] := CatCount[j-1] + 1;
Mean[j-1] := Mean[j-1] + WidthMat[i-1,j-1]; Mean[j-1] := Mean[j-1] + WidthMat[i, j-1];
StdDev[j-1] := StdDev[j-1] + (WidthMat[i-1,j-1] * WidthMat[i-1,j-1]); StdDev[j-1] := StdDev[j-1] + (WidthMat[i, j-1] * WidthMat[i, j-1]);
end; end;
end; end;
if (CatCount[j-1] > 1) then if (CatCount[j-1] > 1) then
@ -416,44 +374,44 @@ begin
try try
lReport.Add('SUCCESSIVE INTERVAL SCALING RESULTS'); lReport.Add('SUCCESSIVE INTERVAL SCALING RESULTS');
lReport.Add(''); lReport.Add('');
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
RowLabels[i-1] := OS3MainFrm.DataGrid.Cells[ColNoSelected[i-1],0]; RowLabels[i] := OS3MainFrm.DataGrid.Cells[ColNoSelected[i],0];
for i := 1 to MaxCat do for i := 0 to MaxCat-1 do
ColLabels[i-1] := Format(' %2d-%2d ', [i-1, i]); ColLabels[i] := Format(' %2d-%2d ', [i, i+1]);
outline := ' '; outline := ' ';
for i := 1 to MaxCat do outline := outline + ColLabels[i-1]; for i := 0 to MaxCat-1 do outline := outline + ColLabels[i];
lReport.Add(outline); lReport.Add(outline);
outline := ' '; outline := ' ';
for i := 1 to MaxCat do outline := outline + ' ------ '; for i := 0 to MaxCat-1 do outline := outline + ' ------ ';
lReport.Add(outline); lReport.Add(outline);
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
if i > 1 then if i > 0 then
lReport.Add(''); lReport.Add('');
lReport.Add('%10s', [RowLabels[i-1]]); lReport.Add('%10s', [RowLabels[i]]);
outline := 'Frequency '; outline := 'Frequency ';
for j := 1 to MaxCat do for j := 0 to MaxCat-1 do
outline := outline + Format('%8d', [FreqMat[i-1,j-1]]); outline := outline + Format('%8d', [FreqMat[i, j]]);
lReport.Add(outline); lReport.Add(outline);
outline := 'Proportion '; outline := 'Proportion ';
for j := 1 to MaxCat do for j := 0 to MaxCat-1 do
outline := outline + Format('%8.3f', [PropMat[i-1,j-1]]); outline := outline + Format('%8.3f', [PropMat[i, j]]);
lReport.Add(outline); lReport.Add(outline);
outline := 'Cum. Prop. '; outline := 'Cum. Prop. ';
for j := 1 to MaxCat do for j := 0 to MaxCat-1 do
outline := outline + Format('%8.3f', [CumMat[i-1,j-1]]); outline := outline + Format('%8.3f', [CumMat[i, j]]);
lReport.Add(outline); lReport.Add(outline);
outline := 'Normal z '; outline := 'Normal z ';
for j := 1 to MaxCat do for j := 0 to MaxCat-1 do
begin begin
if (Zmatrix[i-1,j-1] <> 99.0) then if (Zmatrix[i, j] <> 99.0) then
outline := outline + Format('%8.3f', [Zmatrix[i-1,j-1]]) outline := outline + Format('%8.3f', [Zmatrix[i, j]])
else else
outline := outline + ' -'; outline := outline + ' -';
end; end;
@ -475,15 +433,14 @@ begin
outline := outline + ' ------ '; outline := outline + ' ------ ';
lReport.Add(outline); lReport.Add(outline);
outline := ''; outline := '';
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
outline := outline + Format('%11s', [RowLabels[i-1]]); outline := outline + Format('%11s', [RowLabels[i]]);
for j := 1 to MaxCat-2 do for j := 0 to MaxCat-3 do
begin begin
if (WidthMat[i-1,j-1] <> 99.0) then if (WidthMat[i, j] <> 99.0) then
outline := outline + Format('%8.3f', [WidthMat[i-1,j-1]]) outline := outline + Format('%8.3f', [WidthMat[i, j]])
else else
outline := outline + ' -'; outline := outline + ' -';
end; end;
@ -493,23 +450,23 @@ begin
lReport.Add(''); lReport.Add('');
outline := 'Mean Width '; outline := 'Mean Width ';
for i := 1 to MaxCat - 2 do for i := 0 to MaxCat - 3 do
outline := outline + Format('%8.2f', [Mean[i-1]]); outline := outline + Format('%8.2f', [Mean[i]]);
lReport.Add(outline); lReport.Add(outline);
outline := 'No. Items '; outline := 'No. Items ';
for i := 1 to MaxCat - 2 do for i := 0 to MaxCat - 3 do
outline := outline + Format('%8d', [CatCount[i-1]]); outline := outline + Format('%8d', [CatCount[i]]);
lReport.Add(outline); lReport.Add(outline);
outline := 'Std. Dev.s '; outline := 'Std. Dev.s ';
for i := 1 to MaxCat - 2 do for i := 0 to MaxCat - 3 do
outline := outline + Format('%8.2f', [StdDev[i-1]]);; outline := outline + Format('%8.2f', [StdDev[i]]);;
lReport.Add(outline); lReport.Add(outline);
outline := 'Cum. Means '; outline := 'Cum. Means ';
for i := 1 to MaxCat - 2 do for i := 0 to MaxCat - 3 do
outline := outline + Format('%8.2f', [CumWidth[i-1]]); outline := outline + Format('%8.2f', [CumWidth[i]]);
lReport.Add(outline); lReport.Add(outline);
lReport.Add(''); lReport.Add('');
@ -533,11 +490,11 @@ begin
outline := ' '; outline := ' ';
for i := 0 to MaxCat-1 do outline := outline + ' ------ '; for i := 0 to MaxCat-1 do outline := outline + ' ------ ';
lReport.Add(outline); lReport.Add(outline);
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
outline := Format('%10s', [RowLabels[i-1]]); outline := Format('%10s', [RowLabels[i]]);
for j := 1 to MaxCat - 1 do for j := 0 to MaxCat - 2 do
outline := outline + Format('%8.3f', [TheorZMat[i-1,j-1]]); outline := outline + Format('%8.3f', [TheorZMat[i, j]]);
lReport.Add(outline); lReport.Add(outline);
end; end;
@ -545,19 +502,19 @@ begin
lReport.Add(DIVIDER_SMALL); lReport.Add(DIVIDER_SMALL);
lReport.Add(''); lReport.Add('');
lReport.Add('Cumulative Theoretical Proportions'); lReport.Add('CUMULATIVE THEORETICAL PROPORTIONS');
lReport.Add(''); lReport.Add('');
outline := ' '; outline := ' ';
for i := 1 to MaxCat do outline := outline + ColLabels[i-1]; for i := 0 to MaxCat-1 do outline := outline + ColLabels[i];
lReport.Add(outline); lReport.Add(outline);
outline := ' '; outline := ' ';
for i := 1 to MaxCat do outline := outline + ' ------ '; for i := 0 to MaxCat-1 do outline := outline + ' ------ ';
lReport.Add(outline); lReport.Add(outline);
for i := 1 to NoSelected do for i := 0 to NoSelected-1 do
begin begin
outline := Format('%10s', [RowLabels[i-1]]); outline := Format('%10s', [RowLabels[i]]);
for j := 1 to MaxCat do for j := 0 to MaxCat-1 do
outline := outline + Format('%8.3f', [ThCumPMat[i-1,j-1]]); outline := outline + Format('%8.3f', [ThCumPMat[i, j]]);
lReport.Add(outline); lReport.Add(outline);
end; end;
lReport.Add(''); lReport.Add('');
@ -565,32 +522,14 @@ begin
lReport.Add('Average Discrepancy Between Theoretical and Observed Cumulative Proportions: %.3f', [discrep]); lReport.Add('Average Discrepancy Between Theoretical and Observed Cumulative Proportions: %.3f', [discrep]);
lReport.Add('Maximum discrepancy %.3f found in item %s', [maxdiscrep, RowLabels[discrow-1]]); lReport.Add('Maximum discrepancy %.3f found in item %s', [maxdiscrep, RowLabels[discrow-1]]);
Screen.Cursor := Save_Cursor; FReportFrame.DisplayReport(lReport);
DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
ColLabels := nil;
RowLabels := nil;
ScaleValue := nil;
CumWidth := nil;
StdDev := nil;
Mean := nil;
DiscDisp := nil;
CumMat := nil;
ThCumPMat := nil;
TheorZMat := nil;
WidthMat := nil;
Zmatrix := nil;
PropMat := nil;
RowTots := nil;
FreqMat := nil;
CatCount := nil;
ColNoSelected := nil;
end; end;
end; end;
procedure TSuccIntFrm.InBtnClick(Sender: TObject); procedure TSuccIntFrm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@ -609,6 +548,21 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSuccIntFrm.ItemListDblClick(Sender: TObject);
var
index: Integer;
begin
index := ItemList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(ItemList.Items[index]);
ItemList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TSuccIntFrm.OutBtnClick(Sender: TObject); procedure TSuccIntFrm.OutBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@ -627,11 +581,27 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSuccIntFrm.Reset;
var
i: integer;
begin
inherited;
ItemList.Clear;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
UpdateBtnStates;
end;
procedure TSuccIntFrm.UpdateBtnStates; procedure TSuccIntFrm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
i: Integer; i: Integer;
begin begin
inherited;
lSelected := false; lSelected := false;
for i := 0 to VarList.Items.Count - 1 do for i := 0 to VarList.Items.Count - 1 do
if VarList.Selected[i] then if VarList.Selected[i] then
@ -653,13 +623,42 @@ begin
AllBtn.Enabled := VarList.Items.Count > 0; AllBtn.Enabled := VarList.Items.Count > 0;
end; end;
function TSuccIntFrm.Validate(out AMsg: String;
out AControl: TWinControl): Boolean;
begin
Result := false;
if ItemList.Items.Count = 0 then
begin
AMsg := 'No variables selected.';
AControl := VarList;
exit;
end;
Result := true;
end;
procedure TSuccIntFrm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
ItemList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TSuccIntFrm.VarListSelectionChange(Sender: TObject; User: boolean); procedure TSuccIntFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
initialization
{$I succintunit.lrs}
end. end.

View File

@ -1,4 +1,4 @@
object TestScoreFrm: TTestScoreFrm object TestScoreForm: TTestScoreForm
Left = 501 Left = 501
Height = 575 Height = 575
Top = 204 Top = 204
@ -13,7 +13,7 @@ object TestScoreFrm: TTestScoreFrm
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow OnShow = FormShow
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.0.10.0'
object OptionsGroup: TGroupBox object OptionsGroup: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner

View File

@ -14,9 +14,9 @@ uses
type type
{ TTestScoreFrm } { TTestScoreForm }
TTestScoreFrm = class(TForm) TTestScoreForm = class(TForm)
Bevel1: TBevel; Bevel1: TBevel;
MeansPlotChk: TCheckBox; MeansPlotChk: TCheckBox;
HoytChk: TCheckBox; HoytChk: TCheckBox;
@ -119,7 +119,7 @@ type
end; end;
var var
TestScoreFrm: TTestScoreFrm; TestScoreForm: TTestScoreForm;
implementation implementation
@ -127,9 +127,9 @@ uses
Math, Math,
Utils, MatrixUnit, MathUnit; Utils, MatrixUnit, MathUnit;
{ TTestScoreFrm } { TTestScoreForm }
procedure TTestScoreFrm.ResetBtnClick(Sender: TObject); procedure TTestScoreForm.ResetBtnClick(Sender: TObject);
var var
i, j: integer; i, j: integer;
begin begin
@ -195,7 +195,7 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.ResponseScrollChange(Sender: TObject); procedure TTestScoreForm.ResponseScrollChange(Sender: TObject);
var var
item, respno: integer; item, respno: integer;
begin begin
@ -218,7 +218,7 @@ begin
ScoreEdit.Text := FloatToStr(RespWghts[respno][item-1]); ScoreEdit.Text := FloatToStr(RespWghts[respno][item-1]);
end; end;
procedure TTestScoreFrm.FormActivate(Sender: TObject); procedure TTestScoreForm.FormActivate(Sender: TObject);
var var
w: Integer; w: Integer;
begin begin
@ -237,7 +237,7 @@ begin
FAutoSized := true; FAutoSized := true;
end; end;
procedure TTestScoreFrm.FormCreate(Sender: TObject); procedure TTestScoreForm.FormCreate(Sender: TObject);
begin begin
Assert(OS3MainFrm <> nil); Assert(OS3MainFrm <> nil);
@ -247,12 +247,12 @@ begin
Application.CreateForm(TGraphFrm, GraphFrm); Application.CreateForm(TGraphFrm, GraphFrm);
end; end;
procedure TTestScoreFrm.FormShow(Sender: TObject); procedure TTestScoreForm.FormShow(Sender: TObject);
begin begin
ResetBtnClick(self); ResetBtnClick(self);
end; end;
procedure TTestScoreFrm.IDInBtnClick(Sender: TObject); procedure TTestScoreForm.IDInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -264,7 +264,7 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.InBtnClick(Sender: TObject); procedure TTestScoreForm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@ -284,7 +284,7 @@ begin
ItemScroll.Max := ItemList.Items.Count; ItemScroll.Max := ItemList.Items.Count;
end; end;
procedure TTestScoreFrm.ItemScrollChange(Sender: TObject); procedure TTestScoreForm.ItemScrollChange(Sender: TObject);
var var
item, respno: integer; item, respno: integer;
begin begin
@ -311,7 +311,7 @@ begin
ScoreEdit.Text := FloatToStr(RespWghts[respno][item-1]); ScoreEdit.Text := FloatToStr(RespWghts[respno][item-1]);
end; end;
procedure TTestScoreFrm.LastInBtnClick(Sender: TObject); procedure TTestScoreForm.LastInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -324,7 +324,7 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.OutBtnClick(Sender: TObject); procedure TTestScoreForm.OutBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@ -342,7 +342,7 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTestScoreFrm.ComputeBtnClick(Sender: TObject); procedure TTestScoreForm.ComputeBtnClick(Sender: TObject);
var var
i, j, col, start, count: integer; i, j, col, start, count: integer;
cellstring: string; cellstring: string;
@ -485,12 +485,12 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.FirstChkClick(Sender: TObject); procedure TTestScoreForm.FirstChkClick(Sender: TObject);
begin begin
ItemScoringGroup.Visible := not FirstChk.Checked; ItemScoringGroup.Visible := not FirstChk.Checked;
end; end;
procedure TTestScoreFrm.FirstInBtnClick(Sender: TObject); procedure TTestScoreForm.FirstInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -503,7 +503,7 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.ItemScores; procedure TTestScoreForm.ItemScores;
var var
start, i, j, k, count, col: integer; start, i, j, k, count, col: integer;
score, denom, fract: double; score, denom, fract: double;
@ -554,7 +554,7 @@ begin
NCases := count; NCases := count;
end; end;
procedure TTestScoreFrm.ScoreReport(AReport: TStrings); procedure TTestScoreForm.ScoreReport(AReport: TStrings);
var var
i, start, count, col: integer; i, start, count, col: integer;
outline, namestr: string; outline, namestr: string;
@ -617,7 +617,7 @@ begin
AReport.Add(''); AReport.Add('');
end; end;
procedure TTestScoreFrm.Alpha(AReport: TStrings); procedure TTestScoreForm.Alpha(AReport: TStrings);
var var
i, j: integer; i, j: integer;
AlphaRel, SEMeas: double; AlphaRel, SEMeas: double;
@ -662,7 +662,7 @@ begin
AReport.Add(''); AReport.Add('');
end; end;
procedure TTestScoreFrm.Cors(AReport: TStrings); procedure TTestScoreForm.Cors(AReport: TStrings);
var var
i, j, k: integer; i, j, k: integer;
title: string; title: string;
@ -735,7 +735,7 @@ begin
end; end;
end; end;
procedure TTestScoreFrm.SimMR(AReport: TStrings); procedure TTestScoreForm.SimMR(AReport: TStrings);
var var
i, j: integer; i, j: integer;
determinant, df1, df2, StdErr, x: double; determinant, df1, df2, StdErr, x: double;
@ -842,7 +842,7 @@ begin
CorrMat := nil; CorrMat := nil;
end; end;
procedure TTestScoreFrm.Hoyt(AReport: TStrings); procedure TTestScoreForm.Hoyt(AReport: TStrings);
var var
i, j: integer; i, j: integer;
Hoyt1, Hoyt2, Hoyt3, Hoyt4, SEMeas1, SEMeas2, SEMeas3, SEMeas4: double; Hoyt1, Hoyt2, Hoyt3, Hoyt4, SEMeas1, SEMeas2, SEMeas3, SEMeas4: double;
@ -933,7 +933,7 @@ begin
AReport.Add(''); AReport.Add('');
end; end;
procedure TTestScoreFrm.StepKR(AReport: TStrings); procedure TTestScoreForm.StepKR(AReport: TStrings);
var var
i, j, col: integer; i, j, col: integer;
score, KR20, meanscore, scorevar, sumvars, hicor: double; score, KR20, meanscore, scorevar, sumvars, hicor: double;
@ -1060,12 +1060,12 @@ begin
selected := nil; selected := nil;
end; end;
procedure TTestScoreFrm.VarListSelectionChange(Sender: TObject; User: boolean); procedure TTestScoreForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
function TTestScoreFrm.PlotScores: Boolean; function TTestScoreForm.PlotScores: Boolean;
var var
rowvar: DblDyneVec; rowvar: DblDyneVec;
totscrs: DblDyneVec; totscrs: DblDyneVec;
@ -1121,7 +1121,7 @@ begin
GraphFrm.Ypoints := nil; GraphFrm.Ypoints := nil;
end; end;
function TTestScoreFrm.PlotMeans: Boolean; function TTestScoreForm.PlotMeans: Boolean;
var var
rowvar: DblDyneVec; rowvar: DblDyneVec;
i: integer; i: integer;
@ -1157,7 +1157,7 @@ begin
GraphFrm.Ypoints := nil; GraphFrm.Ypoints := nil;
end; end;
procedure TTestScoreFrm.UpdateBtnStates; procedure TTestScoreForm.UpdateBtnStates;
begin begin
InBtn.Enabled := AnySelected(VarList); InBtn.Enabled := AnySelected(VarList);
OutBtn.Enabled := AnySelected(ItemList); OutBtn.Enabled := AnySelected(ItemList);

View File

@ -70,7 +70,7 @@ inherited BartlettTestForm: TBartlettTestForm
object Label3: TLabel[7] object Label3: TLabel[7]
AnchorSideLeft.Control = SelList AnchorSideLeft.Control = SelList
AnchorSideTop.Control = ParamsPanel AnchorSideTop.Control = ParamsPanel
Left = 188 Left = 186
Height = 15 Height = 15
Top = 0 Top = 0
Width = 44 Width = 44
@ -86,14 +86,13 @@ inherited BartlettTestForm: TBartlettTestForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 188 Left = 186
Height = 282 Height = 282
Top = 17 Top = 17
Width = 124 Width = 134
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0 ItemHeight = 0
MultiSelect = True MultiSelect = True
OnDblClick = SelListDblClick OnDblClick = SelListDblClick
@ -137,10 +136,10 @@ inherited BartlettTestForm: TBartlettTestForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 140 Left = 140
Height = 25 Height = 25
Top = 77 Top = 105
Width = 40 Width = 40
AutoSize = True AutoSize = True
BorderSpacing.Top = 4 BorderSpacing.Top = 32
Caption = 'All' Caption = 'All'
OnClick = AllBtnClick OnClick = AllBtnClick
Spacing = 0 Spacing = 0

View File

@ -768,9 +768,9 @@ end;
// Menu "Analysis" > "Measurement Programs" > "Classical Test Analysis" // Menu "Analysis" > "Measurement Programs" > "Classical Test Analysis"
procedure TOS3MainFrm.mnuAnalysisMeas_ClassicalClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMeas_ClassicalClick(Sender: TObject);
begin begin
if TestScoreFrm = nil then if TestScoreForm = nil then
Application.CreateForm(TTestScoreFrm, TestScoreFrm); Application.CreateForm(TTestScoreForm, TestScoreForm);
TestScoreFrm.ShowModal; TestScoreForm.Show;
end; end;
// Menu "Analysis" > "Measurement Programs" > "Rasch Test Calibration" // Menu "Analysis" > "Measurement Programs" > "Rasch Test Calibration"

View File

@ -16,7 +16,9 @@ function CollectFilteredVecValues(AGrid: TStringGrid; AColIndex, AFilterColIndex
function CollectMatValues(AGrid: TStringGrid; AColIndices: IntDyneVec): DblDyneMat; function CollectMatValues(AGrid: TStringGrid; AColIndices: IntDyneVec): DblDyneMat;
procedure GetMinMax(AGrid: TStringGrid; AColIndex: Integer; function GetColMax(AGrid: TStringGrid; AColIndex: Integer; const AColCheck: IntDyneVec): Double;
procedure GetColMinMax(AGrid: TStringGrid; AColIndex: Integer;
const AColCheck: IntDyneVec; out AMin, AMax: Double); const AColCheck: IntDyneVec; out AMin, AMax: Double);
function GetVariableIndex(AGrid: TStringGrid; const AVarName: String): Integer; function GetVariableIndex(AGrid: TStringGrid; const AVarName: String): Integer;
@ -143,10 +145,33 @@ begin
end; end;
function GetColMax(AGrid: TStringGrid; AColIndex: Integer;
const AColCheck: IntDyneVec): Double;
var
row: Integer;
value: Double;
begin
Result := -Infinity;
for row := 1 to AGrid.RowCount-1 do
begin
if Length(AColCheck) = 0 then
begin
if not ValidValue(AGrid, row, AColIndex) then continue;
end else
begin
if not GoodRecord(AGrid, row, AColCheck) then continue;
end;
value := StrToFloat(trim(AGrid.Cells[AColIndex, row]));
if value > Result then
Result := value;
end;
end;
{ Determines the minimum and maximum of the values in the specified column of { Determines the minimum and maximum of the values in the specified column of
the grid. Rows with "invalid" data are ignored. If AColCheck contains other the grid. Rows with "invalid" data are ignored. If AColCheck contains other
column indices these cells must be "valid", too. } column indices these cells must be "valid", too. }
procedure GetMinMax(AGrid: TStringGrid; AColIndex: Integer; procedure GetColMinMax(AGrid: TStringGrid; AColIndex: Integer;
const AColCheck: IntDyneVec; out AMin, AMax: Double); const AColCheck: IntDyneVec; out AMin, AMax: Double);
var var
row: Integer; row: Integer;