You've already forked lazarus-ccr
LazStats: Refactor CompRelUnit. Add help text.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7389 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
@ -108,91 +108,74 @@ object CompRelFrm: TCompRelFrm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ResetBtn: TButton
|
object ResetBtn: TButton
|
||||||
AnchorSideRight.Control = CancelBtn
|
AnchorSideRight.Control = ComputeBtn
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 286
|
Left = 374
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 328
|
Top = 328
|
||||||
Width = 54
|
Width = 54
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 12
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 12
|
BorderSpacing.Right = 8
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Caption = 'Reset'
|
Caption = 'Reset'
|
||||||
OnClick = ResetBtnClick
|
OnClick = ResetBtnClick
|
||||||
TabOrder = 9
|
TabOrder = 9
|
||||||
end
|
end
|
||||||
object CancelBtn: TButton
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
AnchorSideBottom.Control = Owner
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 352
|
|
||||||
Height = 25
|
|
||||||
Top = 328
|
|
||||||
Width = 62
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 12
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 12
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Cancel'
|
|
||||||
ModalResult = 2
|
|
||||||
TabOrder = 10
|
|
||||||
end
|
|
||||||
object ComputeBtn: TButton
|
object ComputeBtn: TButton
|
||||||
AnchorSideRight.Control = ReturnBtn
|
AnchorSideRight.Control = CloseBtn
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 426
|
Left = 436
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 328
|
Top = 328
|
||||||
Width = 76
|
Width = 76
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 12
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 12
|
BorderSpacing.Right = 8
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Caption = 'Compute'
|
Caption = 'Compute'
|
||||||
OnClick = ComputeBtnClick
|
OnClick = ComputeBtnClick
|
||||||
TabOrder = 11
|
TabOrder = 10
|
||||||
end
|
end
|
||||||
object ReturnBtn: TButton
|
object CloseBtn: TButton
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 514
|
Left = 520
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 328
|
Top = 328
|
||||||
Width = 61
|
Width = 55
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Caption = 'Return'
|
Caption = 'Close'
|
||||||
ModalResult = 1
|
ModalResult = 11
|
||||||
TabOrder = 12
|
TabOrder = 11
|
||||||
end
|
end
|
||||||
object HelpBtn: TButton
|
object HelpBtn: TButton
|
||||||
Tag = 114
|
Tag = 114
|
||||||
AnchorSideRight.Control = ResetBtn
|
AnchorSideRight.Control = ResetBtn
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 223
|
Left = 315
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 328
|
Top = 328
|
||||||
Width = 51
|
Width = 51
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 12
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 12
|
BorderSpacing.Right = 8
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Caption = 'Help'
|
Caption = 'Help'
|
||||||
OnClick = HelpBtnClick
|
OnClick = HelpBtnClick
|
||||||
@ -202,7 +185,7 @@ object CompRelFrm: TCompRelFrm
|
|||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ReturnBtn
|
AnchorSideBottom.Control = CloseBtn
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 8
|
Height = 8
|
||||||
Top = 312
|
Top = 312
|
||||||
@ -251,6 +234,7 @@ object CompRelFrm: TCompRelFrm
|
|||||||
Constraints.MinHeight = 200
|
Constraints.MinHeight = 200
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
MultiSelect = True
|
MultiSelect = True
|
||||||
|
OnSelectionChange = ItemListSelectionChange
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object InBtn: TBitBtn
|
object InBtn: TBitBtn
|
||||||
@ -313,6 +297,8 @@ object CompRelFrm: TCompRelFrm
|
|||||||
BorderSpacing.Top = 2
|
BorderSpacing.Top = 2
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
|
MultiSelect = True
|
||||||
|
OnSelectionChange = ItemListSelectionChange
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object Bevel2: TBevel
|
object Bevel2: TBevel
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// File for testing: CompRelData.laz, use all variables
|
||||||
|
|
||||||
unit CompRelUnit;
|
unit CompRelUnit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -22,9 +24,8 @@ type
|
|||||||
OutBtn: TBitBtn;
|
OutBtn: TBitBtn;
|
||||||
AllBtn: TBitBtn;
|
AllBtn: TBitBtn;
|
||||||
ResetBtn: TButton;
|
ResetBtn: TButton;
|
||||||
CancelBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
ComputeBtn: TButton;
|
||||||
ReturnBtn: TButton;
|
CloseBtn: TButton;
|
||||||
RMatChk: TCheckBox;
|
RMatChk: TCheckBox;
|
||||||
GridScrChk: TCheckBox;
|
GridScrChk: TCheckBox;
|
||||||
GroupBox1: TGroupBox;
|
GroupBox1: TGroupBox;
|
||||||
@ -44,6 +45,7 @@ type
|
|||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure HelpBtnClick(Sender: TObject);
|
procedure HelpBtnClick(Sender: TObject);
|
||||||
procedure InBtnClick(Sender: TObject);
|
procedure InBtnClick(Sender: TObject);
|
||||||
|
procedure ItemListSelectionChange(Sender: TObject; User: boolean);
|
||||||
procedure OutBtnClick(Sender: TObject);
|
procedure OutBtnClick(Sender: TObject);
|
||||||
procedure RelListClick(Sender: TObject);
|
procedure RelListClick(Sender: TObject);
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
procedure ResetBtnClick(Sender: TObject);
|
||||||
@ -51,6 +53,7 @@ type
|
|||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FAutoSized: Boolean;
|
FAutoSized: Boolean;
|
||||||
|
procedure UpdateBtnStates;
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
@ -61,30 +64,31 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math, Utils;
|
||||||
|
|
||||||
{ TCompRelFrm }
|
{ TCompRelFrm }
|
||||||
|
|
||||||
procedure TCompRelFrm.ResetBtnClick(Sender: TObject);
|
procedure TCompRelFrm.ResetBtnClick(Sender: TObject);
|
||||||
VAR i : integer;
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
VarList.Clear;
|
VarList.Clear;
|
||||||
ItemList.Clear;
|
ItemList.Clear;
|
||||||
RelList.Clear;
|
RelList.Clear;
|
||||||
WeightList.Clear;
|
WeightList.Clear;
|
||||||
OutBtn.Enabled := false;
|
for i := 1 to NoVariables do
|
||||||
InBtn.Enabled := true;
|
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||||
for i := 1 to NoVariables do
|
UpdateBtnStates;
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.WeightListClick(Sender: TObject);
|
procedure TCompRelFrm.WeightListClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
response : string;
|
response: string;
|
||||||
index : integer;
|
index: integer;
|
||||||
begin
|
begin
|
||||||
response := InputBox('Test Weight','Test weight = ','1.0');
|
response := InputBox('Test Weight', 'Test weight:', '1.0');
|
||||||
index := WeightList.ItemIndex;
|
index := WeightList.ItemIndex;
|
||||||
WeightList.Items.Strings[index] := response;
|
WeightList.Items.Strings[index] := response;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.FormActivate(Sender: TObject);
|
procedure TCompRelFrm.FormActivate(Sender: TObject);
|
||||||
@ -94,12 +98,11 @@ begin
|
|||||||
if FAutoSized then
|
if FAutoSized then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, CancelBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||||
HelpBtn.Constraints.MinWidth := w;
|
HelpBtn.Constraints.MinWidth := w;
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
ResetBtn.Constraints.MinWidth := w;
|
||||||
CancelBtn.Constraints.MinWidth := w;
|
|
||||||
ComputeBtn.Constraints.MinWidth := w;
|
ComputeBtn.Constraints.MinWidth := w;
|
||||||
ReturnBtn.Constraints.MinWidth := w;
|
CloseBtn.Constraints.MinWidth := w;
|
||||||
|
|
||||||
w := Max(Label1.Width, Label3.Width);
|
w := Max(Label1.Width, Label3.Width);
|
||||||
VarList.Constraints.MinWidth := w;
|
VarList.Constraints.MinWidth := w;
|
||||||
@ -145,36 +148,39 @@ end;
|
|||||||
|
|
||||||
procedure TCompRelFrm.AllBtnClick(Sender: TObject);
|
procedure TCompRelFrm.AllBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i, count : integer;
|
i, count : integer;
|
||||||
cellstring : string;
|
cellstring : string;
|
||||||
begin
|
begin
|
||||||
count := VarList.Items.Count;
|
cellstring := '1.0';
|
||||||
for i := 1 to count do
|
for i := 1 to VarList.Items.Count do
|
||||||
begin
|
begin
|
||||||
ItemList.Items.Add(VarList.Items.Strings[i-1]);
|
ItemList.Items.Add(VarList.Items[i-1]);
|
||||||
cellstring := '1.0';
|
RelList.Items.Add(cellstring);
|
||||||
RelList.Items.Add(cellstring);
|
WeightList.Items.Add(cellstring);
|
||||||
WeightList.Items.Add(cellstring);
|
end;
|
||||||
end;
|
VarList.Clear;
|
||||||
VarList.Clear;
|
InBtn.Enabled := false;
|
||||||
InBtn.Enabled := false;
|
OutBtn.Enabled := true;
|
||||||
OutBtn.Enabled := true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.ComputeBtnClick(Sender: TObject);
|
procedure TCompRelFrm.ComputeBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i, j, NoVars, count, col : integer;
|
errorcode: boolean = false;
|
||||||
Rmat, RelMat : DblDyneMat;
|
i, j, NoVars, count, col: integer;
|
||||||
Weights, Reliabilities, VectProd, means, variances, stddevs : DblDyneVec;
|
Rmat, RelMat: DblDyneMat;
|
||||||
CompRel, numerator, denominator, compscore : double;
|
Weights, Reliabilities, VectProd, means, variances, stddevs: DblDyneVec;
|
||||||
colnoselected : IntDyneVec;
|
CompRel, numerator, denominator, compscore: double;
|
||||||
outline, cellstring : string;
|
colnoselected: IntDyneVec;
|
||||||
title : string;
|
outline, cellstring: string;
|
||||||
RowLabels : StrDyneVec;
|
title: string;
|
||||||
errorcode : boolean = false;
|
RowLabels: StrDyneVec;
|
||||||
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
if OutputFrm = nil then
|
if ItemList.Count = 0 then
|
||||||
Application.CreateForm(TOutputFrm, OutputFrm);
|
begin
|
||||||
|
MessageDlg('No items selected.', mtError, [mbOK], 0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
SetLength(colnoselected,NoVariables);
|
SetLength(colnoselected,NoVariables);
|
||||||
SetLength(Rmat,NoVariables+1,NoVariables+1);
|
SetLength(Rmat,NoVariables+1,NoVariables+1);
|
||||||
@ -187,7 +193,6 @@ begin
|
|||||||
SetLength(stddevs,NoVariables);
|
SetLength(stddevs,NoVariables);
|
||||||
SetLength(RowLabels,NoVariables);
|
SetLength(RowLabels,NoVariables);
|
||||||
|
|
||||||
OutputFrm.RichEdit.Clear;
|
|
||||||
// get variable col. no.s selected
|
// get variable col. no.s selected
|
||||||
NoVars := ItemList.Items.Count;
|
NoVars := ItemList.Items.Count;
|
||||||
for i := 1 to NoVars do
|
for i := 1 to NoVars do
|
||||||
@ -195,149 +200,173 @@ begin
|
|||||||
cellstring := ItemList.Items.Strings[i-1];
|
cellstring := ItemList.Items.Strings[i-1];
|
||||||
for j := 1 to NoVariables do
|
for j := 1 to NoVariables do
|
||||||
begin
|
begin
|
||||||
if (cellstring = OS3MainFrm.DataGrid.Cells[j,0]) then
|
if (cellstring = OS3MainFrm.DataGrid.Cells[j,0]) then
|
||||||
begin
|
begin
|
||||||
colnoselected[i-1] := j;
|
colnoselected[i-1] := j;
|
||||||
RowLabels[i-1] := cellstring;
|
RowLabels[i-1] := cellstring;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
count := NoCases;
|
count := NoCases;
|
||||||
|
|
||||||
OutputFrm.RichEdit.Lines.Add('Composite Test Reliability');
|
lReport := TStringList.Create;
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
try
|
||||||
outline := 'File Analyzed: ' + OS3MainFrm.FileNameEdit.Text;
|
lReport.Add('COMPOSITE TEST RELIABILITY');
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
lReport.Add('');
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
lReport.Add('File Analyzed: ' + OS3MainFrm.FileNameEdit.Text);
|
||||||
// get correlation matrix
|
lReport.Add('');
|
||||||
Correlations(NoVars,colnoselected,Rmat,means,variances,stddevs,errorcode,count);
|
|
||||||
if (errorcode) then
|
// get correlation matrix
|
||||||
ShowMessage('ERROR! Zero variance found for a variable.');
|
Correlations(NoVars, colnoselected, Rmat, means, variances, stddevs, errorcode, count);
|
||||||
if RmatChk.Checked then
|
|
||||||
begin
|
if errorcode then
|
||||||
title := 'Correlations Among Tests';
|
MessageDlg('Zero variance found for a variable.', mtError, [mbOK], 0);
|
||||||
MAT_PRINT(Rmat,NoVars,NoVars,title,RowLabels,RowLabels,count);
|
|
||||||
title := 'Means';
|
if RmatChk.Checked then
|
||||||
DynVectorPrint(means,NoVars,title,RowLabels,count);
|
begin
|
||||||
title := 'Variances';
|
title := 'Correlations Among Tests';
|
||||||
DynVectorPrint(variances,NoVars,title,RowLabels,count);
|
MatPrint(Rmat, NoVars, NoVars, title, RowLabels, RowLabels, count, lReport);
|
||||||
title := 'Standard Deviations';
|
title := 'Means';
|
||||||
DynVectorPrint(stddevs,NoVars,title,RowLabels,count);
|
DynVectorPrint(means, NoVars, title, RowLabels, count, lReport);
|
||||||
end;
|
title := 'Variances';
|
||||||
for i := 1 to NoVars do
|
DynVectorPrint(variances, NoVars, title, RowLabels, count, lReport);
|
||||||
for j := 1 to NoVars do
|
title := 'Standard Deviations';
|
||||||
|
DynVectorPrint(stddevs, NoVars, title, RowLabels, count, lReport);
|
||||||
|
end;
|
||||||
|
|
||||||
|
for i := 1 to NoVars do
|
||||||
|
for j := 1 to NoVars do
|
||||||
RelMat[i-1,j-1] := Rmat[i-1,j-1];
|
RelMat[i-1,j-1] := Rmat[i-1,j-1];
|
||||||
for i := 1 to NoVars do
|
|
||||||
begin
|
for i := 1 to NoVars do
|
||||||
Reliabilities[i-1] := StrToFloat(RelList.Items.Strings[i-1]);
|
begin
|
||||||
RelMat[i-1,i-1] := Reliabilities[i-1];
|
Reliabilities[i-1] := StrToFloat(RelList.Items.Strings[i-1]);
|
||||||
Weights[i-1] := StrToFloat(WeightList.Items.Strings[i-1]);
|
RelMat[i-1,i-1] := Reliabilities[i-1];
|
||||||
end;
|
Weights[i-1] := StrToFloat(WeightList.Items.Strings[i-1]);
|
||||||
// get numerator and denominator of composite reliability
|
end;
|
||||||
for i := 1 to NoVars do VectProd[i-1] := 0.0;
|
|
||||||
numerator := 0.0;
|
// get numerator and denominator of composite reliability
|
||||||
denominator := 0.0;
|
for i := 1 to NoVars do VectProd[i-1] := 0.0;
|
||||||
for i := 1 to NoVars do
|
numerator := 0.0;
|
||||||
for j := 1 to NoVars do
|
denominator := 0.0;
|
||||||
|
for i := 1 to NoVars do
|
||||||
|
for j := 1 to NoVars do
|
||||||
VectProd[i-1] := VectProd[i-1] + (Weights[i-1] * RelMat[j-1,i-1]);
|
VectProd[i-1] := VectProd[i-1] + (Weights[i-1] * RelMat[j-1,i-1]);
|
||||||
for i := 1 to NoVars do numerator := numerator + (VectProd[i-1] * Weights[i-1]);
|
for i := 1 to NoVars do
|
||||||
|
numerator := numerator + (VectProd[i-1] * Weights[i-1]);
|
||||||
|
|
||||||
for i := 1 to NoVars do VectProd[i-1] := 0.0;
|
for i := 1 to NoVars do
|
||||||
for i := 1 to NoVars do
|
VectProd[i-1] := 0.0;
|
||||||
for j := 1 to NoVars do
|
for i := 1 to NoVars do
|
||||||
|
for j := 1 to NoVars do
|
||||||
VectProd[i-1] := VectProd[i-1] + (Weights[i-1] * Rmat[j-1,i-1]);
|
VectProd[i-1] := VectProd[i-1] + (Weights[i-1] * Rmat[j-1,i-1]);
|
||||||
for i := 1 to NoVars do denominator := denominator +
|
for i := 1 to NoVars do
|
||||||
(VectProd[i-1] * Weights[i-1]);
|
denominator := denominator + VectProd[i-1] * Weights[i-1];
|
||||||
CompRel := numerator / denominator;
|
CompRel := numerator / denominator;
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
title := 'Test Weights';
|
|
||||||
DynVectorPrint(Weights,NoVars,title,RowLabels,count);
|
|
||||||
title := 'Test Reliabilities';
|
|
||||||
DynVectorPrint(Reliabilities,NoVars,title,RowLabels,count);
|
|
||||||
outline := format('Composite reliability = %6.3f',[CompRel]);
|
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
|
||||||
OutputFrm.ShowModal;
|
|
||||||
if GridScrChk.Checked then
|
|
||||||
begin
|
|
||||||
cellstring := 'Composite';
|
|
||||||
col := NoVariables + 1;
|
|
||||||
DictionaryFrm.NewVar(col);
|
|
||||||
DictionaryFrm.DictGrid.Cells[1,col] := cellstring;
|
|
||||||
col := NoVariables;
|
|
||||||
OS3MainFrm.DataGrid.Cells[col,0] := cellstring;
|
|
||||||
col := NoVariables;
|
|
||||||
for i := 1 to NoCases do
|
|
||||||
begin
|
|
||||||
compscore := 0.0;
|
|
||||||
if not GoodRecord(i,NoVars,ColNoSelected) then continue;
|
|
||||||
for j := 1 to NoVars do
|
|
||||||
begin
|
|
||||||
compscore := compscore + (Weights[j-1] *
|
|
||||||
StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[colnoselected[j-1],i])));
|
|
||||||
end;
|
|
||||||
OS3MainFrm.DataGrid.Cells[col,i] := FloatToStr(compscore);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
RowLabels := nil;
|
title := 'Test Weights';
|
||||||
stddevs := nil;
|
DynVectorPrint(Weights, NoVars, title, RowLabels, count, lReport);
|
||||||
variances := nil;
|
title := 'Test Reliabilities';
|
||||||
means := nil;
|
DynVectorPrint(Reliabilities, NoVars, title, RowLabels, count, lReport);
|
||||||
VectProd := nil;
|
lReport.Add('Composite reliability: %6.3f', [CompRel]);
|
||||||
Reliabilities := nil;
|
|
||||||
Weights := nil;
|
DisplayReport(lReport);
|
||||||
RelMat := nil;
|
|
||||||
Rmat := nil;
|
if GridScrChk.Checked then
|
||||||
colnoselected := nil;
|
begin
|
||||||
|
cellstring := 'Composite';
|
||||||
|
col := NoVariables + 1;
|
||||||
|
DictionaryFrm.NewVar(col);
|
||||||
|
DictionaryFrm.DictGrid.Cells[1,col] := cellstring;
|
||||||
|
col := NoVariables;
|
||||||
|
OS3MainFrm.DataGrid.Cells[col,0] := cellstring;
|
||||||
|
col := NoVariables;
|
||||||
|
for i := 1 to NoCases do
|
||||||
|
begin
|
||||||
|
compscore := 0.0;
|
||||||
|
if not GoodRecord(i, NoVars, ColNoSelected) then continue;
|
||||||
|
for j := 1 to NoVars do
|
||||||
|
compscore := compscore + (Weights[j-1] * StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[colnoselected[j-1],i])));
|
||||||
|
OS3MainFrm.DataGrid.Cells[col,i] := FloatToStr(compscore);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
finally
|
||||||
|
lReport.Free;
|
||||||
|
RowLabels := nil;
|
||||||
|
stddevs := nil;
|
||||||
|
variances := nil;
|
||||||
|
means := nil;
|
||||||
|
VectProd := nil;
|
||||||
|
Reliabilities := nil;
|
||||||
|
Weights := nil;
|
||||||
|
RelMat := nil;
|
||||||
|
Rmat := nil;
|
||||||
|
colnoselected := nil;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.InBtnClick(Sender: TObject);
|
procedure TCompRelFrm.InBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
index, i : integer;
|
i: integer;
|
||||||
cellstring : string;
|
cellstring: string;
|
||||||
begin
|
begin
|
||||||
index := VarList.Items.Count;
|
cellstring := '1.0';
|
||||||
i := 0;
|
while i < VarList.Items.Count do
|
||||||
while i < index do
|
begin
|
||||||
begin
|
if VarList.Selected[i] then
|
||||||
if (VarList.Selected[i]) then
|
begin
|
||||||
begin
|
ItemList.Items.Add(VarList.Items[i]);
|
||||||
ItemList.Items.Add(VarList.Items.Strings[i]);
|
RelList.Items.Add(cellstring);
|
||||||
cellstring := '1.0';
|
WeightList.Items.Add(cellstring);
|
||||||
RelList.Items.Add(cellstring);
|
VarList.Items.Delete(i);
|
||||||
WeightList.Items.Add(cellstring);
|
i := 0;
|
||||||
VarList.Items.Delete(i);
|
end
|
||||||
index := index - 1;
|
else
|
||||||
i := 0;
|
inc(i);
|
||||||
end
|
end;
|
||||||
else i := i + 1;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
OutBtn.Enabled := true;
|
|
||||||
|
procedure TCompRelFrm.ItemListSelectionChange(Sender: TObject; User: boolean);
|
||||||
|
begin
|
||||||
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.OutBtnClick(Sender: TObject);
|
procedure TCompRelFrm.OutBtnClick(Sender: TObject);
|
||||||
VAR index : integer;
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
index := ItemList.ItemIndex;
|
while i < ItemList.Items.Count do
|
||||||
if index < 0 then
|
begin
|
||||||
begin
|
if ItemList.Selected[i] then
|
||||||
OutBtn.Enabled := false;
|
begin
|
||||||
exit;
|
VarList.Items.Add(ItemList.Items[i]);
|
||||||
end;
|
ItemList.Items.Delete(i);
|
||||||
VarList.Items.Add(ItemList.Items.Strings[index]);
|
RelList.Items.Delete(i);
|
||||||
ItemList.Items.Delete(index);
|
WeightList.Items.Delete(i);
|
||||||
RelList.Items.Delete(index);
|
i := 0;
|
||||||
WeightList.Items.Delete(index);
|
end else
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompRelFrm.RelListClick(Sender: TObject);
|
procedure TCompRelFrm.RelListClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
response : string;
|
response: string;
|
||||||
index : integer;
|
index: integer;
|
||||||
begin
|
begin
|
||||||
response := InputBox('Reliability','Reliability estimate = ','1.0');
|
response := InputBox('Reliability', 'Reliability estimate: ', '1.0');
|
||||||
index := RelList.ItemIndex;
|
index := RelList.ItemIndex;
|
||||||
RelList.Items.Strings[index] := response;
|
RelList.Items[index] := response;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCompRelFrm.UpdateBtnStates;
|
||||||
|
begin
|
||||||
|
InBtn.Enabled := AnySelected(VarList);
|
||||||
|
OutBtn.Enabled := AnySelected(ItemList);
|
||||||
|
AllBtn.Enabled := VarList.Items.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Reference in New Issue
Block a user