LazStats: Adding original source, part 7.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7886 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-11-16 11:21:34 +00:00
parent e1c5977e0d
commit 819af1d403
102 changed files with 22802 additions and 0 deletions

View File

@ -0,0 +1,112 @@
object RandomSampFrm: TRandomSampFrm
Left = 210
Height = 166
Top = 95
Width = 400
Caption = 'Select Cases Random Sample'
ClientHeight = 166
ClientWidth = 400
OnShow = FormShow
LCLVersion = '0.9.28.2'
object GroupBox1: TGroupBox
Left = 8
Height = 92
Top = 8
Width = 380
Caption = 'Sample Size'
ClientHeight = 74
ClientWidth = 376
TabOrder = 0
object Label1: TLabel
Left = 174
Height = 14
Top = 8
Width = 55
Caption = '% of cases'
ParentColor = False
end
object Label2: TLabel
Left = 136
Height = 14
Top = 42
Width = 97
Caption = 'cases from the first '
ParentColor = False
end
object Label3: TLabel
Left = 294
Height = 14
Top = 39
Width = 32
Caption = 'cases.'
ParentColor = False
end
object ApproxBtn: TRadioButton
Left = 10
Height = 17
Top = 8
Width = 89
Caption = 'Approximately'
TabOrder = 0
end
object PcntEdit: TEdit
Left = 110
Height = 21
Top = 4
Width = 49
TabOrder = 1
Text = 'PcntEdit'
end
object ExactBtn: TRadioButton
Left = 11
Height = 17
Top = 39
Width = 55
Caption = 'Exactly'
TabOrder = 2
end
object ExactEdit: TEdit
Left = 73
Height = 21
Top = 35
Width = 56
TabOrder = 3
Text = 'ExactEdit'
end
object CasesEdit: TEdit
Left = 234
Height = 21
Top = 32
Width = 53
TabOrder = 4
Text = 'CasesEdit'
end
end
object ResetBtn: TButton
Left = 8
Height = 34
Top = 111
Width = 87
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 1
end
object CancelBtn: TButton
Left = 152
Height = 34
Top = 111
Width = 87
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
object OKBtn: TButton
Left = 301
Height = 34
Top = 112
Width = 87
Caption = 'OK'
ModalResult = 1
TabOrder = 3
end
end

View File

@ -0,0 +1,29 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRandomSampFrm','FORMDATA',[
'TPF0'#14'TRandomSampFrm'#13'RandomSampFrm'#4'Left'#3#210#0#6'Height'#3#166#0
+#3'Top'#2'_'#5'Width'#3#144#1#7'Caption'#6#26'Select Cases Random Sample'#12
+'ClientHeight'#3#166#0#11'ClientWidth'#3#144#1#6'OnShow'#7#8'FormShow'#10'LC'
+'LVersion'#6#8'0.9.28.2'#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#8#6'Height'#2
+'\'#3'Top'#2#8#5'Width'#3'|'#1#7'Caption'#6#11'Sample Size'#12'ClientHeight'
+#2'J'#11'ClientWidth'#3'x'#1#8'TabOrder'#2#0#0#6'TLabel'#6'Label1'#4'Left'#3
+#174#0#6'Height'#2#14#3'Top'#2#8#5'Width'#2'7'#7'Caption'#6#10'% of cases'#11
+'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#3#136#0#6'Height'#2#14#3'Top'
+#2'*'#5'Width'#2'a'#7'Caption'#6#21'cases from the first '#11'ParentColor'#8
+#0#0#6'TLabel'#6'Label3'#4'Left'#3'&'#1#6'Height'#2#14#3'Top'#2''''#5'Width'
+#2' '#7'Caption'#6#6'cases.'#11'ParentColor'#8#0#0#12'TRadioButton'#9'Approx'
+'Btn'#4'Left'#2#10#6'Height'#2#17#3'Top'#2#8#5'Width'#2'Y'#7'Caption'#6#13'A'
+'pproximately'#8'TabOrder'#2#0#0#0#5'TEdit'#8'PcntEdit'#4'Left'#2'n'#6'Heigh'
+'t'#2#21#3'Top'#2#4#5'Width'#2'1'#8'TabOrder'#2#1#4'Text'#6#8'PcntEdit'#0#0
+#12'TRadioButton'#8'ExactBtn'#4'Left'#2#11#6'Height'#2#17#3'Top'#2''''#5'Wid'
+'th'#2'7'#7'Caption'#6#7'Exactly'#8'TabOrder'#2#2#0#0#5'TEdit'#9'ExactEdit'#4
+'Left'#2'I'#6'Height'#2#21#3'Top'#2'#'#5'Width'#2'8'#8'TabOrder'#2#3#4'Text'
+#6#9'ExactEdit'#0#0#5'TEdit'#9'CasesEdit'#4'Left'#3#234#0#6'Height'#2#21#3'T'
+'op'#2' '#5'Width'#2'5'#8'TabOrder'#2#4#4'Text'#6#9'CasesEdit'#0#0#0#7'TButt'
+'on'#8'ResetBtn'#4'Left'#2#8#6'Height'#2'"'#3'Top'#2'o'#5'Width'#2'W'#7'Capt'
+'ion'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#1#0#0#7'TButto'
+'n'#9'CancelBtn'#4'Left'#3#152#0#6'Height'#2'"'#3'Top'#2'o'#5'Width'#2'W'#7
+'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#2#0#0#7'TButton'#5'O'
+'KBtn'#4'Left'#3'-'#1#6'Height'#2'"'#3'Top'#2'p'#5'Width'#2'W'#7'Caption'#6#2
+'OK'#11'ModalResult'#2#1#8'TabOrder'#2#3#0#0#0
]);

View File

@ -0,0 +1,60 @@
unit RandomSampUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ TRandomSampFrm }
TRandomSampFrm = class(TForm)
ResetBtn: TButton;
CancelBtn: TButton;
OKBtn: TButton;
CasesEdit: TEdit;
ExactEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
PcntEdit: TEdit;
GroupBox1: TGroupBox;
ApproxBtn: TRadioButton;
ExactBtn: TRadioButton;
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
RandomSampFrm: TRandomSampFrm;
implementation
{ TRandomSampFrm }
procedure TRandomSampFrm.FormShow(Sender: TObject);
begin
PcntEdit.Text := '';
ExactEdit.Text := '';
CasesEdit.Text := '';
ApproxBtn.Checked := true;
end;
procedure TRandomSampFrm.ResetBtnClick(Sender: TObject);
begin
FormShow(self);
end;
initialization
{$I randomsampunit.lrs}
end.

View File

@ -0,0 +1,77 @@
object RangeSelectFrm: TRangeSelectFrm
Left = 170
Height = 102
Top = 126
Width = 329
Caption = 'Select Cases for a Range of Cases'
ClientHeight = 102
ClientWidth = 329
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 32
Width = 96
Caption = 'Select Cases From: '
ParentColor = False
end
object Label2: TLabel
Left = 113
Height = 14
Top = 9
Width = 77
Caption = 'First Case Label'
ParentColor = False
end
object Label3: TLabel
Left = 232
Height = 14
Top = 9
Width = 76
Caption = 'Last Case Label'
ParentColor = False
end
object Label4: TLabel
Left = 202
Height = 14
Top = 29
Width = 11
Caption = 'to'
ParentColor = False
end
object FirstCaseEdit: TEdit
Left = 110
Height = 21
Top = 25
Width = 78
TabOrder = 0
Text = 'FirstCaseEdit'
end
object LastCaseEdit: TEdit
Left = 232
Height = 21
Top = 25
Width = 78
TabOrder = 1
Text = 'Edit1'
end
object CancelBtn: TButton
Left = 112
Height = 29
Top = 63
Width = 76
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
object OKBtn: TButton
Left = 232
Height = 29
Top = 63
Width = 76
Caption = 'OK'
ModalResult = 1
TabOrder = 3
end
end

View File

@ -0,0 +1,22 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRangeSelectFrm','FORMDATA',[
'TPF0'#15'TRangeSelectFrm'#14'RangeSelectFrm'#4'Left'#3#170#0#6'Height'#2'f'#3
+'Top'#2'~'#5'Width'#3'I'#1#7'Caption'#6'!Select Cases for a Range of Cases'
+#12'ClientHeight'#2'f'#11'ClientWidth'#3'I'#1#6'OnShow'#7#8'FormShow'#10'LCL'
+'Version'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'T'
+'op'#2' '#5'Width'#2'`'#7'Caption'#6#19'Select Cases From: '#11'ParentColor'
+#8#0#0#6'TLabel'#6'Label2'#4'Left'#2'q'#6'Height'#2#14#3'Top'#2#9#5'Width'#2
+'M'#7'Caption'#6#16'First Case Label'#11'ParentColor'#8#0#0#6'TLabel'#6'Labe'
+'l3'#4'Left'#3#232#0#6'Height'#2#14#3'Top'#2#9#5'Width'#2'L'#7'Caption'#6#15
+'Last Case Label'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#202#0#6
+'Height'#2#14#3'Top'#2#29#5'Width'#2#11#7'Caption'#6#2'to'#11'ParentColor'#8
+#0#0#5'TEdit'#13'FirstCaseEdit'#4'Left'#2'n'#6'Height'#2#21#3'Top'#2#25#5'Wi'
+'dth'#2'N'#8'TabOrder'#2#0#4'Text'#6#13'FirstCaseEdit'#0#0#5'TEdit'#12'LastC'
+'aseEdit'#4'Left'#3#232#0#6'Height'#2#21#3'Top'#2#25#5'Width'#2'N'#8'TabOrde'
+'r'#2#1#4'Text'#6#5'Edit1'#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'p'#6'Height'
+#2#29#3'Top'#2'?'#5'Width'#2'L'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8
+'TabOrder'#2#2#0#0#7'TButton'#5'OKBtn'#4'Left'#3#232#0#6'Height'#2#29#3'Top'
+#2'?'#5'Width'#2'L'#7'Caption'#6#2'OK'#11'ModalResult'#2#1#8'TabOrder'#2#3#0
+#0#0
]);

View File

@ -0,0 +1,48 @@
unit RangeSelectUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
{ TRangeSelectFrm }
TRangeSelectFrm = class(TForm)
CancelBtn: TButton;
Label4: TLabel;
OKBtn: TButton;
FirstCaseEdit: TEdit;
LastCaseEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormShow(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
RangeSelectFrm: TRangeSelectFrm;
implementation
{ TRangeSelectFrm }
procedure TRangeSelectFrm.FormShow(Sender: TObject);
begin
FirstCaseEdit.Text := '';
LastCaseEdit.Text := '';
end;
initialization
{$I rangeselectunit.lrs}
end.

View File

@ -0,0 +1,230 @@
object RaschFrm: TRaschFrm
Left = 167
Height = 340
Top = 101
Width = 605
Caption = 'Rasch One Parameter Item Scaling'
ClientHeight = 340
ClientWidth = 605
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 6
Width = 90
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
Left = 234
Height = 14
Top = 6
Width = 88
Caption = 'Selected Variables'
ParentColor = False
end
object VarList: TListBox
Left = 7
Height = 290
Top = 24
Width = 173
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 191
Height = 34
Top = 23
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 192
Height = 34
Top = 64
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object ItemList: TListBox
Left = 233
Height = 290
Top = 24
Width = 174
ItemHeight = 0
TabOrder = 3
end
object GroupBox1: TGroupBox
Left = 416
Height = 126
Top = 8
Width = 178
Caption = 'Output Options:'
ClientHeight = 108
ClientWidth = 174
TabOrder = 4
object ProxChk: TCheckBox
Left = 7
Height = 17
Top = 1
Width = 131
Caption = 'Show Prox Calculations'
TabOrder = 0
end
object PlotItemsChk: TCheckBox
Left = 7
Height = 17
Top = 22
Width = 115
Caption = 'Plot Item Difficulties'
TabOrder = 1
end
object PlotScrsChk: TCheckBox
Left = 7
Height = 17
Top = 43
Width = 97
Caption = 'Plot Log Abilities'
TabOrder = 2
end
object ItemInfoChk: TCheckBox
Left = 7
Height = 17
Top = 66
Width = 112
Caption = 'Plot Item Functions'
TabOrder = 3
end
object TestInfoChk: TCheckBox
Left = 7
Height = 17
Top = 87
Width = 163
Caption = 'Plot Test Information function'
TabOrder = 4
end
end
object ResetBtn: TButton
Left = 516
Height = 28
Top = 144
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object CancelBtn: TButton
Left = 416
Height = 31
Top = 184
Width = 80
Caption = 'Cancel'
ModalResult = 2
TabOrder = 6
end
object ComputeBtn: TButton
Left = 516
Height = 31
Top = 184
Width = 76
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 7
end
object ReturnBtn: TButton
Left = 464
Height = 31
Top = 224
Width = 80
Caption = 'Return'
ModalResult = 1
TabOrder = 8
end
object HelpBtn: TButton
Tag = 140
Left = 416
Height = 28
Top = 144
Width = 80
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 9
end
end

View File

@ -0,0 +1,140 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRaschFrm','FORMDATA',[
'TPF0'#9'TRaschFrm'#8'RaschFrm'#4'Left'#3#167#0#6'Height'#3'T'#1#3'Top'#2'e'#5
+'Width'#3']'#2#7'Caption'#6' Rasch One Parameter Item Scaling'#12'ClientHeig'
+'ht'#3'T'#1#11'ClientWidth'#3']'#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8
+'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#6#5'Wid'
+'th'#2'Z'#7'Caption'#6#19'Available Variables'#11'ParentColor'#8#0#0#6'TLabe'
+'l'#6'Label2'#4'Left'#3#234#0#6'Height'#2#14#3'Top'#2#6#5'Width'#2'X'#7'Capt'
+'ion'#6#18'Selected Variables'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4
+'Left'#2#7#6'Height'#3'"'#1#3'Top'#2#24#5'Width'#3#173#0#10'ItemHeight'#2#0
+#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#191#0#6
+'Height'#2'"'#3'Top'#2#23#5'Width'#2'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0
+'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4
+#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#1#0
+#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#192#0#6'Height'#2'"'#3'Top'#2'@'#5'Width'#2
+'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0
+#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11
+'OutBtnClick'#8'TabOrder'#2#2#0#0#8'TListBox'#8'ItemList'#4'Left'#3#233#0#6
+'Height'#3'"'#1#3'Top'#2#24#5'Width'#3#174#0#10'ItemHeight'#2#0#8'TabOrder'#2
+#3#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3#160#1#6'Height'#2'~'#3'Top'#2#8#5
+'Width'#3#178#0#7'Caption'#6#15'Output Options:'#12'ClientHeight'#2'l'#11'Cl'
+'ientWidth'#3#174#0#8'TabOrder'#2#4#0#9'TCheckBox'#7'ProxChk'#4'Left'#2#7#6
+'Height'#2#17#3'Top'#2#1#5'Width'#3#131#0#7'Caption'#6#22'Show Prox Calculat'
+'ions'#8'TabOrder'#2#0#0#0#9'TCheckBox'#12'PlotItemsChk'#4'Left'#2#7#6'Heigh'
+'t'#2#17#3'Top'#2#22#5'Width'#2's'#7'Caption'#6#22'Plot Item Difficulties'#8
+'TabOrder'#2#1#0#0#9'TCheckBox'#11'PlotScrsChk'#4'Left'#2#7#6'Height'#2#17#3
+'Top'#2'+'#5'Width'#2'a'#7'Caption'#6#18'Plot Log Abilities'#8'TabOrder'#2#2
+#0#0#9'TCheckBox'#11'ItemInfoChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#2'B'#5'W'
+'idth'#2'p'#7'Caption'#6#19'Plot Item Functions'#8'TabOrder'#2#3#0#0#9'TChec'
+'kBox'#11'TestInfoChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#2'W'#5'Width'#3#163
+#0#7'Caption'#6#30'Plot Test Information function'#8'TabOrder'#2#4#0#0#0#7'T'
+'Button'#8'ResetBtn'#4'Left'#3#4#2#6'Height'#2#28#3'Top'#3#144#0#5'Width'#2
+'N'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#5#0#0
+#7'TButton'#9'CancelBtn'#4'Left'#3#160#1#6'Height'#2#31#3'Top'#3#184#0#5'Wid'
,'th'#2'P'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#6#0#0#7'T'
+'Button'#10'ComputeBtn'#4'Left'#3#4#2#6'Height'#2#31#3'Top'#3#184#0#5'Width'
+#2'L'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2
+#7#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#208#1#6'Height'#2#31#3'Top'#3#224#0
+#5'Width'#2'P'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#8#0#0
+#7'TButton'#7'HelpBtn'#3'Tag'#3#140#0#4'Left'#3#160#1#6'Height'#2#28#3'Top'#3
+#144#0#5'Width'#2'P'#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'Ta'
+'bOrder'#2#9#0#0#0
]);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,106 @@
object RChartFrm: TRChartFrm
Left = 136
Height = 246
Top = 107
Width = 393
Caption = 'Range Charting'
ClientHeight = 246
ClientWidth = 393
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 8
Height = 14
Top = 8
Width = 90
Caption = 'Selection Variables'
ParentColor = False
end
object Label2: TLabel
Left = 151
Height = 14
Top = 26
Width = 71
Caption = 'Group Variable'
ParentColor = False
end
object Label3: TLabel
Left = 152
Height = 14
Top = 88
Width = 107
Caption = 'Measurement Variable'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 205
Top = 26
Width = 132
ItemHeight = 0
OnClick = VarListClick
TabOrder = 0
end
object GroupEdit: TEdit
Left = 151
Height = 21
Top = 40
Width = 121
TabOrder = 1
Text = 'GroupEdit'
end
object MeasEdit: TEdit
Left = 152
Height = 21
Top = 104
Width = 122
TabOrder = 2
Text = 'MeasEdit'
end
object ResetBtn: TButton
Left = 296
Height = 31
Top = 56
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object CancelBtn: TButton
Left = 296
Height = 31
Top = 104
Width = 75
Caption = 'Cancel'
ModalResult = 2
TabOrder = 4
end
object ComputeBtn: TButton
Left = 296
Height = 31
Top = 152
Width = 75
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object ReturnBtn: TButton
Left = 296
Height = 31
Top = 200
Width = 75
Caption = 'Return'
ModalResult = 1
TabOrder = 6
end
object HelpBtn: TButton
Tag = 141
Left = 296
Height = 28
Top = 12
Width = 80
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
end

View File

@ -0,0 +1,28 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRChartFrm','FORMDATA',[
'TPF0'#10'TRChartFrm'#9'RChartFrm'#4'Left'#3#136#0#6'Height'#3#246#0#3'Top'#2
+'k'#5'Width'#3#137#1#7'Caption'#6#14'Range Charting'#12'ClientHeight'#3#246#0
+#11'ClientWidth'#3#137#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9.28.2'
+#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#8#5'Width'#2'Z'#7
+'Caption'#6#19'Selection Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'
+#4'Left'#3#151#0#6'Height'#2#14#3'Top'#2#26#5'Width'#2'G'#7'Caption'#6#14'Gr'
+'oup Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#152#0#6'H'
+'eight'#2#14#3'Top'#2'X'#5'Width'#2'k'#7'Caption'#6#20'Measurement Variable'
+#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6'Height'#3#205#0#3
+'Top'#2#26#5'Width'#3#132#0#10'ItemHeight'#2#0#7'OnClick'#7#12'VarListClick'
+#8'TabOrder'#2#0#0#0#5'TEdit'#9'GroupEdit'#4'Left'#3#151#0#6'Height'#2#21#3
+'Top'#2'('#5'Width'#2'y'#8'TabOrder'#2#1#4'Text'#6#9'GroupEdit'#0#0#5'TEdit'
+#8'MeasEdit'#4'Left'#3#152#0#6'Height'#2#21#3'Top'#2'h'#5'Width'#2'z'#8'TabO'
+'rder'#2#2#4'Text'#6#8'MeasEdit'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3'('#1#6
+'Height'#2#31#3'Top'#2'8'#5'Width'#2'N'#7'Caption'#6#5'Reset'#7'OnClick'#7#13
+'ResetBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#9'CancelBtn'#4'Left'#3'('#1#6
+'Height'#2#31#3'Top'#2'h'#5'Width'#2'K'#7'Caption'#6#6'Cancel'#11'ModalResul'
+'t'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3'('#1#6'Heigh'
+'t'#2#31#3'Top'#3#152#0#5'Width'#2'K'#7'Caption'#6#7'Compute'#7'OnClick'#7#15
+'ComputeBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3'('#1
+#6'Height'#2#31#3'Top'#3#200#0#5'Width'#2'K'#7'Caption'#6#6'Return'#11'Modal'
+'Result'#2#1#8'TabOrder'#2#6#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#141#0#4'Left'
+#3'('#1#6'Height'#2#28#3'Top'#2#12#5'Width'#2'P'#7'Caption'#6#4'Help'#7'OnCl'
+'ick'#7#12'HelpBtnClick'#8'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,364 @@
unit RChartUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, MatrixLib, MainUnit, Globals,
Math, OutPutUnit, Buttons, DataProcs,
FunctionsLib, GraphLib, BlankFrmUnit, Printers, contexthelpunit;
type
{ TRChartFrm }
TRChartFrm = class(TForm)
HelpBtn: TButton;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
MeasEdit: TEdit;
GroupEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure VarListClick(Sender: TObject);
private
{ private declarations }
procedure PlotMeans(VAR means : DblDyneVec;
NoGrps : integer;
UCL, LCL, GrandMean : double;
TargetSpec, LowerSpec, UpperSpec : double;
Sender: TObject);
public
{ public declarations }
end;
var
RChartFrm: TRChartFrm;
implementation
{ TRChartFrm }
procedure TRChartFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
GroupEdit.Text := '';
MeasEdit.Text := '';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TRChartFrm.VarListClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
if GroupEdit.Text = '' then GroupEdit.Text := VarList.Items.Strings[index]
else MeasEdit.Text := VarList.Items.Strings[index];
end;
procedure TRChartFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRChartFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRChartFrm.ComputeBtnClick(Sender: TObject);
label cleanup;
var
i, j, GrpVar, MeasVar, mingrp, maxgrp, G, range, grpsize : integer;
oldgrpsize : integer;
X, UCL, LCL, Sigma, UpperSpec, LowerSpec, TargetSpec : double;
xmin, xmax, GrandMean, GrandSD, semean, D3Value, D4Value : double;
GrandRange : double;
means, stddev, ranges : DblDyneVec;
count : IntDyneVec;
cellstring, outline : string;
sizeerror : boolean;
const D3 : array[1..24] of double =
(0,0,0,0,0,0.076,0.136,0.184,0.223,0.256,0.283,0.307,0.328,
0.347,0.363,0.378,0.391,0.403,0.415,0.425,0.434,0.443,
0.451,0.459);
const D4 : array[1..24] of double =
(3.267,2.574,2.282,2.114,2.004,1.924,1.864,1.816,1.777,
1.744,1.717,1.693,1.672,1.653,1.637,1.622,1.608,1.597,
1.585,1.575,1.566,1.557,1.548,1.541);
begin
GrpVar := 1;
MeasVar := 2;
Sigma := 3.0;
UpperSpec := 0.0;
LowerSpec := 0.0;
TargetSpec := 0.0;
grpsize := 0;
oldgrpsize := 0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = GroupEdit.Text then GrpVar := i;
if cellstring = MeasEdit.Text then MeasVar := i;
end;
mingrp := 10000;
maxgrp := -10000;
for i := 1 to NoCases do
begin
G := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i])));
if G < mingrp then mingrp := G;
if G > maxgrp then maxgrp := G;
end;
range := maxgrp - mingrp + 1;
SetLength(means,range);
SetLength(count,range);
SetLength(stddev,range);
SetLength(ranges,range);
for i := 0 to range-1 do
begin
count[i] := 0;
means[i] := 0.0;
stddev[i] := 0.0;
ranges[i] := 0.0;
end;
semean := 0.0;
GrandMean := 0.0;
GrandRange := 0.0;
sizeerror := false;
// calculate group ranges, grand mean, group sd's, semeans
for j := 1 to range do // groups
begin
xmin := 10000.0;
xmax := -10000.0;
for i := 1 to NoCases do
begin
G := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i])));
G := G - mingrp + 1;
if G = j then
begin
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar,i]));
if X > xmax then xmax := X;
if X < xmin then xmin := X;
means[G-1] := means[G-1] + X;
count[G-1] := count[G-1] + 1;
stddev[G-1] := stddev[G-1] + (X * X);
semean := semean + (X * X);
GrandMean := GrandMean + X;
end;
end; // next case
ranges[j-1] := xmax - xmin;
GrandRange := GrandRange + ranges[j-1];
grpsize := count[j-1];
if j = 1 then oldgrpsize := grpsize;
if oldgrpsize <> grpsize then sizeerror := true;
end;
if (grpsize < 2) or (grpsize > 25) or (sizeerror) then
begin
ShowMessage('ERROR! Group sizes error.');
goto cleanup;
end;
for i := 0 to range-1 do
begin
stddev[i] := stddev[i] -((means[i] * means[i]) / count[i]);
stddev[i] := stddev[i] / (count[i] - 1);
stddev[i] := sqrt(stddev[i]);
means[i] := means[i] / count[i];
end;
semean := semean - ((GrandMean * GrandMean) / NoCases);
semean := semean / (NoCases - 1);
semean := sqrt(semean);
GrandSD := semean;
semean := semean / sqrt(NoCases);
GrandMean := GrandMean / NoCases;
GrandRange := GrandRange / range;
D3Value := D3[grpsize-1];
D4Value := D4[grpsize-1];
{
C4 = sqrt(2.0 / (double(grpsize)-1));
double gamma = exp(gammln(double(grpsize)/2.0));
C4 *= gamma;
gamma = exp(gammln(double(grpsize-1)/2.0));
C4 /= gamma;
}
UCL := D4Value * GrandRange;
LCL := D3Value * GrandRange;
// printed results
OutPutFrm.RichEdit.Lines.Add('X Bar Chart Results');
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Group Size Mean Range Std.Dev.');
OutPutFrm.RichEdit.Lines.Add('_____ ____ _________ _______ ________');
for i := 0 to range-1 do
begin
outline := format(' %3d %3d %8.2f %8.2f %8.2f',
[i+1,count[i],means[i],ranges[i], stddev[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := format('Grand Mean = %8.2f, Std.Dev. = %8.3f, Standard Error of Mean = %8.2f',
[GrandMean, GrandSD, semean]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Mean Range = %8.2f',[GrandRange]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Lower Control Limit = %8.3f, Upper Control Limit = %8.3f',
[LCL, UCL]);
OutPutfrm.RichEdit.Lines.Add(outline);
OutPutFrm.ShowModal;
// show graph
PlotMeans(ranges,range,UCL,LCL,GrandRange,TargetSpec,
LowerSpec, UpperSpec, self);
cleanup:
ranges := nil;
stddev := nil;
count := nil;
means := nil;
end;
procedure TRChartFrm.PlotMeans(var means: DblDyneVec; NoGrps: integer; UCL,
LCL, GrandMean: double; TargetSpec, LowerSpec, UpperSpec: double;
Sender: TObject);
var
i, xpos, ypos, hleft, hright, vtop, vbottom, imagewide : integer;
vhi, hwide, offset, strhi : integer;
imagehi, maxval, minval, valincr, Yvalue : double;
Title : string;
begin
maxval := -10000.0;
minval := 10000.0;
for i := 0 to NoGrps-1 do
begin
if means[i] > maxval then maxval := means[i];
if means[i] < minval then minval := means[i];
end;
if UCL > maxval then maxval := UCL;
if LCL < minval then minval := LCL;
BlankFrm.Image1.Canvas.Clear;
BlankFrm.Show;
Title := 'RANGE CHART FOR : ' + OS3MainFrm.FileNameEdit.Text;
BlankFrm.Caption := Title;
imagewide := BlankFrm.Image1.Width;
imagehi := BlankFrm.Image1.Height;
vtop := 20;
vbottom := round(imagehi) - 80;
vhi := vbottom - vtop;
hleft := 100;
hright := imagewide - 80;
hwide := hright - hleft;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
// Draw chart border
BlankFrm.Image1.Canvas.Rectangle(hleft,vtop-10,hleft+hwide,vtop+vhi+10);
// draw Grand Mean
ypos := round(vhi * ( (maxval - GrandMean) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'MEAN';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.Brush.Color := clLtGray;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
// draw horizontal axis
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom + 20);
BlankFrm.Image1.Canvas.LineTo(hright,vbottom + 20);
for i := 1 to NoGrps do
begin
ypos := vbottom + 10;
xpos := round((hwide / NoGrps)* i + hleft);
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := ypos + 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := format('%d',[i]);
offset := BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := xpos - offset;
ypos := ypos + strhi;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
xpos := 10;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,'GROUPS:');
end;
// Draw vertical axis
valincr := (maxval - minval) / 10.0;
for i := 1 to 11 do
begin
Title := format('%8.2f',[maxval - ((i-1)*valincr)]);
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := 10;
Yvalue := maxval - (valincr * (i-1));
ypos := round(vhi * ( (maxval - Yvalue) / (maxval - minval)));
ypos := ypos + vtop - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
// draw lines for means of the groups
ypos := round(vhi * ( (maxval - means[0]) / (maxval - minval)));
ypos := ypos + vtop;
xpos := round((hwide / NoGrps) + hleft);
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
for i := 2 to NoGrps do
begin
ypos := round(vhi * ( (maxval - means[i-1]) / (maxval - minval)));
ypos := ypos + vtop;
xpos := round((hwide / NoGrps)* i + hleft);
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
// Draw upper and lower confidence intervals
ypos := round(vhi * ( (maxval - UCL) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'UCL';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
ypos := round(vhi * ( (maxval - LCL) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'LCL';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
initialization
{$I rchartunit.lrs}
end.

View File

@ -0,0 +1,234 @@
object RecodeFrm: TRecodeFrm
Left = 219
Height = 315
Top = 105
Width = 459
Caption = 'Variable Value Recoding'
ClientHeight = 315
ClientWidth = 459
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 9
Height = 14
Top = 9
Width = 73
Caption = 'Variable Name:'
ParentColor = False
end
object varnameedit: TEdit
Left = 89
Height = 21
Top = 2
Width = 119
TabOrder = 0
Text = 'varnameedit'
end
object TargetList: TRadioGroup
Left = 9
Height = 72
Top = 32
Width = 160
AutoFill = True
Caption = 'Recode Into:'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 54
ClientWidth = 156
Items.Strings = (
'The Same Column'
'A New Column'
)
TabOrder = 1
end
object GroupBox1: TGroupBox
Left = 177
Height = 68
Top = 36
Width = 161
Caption = 'New Value:'
ClientHeight = 50
ClientWidth = 157
TabOrder = 2
object ValueBtn: TRadioButton
Left = 7
Height = 17
Top = 3
Width = 46
Caption = 'Value'
TabOrder = 0
end
object BlankBtn: TRadioButton
Left = 7
Height = 17
Top = 24
Width = 91
Caption = 'Blank or empty'
TabOrder = 1
end
object NewValEdit: TEdit
Left = 67
Height = 21
Top = 0
Width = 80
TabOrder = 2
Text = 'NewValEdit'
end
end
object GroupBox2: TGroupBox
Left = 9
Height = 186
Top = 115
Width = 329
Caption = 'Old Value:'
ClientHeight = 168
ClientWidth = 325
TabOrder = 3
object Label2: TLabel
Left = 167
Height = 14
Top = 51
Width = 42
Caption = 'through '
ParentColor = False
end
object OldValBtn: TRadioButton
Left = 8
Height = 17
Top = 0
Width = 50
Caption = 'Value:'
TabOrder = 0
end
object OldBlnkBtn: TRadioButton
Left = 9
Height = 17
Top = 24
Width = 50
Caption = 'Blanks'
TabOrder = 1
end
object RangeBtn: TRadioButton
Left = 8
Height = 17
Top = 52
Width = 84
Caption = 'Value Range:'
TabOrder = 2
end
object LowToBtn: TRadioButton
Left = 8
Height = 17
Top = 80
Width = 131
Caption = 'Lowest Value through :'
TabOrder = 3
end
object DownToBtn: TRadioButton
Left = 8
Height = 17
Top = 107
Width = 105
Caption = 'Highest Down To:'
TabOrder = 4
end
object AllButBtn: TRadioButton
Left = 8
Height = 17
Top = 135
Width = 105
Caption = 'All Values Except:'
TabOrder = 5
end
object OldValEdit: TEdit
Left = 70
Height = 21
Top = 0
Width = 87
TabOrder = 6
Text = 'OldValEdit'
end
object RangeFromEdit: TEdit
Left = 99
Height = 21
Top = 45
Width = 58
TabOrder = 7
Text = 'RangeFromEdit'
end
object RangeToEdit: TEdit
Left = 222
Height = 21
Top = 44
Width = 65
TabOrder = 8
Text = 'RangeToEdit'
end
object LowToEdit: TEdit
Left = 151
Height = 21
Top = 76
Width = 72
TabOrder = 9
Text = 'LowToEdit'
end
object HiDownToEdit: TEdit
Left = 152
Height = 21
Top = 103
Width = 70
TabOrder = 10
Text = 'HiDownToEdit'
end
object AllButEdit: TEdit
Left = 152
Height = 21
Top = 131
Width = 69
TabOrder = 11
Text = 'AllButEdit'
end
end
object ResetBtn: TButton
Left = 360
Height = 29
Top = 127
Width = 80
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 4
end
object CancelBtn: TButton
Left = 360
Height = 29
Top = 176
Width = 80
Caption = 'Cancel'
ModalResult = 2
TabOrder = 5
end
object ApplyBtn: TButton
Left = 360
Height = 29
Top = 224
Width = 80
Caption = 'Apply'
OnClick = ApplyBtnClick
TabOrder = 6
end
object ReturnBtn: TButton
Left = 360
Height = 29
Top = 272
Width = 80
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
end

View File

@ -0,0 +1,58 @@
LazarusResources.Add('TRecodeFrm','FORMDATA',[
'TPF0'#10'TRecodeFrm'#9'RecodeFrm'#4'Left'#3#219#0#6'Height'#3';'#1#3'Top'#2
+'i'#5'Width'#3#203#1#7'Caption'#6#23'Variable Value Recoding'#12'ClientHeigh'
+'t'#3';'#1#11'ClientWidth'#3#203#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8
+'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2#14#3'Top'#2#9#5'Wid'
+'th'#2'I'#7'Caption'#6#14'Variable Name:'#11'ParentColor'#8#0#0#5'TEdit'#11
+'varnameedit'#4'Left'#2'Y'#6'Height'#2#21#3'Top'#2#2#5'Width'#2'w'#8'TabOrde'
+'r'#2#0#4'Text'#6#11'varnameedit'#0#0#11'TRadioGroup'#10'TargetList'#4'Left'
+#2#9#6'Height'#2'H'#3'Top'#2' '#5'Width'#3#160#0#8'AutoFill'#9#7'Caption'#6
+#12'Recode Into:'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBot'
+'tomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildRe'
+'size'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'Chi'
+'ldSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertic'
+'al'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopT'
+'oBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2'6'#11'Clien'
+'tWidth'#3#156#0#13'Items.Strings'#1#6#15'The Same Column'#6#12'A New Column'
+#0#8'TabOrder'#2#1#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3#177#0#6'Height'#2
+'D'#3'Top'#2'$'#5'Width'#3#161#0#7'Caption'#6#10'New Value:'#12'ClientHeight'
+#2'2'#11'ClientWidth'#3#157#0#8'TabOrder'#2#2#0#12'TRadioButton'#8'ValueBtn'
+#4'Left'#2#7#6'Height'#2#17#3'Top'#2#3#5'Width'#2'.'#7'Caption'#6#5'Value'#8
+'TabOrder'#2#0#0#0#12'TRadioButton'#8'BlankBtn'#4'Left'#2#7#6'Height'#2#17#3
+'Top'#2#24#5'Width'#2'['#7'Caption'#6#14'Blank or empty'#8'TabOrder'#2#1#0#0
+#5'TEdit'#10'NewValEdit'#4'Left'#2'C'#6'Height'#2#21#3'Top'#2#0#5'Width'#2'P'
+#8'TabOrder'#2#2#4'Text'#6#10'NewValEdit'#0#0#0#9'TGroupBox'#9'GroupBox2'#4
+'Left'#2#9#6'Height'#3#186#0#3'Top'#2's'#5'Width'#3'I'#1#7'Caption'#6#10'Old'
+' Value:'#12'ClientHeight'#3#168#0#11'ClientWidth'#3'E'#1#8'TabOrder'#2#3#0#6
+'TLabel'#6'Label2'#4'Left'#3#167#0#6'Height'#2#14#3'Top'#2'3'#5'Width'#2'*'#7
+'Caption'#6#8'through '#11'ParentColor'#8#0#0#12'TRadioButton'#9'OldValBtn'#4
+'Left'#2#8#6'Height'#2#17#3'Top'#2#0#5'Width'#2'2'#7'Caption'#6#6'Value:'#8
+'TabOrder'#2#0#0#0#12'TRadioButton'#10'OldBlnkBtn'#4'Left'#2#9#6'Height'#2#17
+#3'Top'#2#24#5'Width'#2'2'#7'Caption'#6#6'Blanks'#8'TabOrder'#2#1#0#0#12'TRa'
+'dioButton'#8'RangeBtn'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'4'#5'Width'#2'T'
+#7'Caption'#6#12'Value Range:'#8'TabOrder'#2#2#0#0#12'TRadioButton'#8'LowToB'
+'tn'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'P'#5'Width'#3#131#0#7'Caption'#6#22
+'Lowest Value through :'#8'TabOrder'#2#3#0#0#12'TRadioButton'#9'DownToBtn'#4
+'Left'#2#8#6'Height'#2#17#3'Top'#2'k'#5'Width'#2'i'#7'Caption'#6#16'Highest '
+'Down To:'#8'TabOrder'#2#4#0#0#12'TRadioButton'#9'AllButBtn'#4'Left'#2#8#6'H'
+'eight'#2#17#3'Top'#3#135#0#5'Width'#2'i'#7'Caption'#6#18'All Values Except:'
+#8'TabOrder'#2#5#0#0#5'TEdit'#10'OldValEdit'#4'Left'#2'F'#6'Height'#2#21#3'T'
+'op'#2#0#5'Width'#2'W'#8'TabOrder'#2#6#4'Text'#6#10'OldValEdit'#0#0#5'TEdit'
+#13'RangeFromEdit'#4'Left'#2'c'#6'Height'#2#21#3'Top'#2'-'#5'Width'#2':'#8'T'
+'abOrder'#2#7#4'Text'#6#13'RangeFromEdit'#0#0#5'TEdit'#11'RangeToEdit'#4'Lef'
+'t'#3#222#0#6'Height'#2#21#3'Top'#2','#5'Width'#2'A'#8'TabOrder'#2#8#4'Text'
+#6#11'RangeToEdit'#0#0#5'TEdit'#9'LowToEdit'#4'Left'#3#151#0#6'Height'#2#21#3
+'Top'#2'L'#5'Width'#2'H'#8'TabOrder'#2#9#4'Text'#6#9'LowToEdit'#0#0#5'TEdit'
+#12'HiDownToEdit'#4'Left'#3#152#0#6'Height'#2#21#3'Top'#2'g'#5'Width'#2'F'#8
+'TabOrder'#2#10#4'Text'#6#12'HiDownToEdit'#0#0#5'TEdit'#10'AllButEdit'#4'Lef'
+'t'#3#152#0#6'Height'#2#21#3'Top'#3#131#0#5'Width'#2'E'#8'TabOrder'#2#11#4'T'
+'ext'#6#10'AllButEdit'#0#0#0#7'TButton'#8'ResetBtn'#4'Left'#3'h'#1#6'Height'
+#2#29#3'Top'#2#127#5'Width'#2'P'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'Reset'
+'BtnClick'#8'TabOrder'#2#4#0#0#7'TButton'#9'CancelBtn'#4'Left'#3'h'#1#6'Heig'
+'ht'#2#29#3'Top'#3#176#0#5'Width'#2'P'#7'Caption'#6#6'Cancel'#11'ModalResult'
+#2#2#8'TabOrder'#2#5#0#0#7'TButton'#8'ApplyBtn'#4'Left'#3'h'#1#6'Height'#2#29
+#3'Top'#3#224#0#5'Width'#2'P'#7'Caption'#6#5'Apply'#7'OnClick'#7#13'ApplyBtn'
+'Click'#8'TabOrder'#2#6#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3'h'#1#6'Height'
+#2#29#3'Top'#3#16#1#5'Width'#2'P'#7'Caption'#6#6'Return'#11'ModalResult'#2#1
+#8'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,250 @@
unit RecodeUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, MainUnit, Globals, DataProcs, FunctionsLib,
DictionaryUnit;
type
{ TRecodeFrm }
TRecodeFrm = class(TForm)
AllButEdit: TEdit;
ResetBtn: TButton;
CancelBtn: TButton;
ApplyBtn: TButton;
ReturnBtn: TButton;
HiDownToEdit: TEdit;
LowToEdit: TEdit;
RangeToEdit: TEdit;
Label2: TLabel;
RangeFromEdit: TEdit;
OldValEdit: TEdit;
GroupBox2: TGroupBox;
NewValEdit: TEdit;
GroupBox1: TGroupBox;
OldValBtn: TRadioButton;
OldBlnkBtn: TRadioButton;
RangeBtn: TRadioButton;
LowToBtn: TRadioButton;
DownToBtn: TRadioButton;
AllButBtn: TRadioButton;
ValueBtn: TRadioButton;
BlankBtn: TRadioButton;
TargetList: TRadioGroup;
varnameedit: TEdit;
Label1: TLabel;
procedure ApplyBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
oldcol : integer;
newplace : boolean;
newcol :integer;
public
{ public declarations }
end;
var
RecodeFrm: TRecodeFrm;
implementation
{ TRecodeFrm }
procedure TRecodeFrm.ResetBtnClick(Sender: TObject);
begin
varnameEdit.Text := '';
NewValEdit.Text := '';
OldValEdit.Text := '';
RangeFromEdit.Text := '';
RangeToEdit.Text := '';
LowToEdit.Text := '';
HiDownToEdit.Text := '';
AllButEdit.Text := '';
TargetList.ItemIndex := 0;
ValueBtn.Checked := true;
OldValBtn.Checked := true;
oldcol := OS3MainFrm.DataGrid.Col;
varnameEdit.Text := OS3MainFrm.DataGrid.Cells[oldcol,0];
newplace := false;
end;
procedure TRecodeFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRecodeFrm.ApplyBtnClick(Sender: TObject);
label gohere;
var
i, oldchoice, typedata, comparison : integer;
cellstring, oldvalue, newvalue, lowrange, hirange, upto : string;
hidown, allbut : string;
dblX1, dblX2, dblold : double;
begin
oldchoice := 0;
if newplace = true then
begin
oldcol := newcol;
goto gohere;
end;
// get target of where the recode will be placed
if TargetList.ItemIndex = 0 then
begin
newcol := oldcol;
newplace := false;
end
else begin
newplace := true;
DictionaryFrm.NewVar(NoVariables+1);
newcol := NoVariables;
cellstring := 'New' + OS3MainFrm.DataGrid.Cells[oldcol,0];
OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables);
DictionaryFrm.DictGrid.Cells[1,newcol] := cellstring;
OS3MainFrm.DataGrid.Cells[newcol,0] := cellstring;
for i := 2 to 7 do
DictionaryFrm.DictGrid.Cells[i,newcol] := DictionaryFrm.DictGrid.Cells[i,oldcol];
end;
gohere:
// get value to recode to
if ValueBtn.Checked then newvalue := NewValEdit.Text
else newvalue := '';
// get type of value and value to be recoded
if OldValBtn.Checked then
begin
oldvalue := Trim(OldValEdit.Text);
oldchoice := 1;
end;
if OldBlnkBtn.Checked then
begin
oldvalue := '';
oldchoice := 2;
end;
if RangeBtn.Checked then
begin
lowrange := Trim(RangeFromEdit.Text);
hirange := Trim(RangeToEdit.Text);
oldchoice := 3;
end;
if LowToBtn.Checked then
begin
upto := Trim(LowToEdit.Text);
oldchoice := 4;
end;
if DownToBtn.Checked then
begin
hidown := Trim(HiDownToEdit.Text);
oldchoice := 5;
end;
if AllButBtn.Checked then
begin
allbut := Trim(AllButEdit.Text);
oldchoice := 6;
end;
// Now, do the recoding
for i := 1 to NoCases do
begin
if not ValidValue(i,oldcol) then continue;
cellstring := Trim(OS3MainFrm.DataGrid.Cells[oldcol,i]);
// check for a string value. If true set datatype to string
if IsNumeric(cellstring) = false then typedata := 1
else typedata := 0; // type is string if 1 else numeric
OS3MainFrm.DataGrid.Cells[newcol,i] := cellstring;
case oldchoice of
1 : if cellstring = oldvalue then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
2 : if cellstring = '' then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
3 : begin
if typedata = 0 then // numeric
begin
dblX1 := StrToFloat(lowrange);
dblX2 := StrToFloat(hirange);
dblold := StrToFloat(cellstring);
if (dblold >= dblX1) and (dblold <= dblX2) then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end
else begin // string compare
comparison := CompareStr(cellstring,lowrange);
if comparison >= 0 then
begin
comparison := CompareStr(hirange,cellstring);
if comparison <= 0 then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end;
end;
end;
4 : begin
if typedata = 0 then // numeric
begin
dblX1 := StrToFloat(upto);
dblold := StrToFloat(cellstring);
if (dblold <= dblX1) then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end
else begin // string compare
if length(upto) = length(cellstring) then
begin
comparison := CompareStr(cellstring,upto);
if comparison <= 0 then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end;
end;
end;
5 : begin
if typedata = 0 then // numeric
begin
dblX1 := StrToFloat(hidown);
dblold := StrToFloat(cellstring);
if (dblold >= dblX1) then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end
else begin // string compare
if length(hidown) = length(cellstring) then
begin
comparison := CompareStr(cellstring,hidown);
if comparison >= 0 then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end;
end;
end;
6 : begin
if typedata = 0 then // numeric
begin
dblX1 := StrToFloat(allbut);
dblold := StrToFloat(cellstring);
if (dblold <> dblX1) then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end
else begin // string compare
if length(allbut) = length(cellstring) then
begin
comparison := CompareStr(cellstring,allbut);
if comparison <> 0 then
OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end
else OS3MainFrm.DataGrid.Cells[newcol,i] := newvalue;
end;
end;
end; // end case
FormatCell(newcol,i);
end;
end;
initialization
{$I recodeunit.lrs}
end.

View File

@ -0,0 +1,121 @@
object RelChangeFrm: TRelChangeFrm
Left = 135
Height = 230
Top = 94
Width = 291
Caption = 'Variance Change Affect on Reliability'
ClientHeight = 230
ClientWidth = 291
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 9
Height = 14
Top = 16
Width = 178
Caption = 'Reliability (r) of the reference group:'
ParentColor = False
end
object Label2: TLabel
Left = 9
Height = 14
Top = 48
Width = 181
Caption = 'Variance (s2) of the reference group:'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 14
Top = 80
Width = 155
Caption = 'Variance (S2) of the new group:'
ParentColor = False
end
object Label4: TLabel
Left = 9
Height = 14
Top = 112
Width = 201
Caption = 'Estimated reliability (R) of the new group:'
ParentColor = False
end
object OldRelEdit: TEdit
Left = 216
Height = 21
Top = 9
Width = 47
TabOrder = 0
Text = 'OldRelEdit'
end
object OldVarEdit: TEdit
Left = 216
Height = 21
Top = 41
Width = 47
TabOrder = 1
Text = 'Edit1'
end
object NewVarEdit: TEdit
Left = 216
Height = 21
Top = 73
Width = 47
TabOrder = 2
Text = 'Edit1'
end
object NewRelEdit: TEdit
Left = 216
Height = 21
Top = 105
Width = 47
TabOrder = 3
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 104
Height = 28
Top = 144
Width = 71
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 4
end
object CancelBtn: TButton
Left = 192
Height = 29
Top = 144
Width = 71
Caption = 'Cancel'
ModalResult = 2
TabOrder = 5
end
object ComputeBtn: TButton
Left = 11
Height = 32
Top = 184
Width = 78
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 6
end
object ReturnBtn: TButton
Left = 104
Height = 32
Top = 184
Width = 70
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
object HelpBtn: TButton
Tag = 142
Left = 9
Height = 28
Top = 144
Width = 80
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 8
end
end

View File

@ -0,0 +1,32 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRelChangeFrm','FORMDATA',[
'TPF0'#13'TRelChangeFrm'#12'RelChangeFrm'#4'Left'#3#135#0#6'Height'#3#230#0#3
+'Top'#2'^'#5'Width'#3'#'#1#7'Caption'#6'%Variance Change Affect on Reliabili'
+'ty'#12'ClientHeight'#3#230#0#11'ClientWidth'#3'#'#1#6'OnShow'#7#8'FormShow'
+#10'LCLVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2
+#14#3'Top'#2#16#5'Width'#3#178#0#7'Caption'#6'''Reliability (r) of the refer'
+'ence group:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#9#6'Height'
+#2#14#3'Top'#2'0'#5'Width'#3#181#0#7'Caption'#6'%Variance (s2) of the refere'
+'nce group:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#8#6'Height'
+#2#14#3'Top'#2'P'#5'Width'#3#155#0#7'Caption'#6#31'Variance (S2) of the new '
+'group:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#9#6'Height'#2#14
+#3'Top'#2'p'#5'Width'#3#201#0#7'Caption'#6'+Estimated reliability (R) of the'
+' new group:'#11'ParentColor'#8#0#0#5'TEdit'#10'OldRelEdit'#4'Left'#3#216#0#6
+'Height'#2#21#3'Top'#2#9#5'Width'#2'/'#8'TabOrder'#2#0#4'Text'#6#10'OldRelEd'
+'it'#0#0#5'TEdit'#10'OldVarEdit'#4'Left'#3#216#0#6'Height'#2#21#3'Top'#2')'#5
+'Width'#2'/'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0#0#5'TEdit'#10'NewVarEdit'#4
+'Left'#3#216#0#6'Height'#2#21#3'Top'#2'I'#5'Width'#2'/'#8'TabOrder'#2#2#4'Te'
+'xt'#6#5'Edit1'#0#0#5'TEdit'#10'NewRelEdit'#4'Left'#3#216#0#6'Height'#2#21#3
+'Top'#2'i'#5'Width'#2'/'#8'TabOrder'#2#3#4'Text'#6#5'Edit1'#0#0#7'TButton'#8
+'ResetBtn'#4'Left'#2'h'#6'Height'#2#28#3'Top'#3#144#0#5'Width'#2'G'#7'Captio'
+'n'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#4#0#0#7'TButton'
+#9'CancelBtn'#4'Left'#3#192#0#6'Height'#2#29#3'Top'#3#144#0#5'Width'#2'G'#7
+'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#5#0#0#7'TButton'#10
+'ComputeBtn'#4'Left'#2#11#6'Height'#2' '#3'Top'#3#184#0#5'Width'#2'N'#7'Capt'
+'ion'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#6#0#0#7'TB'
+'utton'#9'ReturnBtn'#4'Left'#2'h'#6'Height'#2' '#3'Top'#3#184#0#5'Width'#2'F'
+#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#7#0#0#7'TButton'#7
+'HelpBtn'#3'Tag'#3#142#0#4'Left'#2#9#6'Height'#2#28#3'Top'#3#144#0#5'Width'#2
+'P'#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#8#0#0#0
]);

View File

@ -0,0 +1,79 @@
unit RelChangeUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, contexthelpunit;
type
{ TRelChangeFrm }
TRelChangeFrm = class(TForm)
HelpBtn: TButton;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
OldRelEdit: TEdit;
OldVarEdit: TEdit;
NewVarEdit: TEdit;
NewRelEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
RelChangeFrm: TRelChangeFrm;
implementation
{ TRelChangeFrm }
procedure TRelChangeFrm.ResetBtnClick(Sender: TObject);
begin
OldRelEdit.Text := '';
NewRelEdit.Text := '';
OldVarEdit.Text := '';
NewVarEdit.Text := '';
end;
procedure TRelChangeFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRelChangeFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRelChangeFrm.ComputeBtnClick(Sender: TObject);
var
OldRel, NewRel, OldVar, NewVar : double;
begin
OldRel := StrToFloat(OldRelEdit.Text);
OldVar := StrToFloat(OldVarEdit.Text);
NewVar := StrToFloat(NewVarEdit.Text);
NewRel := 1.0 - ((OldVar / NewVar) * (1.0 - OldRel));
NewRelEdit.Text := FloatToStr(NewRel);
end;
initialization
{$I relchangeunit.lrs}
end.

View File

@ -0,0 +1,403 @@
object ResistanceLineForm: TResistanceLineForm
Left = 288
Height = 415
Top = 161
Width = 621
Caption = 'Resistant Line for Bivariate Data'
ClientHeight = 415
ClientWidth = 621
OnShow = ResetBtnClick
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 6
Height = 16
Top = 14
Width = 48
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
Left = 230
Height = 16
Top = 14
Width = 95
Caption = 'Selected Variables'
ParentColor = False
end
object Label3: TLabel
Left = 230
Height = 16
Top = 56
Width = 53
Caption = 'X Variable'
ParentColor = False
end
object Label4: TLabel
Left = 232
Height = 16
Top = 144
Width = 53
Caption = 'Y Variable'
ParentColor = False
end
object XEdit: TEdit
Left = 231
Height = 23
Top = 80
Width = 109
TabOrder = 0
Text = 'XEdit'
end
object YEdit: TEdit
Left = 232
Height = 23
Top = 168
Width = 109
TabOrder = 1
Text = 'Edit1'
end
object XInBtn: TBitBtn
Left = 184
Height = 39
Top = 56
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = XInBtnClick
TabOrder = 2
end
object YInBtn: TBitBtn
Left = 184
Height = 39
Top = 144
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = YInBtnClick
TabOrder = 3
end
object XOutBtn: TBitBtn
Left = 184
Height = 39
Top = 96
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = XOutBtnClick
TabOrder = 4
end
object YOutBtn: TBitBtn
Left = 184
Height = 39
Top = 184
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = YOutBtnClick
TabOrder = 5
end
object ResetBtn: TButton
Left = 8
Height = 28
Top = 368
Width = 75
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object CancelBtn: TButton
Left = 99
Height = 28
Top = 368
Width = 75
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object ComputeBtn: TButton
Left = 184
Height = 28
Top = 368
Width = 75
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 8
end
object ReturnBtn: TButton
Left = 272
Height = 28
Top = 368
Width = 75
Caption = 'Return'
ModalResult = 1
TabOrder = 9
end
object Memo1: TMemo
Left = 350
Height = 178
Top = 8
Width = 242
Lines.Strings = (
'The Resistant Line procedure creates'
' three equal groups by sorting on the'
' X variable and obtaining the median'
' value of each group.'
'The median values for these three '
'groups on both the X and Y variables'
' are then plotted. The line from the'
' low group median to the middle'
' group median is plotted as well as'
' the line from the middle group to'
' the top group median. A comparison'
' of the slope of these two lines gives '
'an indication of the degree towhich'
' the data fit a straight line. '
'Enter the X and Y variables to be'
' analyzed and click the compute '
'button.'
)
ScrollBars = ssVertical
TabOrder = 10
end
object GroupBox1: TGroupBox
Left = 360
Height = 169
Top = 200
Width = 216
Caption = 'Options'
ClientHeight = 151
ClientWidth = 212
TabOrder = 11
Visible = False
object Label5: TLabel
Left = 27
Height = 16
Top = 120
Width = 75
Caption = '% Confidence'
ParentColor = False
end
object DescChk: TCheckBox
Left = 9
Height = 19
Top = 24
Width = 155
Caption = 'Print Descriptive Statistics'
TabOrder = 0
end
object ConfEdit: TEdit
Left = 107
Height = 23
Top = 113
Width = 57
TabOrder = 1
Text = '95.0'
end
object LineChk: TCheckBox
Left = 9
Height = 19
Top = 48
Width = 146
Caption = 'Plot the Regression Line'
TabOrder = 2
end
object MeansChk: TCheckBox
Left = 9
Height = 19
Top = 72
Width = 99
Caption = 'Plot the Means'
TabOrder = 3
end
object ConfChk: TCheckBox
Left = 9
Height = 19
Top = 96
Width = 155
Caption = 'Plot the Confidence Band'
TabOrder = 4
end
object PointsChk: TCheckBox
Left = 9
Height = 19
Top = 0
Width = 153
Caption = 'Plot All of the points First'
TabOrder = 5
end
end
object VarList: TListBox
Left = 6
Height = 253
Top = 32
Width = 168
ItemHeight = 0
TabOrder = 12
end
object StdCorChk: TCheckBox
Left = 8
Height = 19
Top = 288
Width = 330
Caption = 'Option: Compute a standard product-moment correlation.'
OnChange = StdCorChkChange
TabOrder = 13
end
object PlotMediansChk: TCheckBox
Left = 8
Height = 19
Top = 313
Width = 266
Caption = 'Plot the Three Medians and Slope Line (in Red)'
TabOrder = 14
end
object GridChk: TCheckBox
Left = 8
Height = 19
Top = 340
Width = 248
Caption = 'Enter Predicted Y and Residual Y in the Grid'
TabOrder = 15
end
end

View File

@ -0,0 +1,267 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TResistanceLineForm','FORMDATA',[
'TPF0'#19'TResistanceLineForm'#18'ResistanceLineForm'#4'Left'#3' '#1#6'Height'
+#3#159#1#3'Top'#3#161#0#5'Width'#3'm'#2#7'Caption'#6'!Resistant Line for Biv'
+'ariate Data'#12'ClientHeight'#3#159#1#11'ClientWidth'#3'm'#2#6'OnShow'#7#13
+'ResetBtnClick'#10'LCLVersion'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#6
+#6'Height'#2#16#3'Top'#2#14#5'Width'#2'0'#7'Caption'#6#9'Variables'#11'Paren'
+'tColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#3#230#0#6'Height'#2#16#3'Top'#2#14
+#5'Width'#2'_'#7'Caption'#6#18'Selected Variables'#11'ParentColor'#8#0#0#6'T'
+'Label'#6'Label3'#4'Left'#3#230#0#6'Height'#2#16#3'Top'#2'8'#5'Width'#2'5'#7
+'Caption'#6#10'X Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'
+#3#232#0#6'Height'#2#16#3'Top'#3#144#0#5'Width'#2'5'#7'Caption'#6#10'Y Varia'
+'ble'#11'ParentColor'#8#0#0#5'TEdit'#5'XEdit'#4'Left'#3#231#0#6'Height'#2#23
+#3'Top'#2'P'#5'Width'#2'm'#8'TabOrder'#2#0#4'Text'#6#5'XEdit'#0#0#5'TEdit'#5
+'YEdit'#4'Left'#3#232#0#6'Height'#2#23#3'Top'#3#168#0#5'Width'#2'm'#8'TabOrd'
+'er'#2#1#4'Text'#6#5'Edit1'#0#0#7'TBitBtn'#6'XInBtn'#4'Left'#3#184#0#6'Heigh'
+'t'#2''''#3'Top'#2'8'#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'
+#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0
+'d'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'
+#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'
+#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255
+#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255#148#208
+#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'
+#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255
+#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158#214#167
+#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202
+#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'
+#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'
+#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
,#9'NumGlyphs'#2#0#7'OnClick'#7#11'XInBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'
+#6'YInBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#3#144#0#5'Width'#2'&'#10'G'
+'lyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0
+#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184
+'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255
+';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'
+#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255
+#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147
+#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'
+#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218
+#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147
+#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255
+'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'
+#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'
+#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'
+#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'YInBtnCl'
+'ick'#8'TabOrder'#2#3#0#0#7'TBitBtn'#7'XOutBtn'#4'Left'#3#184#0#6'Height'#2
+''''#3'Top'#2'`'#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0
+#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0
+#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'
+#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217
+'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193
+#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'
+#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255
+#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157
+#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195
+#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0
+#255#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255
+#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144
+#255#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'
+#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153
+'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#12'XOutBtnClick'#8'TabOrder'#2#4#0#0#7
+'TBitBtn'#7'YOutBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#3#184#0#5'Width'
+#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0
+#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
,#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#12
+'YOutBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#8'ResetBtn'#4'Left'#2#8#6'Heig'
+'ht'#2#28#3'Top'#3'p'#1#5'Width'#2'K'#7'Caption'#6#5'Reset'#7'OnClick'#7#13
+'ResetBtnClick'#8'TabOrder'#2#6#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'c'#6'H'
+'eight'#2#28#3'Top'#3'p'#1#5'Width'#2'K'#6'Cancel'#9#7'Caption'#6#6'Cancel'
+#11'ModalResult'#2#2#8'TabOrder'#2#7#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3
+#184#0#6'Height'#2#28#3'Top'#3'p'#1#5'Width'#2'K'#7'Caption'#6#7'Compute'#7
+'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#8#0#0#7'TButton'#9'ReturnBtn'#4
+'Left'#3#16#1#6'Height'#2#28#3'Top'#3'p'#1#5'Width'#2'K'#7'Caption'#6#6'Retu'
+'rn'#11'ModalResult'#2#1#8'TabOrder'#2#9#0#0#5'TMemo'#5'Memo1'#4'Left'#3'^'#1
+#6'Height'#3#178#0#3'Top'#2#8#5'Width'#3#242#0#13'Lines.Strings'#1#6'$The Re'
+'sistant Line procedure creates'#6'% three equal groups by sorting on the'#6
+'$ X variable and obtaining the median'#6#21' value of each group.'#6'"The m'
+'edian values for these three '#6'$groups on both the X and Y variables'#6'%'
+' are then plotted. The line from the'#6#31' low group median to the middle'
+#6'# group median is plotted as well as'#6'" the line from the middle group '
+'to'#6'$ the top group median. A comparison'#6''' of the slope of these two'
+' lines gives '#6'#an indication of the degree towhich'#6' the data fit a s'
+'traight line. '#6'!Enter the X and Y variables to be'#6' analyzed and cli'
+'ck the compute '#6#7'button.'#0#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'
+#2#10#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3'h'#1#6'Height'#3#169#0#3'Top'#3
+#200#0#5'Width'#3#216#0#7'Caption'#6#7'Options'#12'ClientHeight'#3#151#0#11
+'ClientWidth'#3#212#0#8'TabOrder'#2#11#7'Visible'#8#0#6'TLabel'#6'Label5'#4
+'Left'#2#27#6'Height'#2#16#3'Top'#2'x'#5'Width'#2'K'#7'Caption'#6#12'% Confi'
+'dence'#11'ParentColor'#8#0#0#9'TCheckBox'#7'DescChk'#4'Left'#2#9#6'Height'#2
+#19#3'Top'#2#24#5'Width'#3#155#0#7'Caption'#6#28'Print Descriptive Statistic'
+'s'#8'TabOrder'#2#0#0#0#5'TEdit'#8'ConfEdit'#4'Left'#2'k'#6'Height'#2#23#3'T'
+'op'#2'q'#5'Width'#2'9'#8'TabOrder'#2#1#4'Text'#6#4'95.0'#0#0#9'TCheckBox'#7
+'LineChk'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'0'#5'Width'#3#146#0#7'Caption'
+#6#24'Plot the Regression Line'#8'TabOrder'#2#2#0#0#9'TCheckBox'#8'MeansChk'
+#4'Left'#2#9#6'Height'#2#19#3'Top'#2'H'#5'Width'#2'c'#7'Caption'#6#14'Plot t'
+'he Means'#8'TabOrder'#2#3#0#0#9'TCheckBox'#7'ConfChk'#4'Left'#2#9#6'Height'
+#2#19#3'Top'#2'`'#5'Width'#3#155#0#7'Caption'#6#24'Plot the Confidence Band'
+#8'TabOrder'#2#4#0#0#9'TCheckBox'#9'PointsChk'#4'Left'#2#9#6'Height'#2#19#3
+'Top'#2#0#5'Width'#3#153#0#7'Caption'#6#28'Plot All of the points First'#8'T'
+'abOrder'#2#5#0#0#0#8'TListBox'#7'VarList'#4'Left'#2#6#6'Height'#3#253#0#3'T'
+'op'#2' '#5'Width'#3#168#0#10'ItemHeight'#2#0#8'TabOrder'#2#12#0#0#9'TCheckB'
+'ox'#9'StdCorChk'#4'Left'#2#8#6'Height'#2#19#3'Top'#3' '#1#5'Width'#3'J'#1#7
,'Caption'#6'6Option: Compute a standard product-moment correlation.'#8'OnCha'
+'nge'#7#15'StdCorChkChange'#8'TabOrder'#2#13#0#0#9'TCheckBox'#14'PlotMedians'
+'Chk'#4'Left'#2#8#6'Height'#2#19#3'Top'#3'9'#1#5'Width'#3#10#1#7'Caption'#6
+'.Plot the Three Medians and Slope Line (in Red)'#8'TabOrder'#2#14#0#0#9'TCh'
+'eckBox'#7'GridChk'#4'Left'#2#8#6'Height'#2#19#3'Top'#3'T'#1#5'Width'#3#248#0
+#7'Caption'#6',Enter Predicted Y and Residual Y in the Grid'#8'TabOrder'#2#15
+#0#0#0
]);

View File

@ -0,0 +1,706 @@
unit ResistanceLineUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, Math, functionsLib, OutPutUnit, DataProcs,
DictionaryUnit, contexthelpunit, BlankFrmUnit, Printers;
type
{ TResistanceLineForm }
TResistanceLineForm = class(TForm)
GridChk: TCheckBox;
PlotMediansChk: TCheckBox;
StdCorChk: TCheckBox;
PointsChk: TCheckBox;
ConfChk: TCheckBox;
ConfEdit: TEdit;
DescChk: TCheckBox;
GroupBox1: TGroupBox;
Label5: TLabel;
LineChk: TCheckBox;
VarList: TListBox;
MeansChk: TCheckBox;
Memo1: TMemo;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
XInBtn: TBitBtn;
YInBtn: TBitBtn;
XOutBtn: TBitBtn;
YOutBtn: TBitBtn;
XEdit: TEdit;
YEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure ComputeBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure StdCorChkChange(Sender: TObject);
procedure XInBtnClick(Sender: TObject);
procedure XOutBtnClick(Sender: TObject);
procedure YInBtnClick(Sender: TObject);
procedure YOutBtnClick(Sender: TObject);
private
{ private declarations }
function Median(VAR X : DblDyneVec; size : integer) : double;
procedure plotxy(VAR Xpoints : DblDyneVec;
VAR Ypoints : DblDyneVec;
VAR UpConf : DblDyneVec;
VAR LowConf : DblDyneVec;
ConfBand : double;
Xmean, Ymean , R : double;
Slope, Intercept : double;
Xmax, Xmin, Ymax, Ymin : double;
N : integer; PlotNo : integer);
public
{ public declarations }
end;
var
ResistanceLineForm: TResistanceLineForm;
implementation
{ TResistanceLineForm }
procedure TResistanceLineForm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
StdCorChk.Checked := false;
GridChk.Checked := false;
PlotMediansChk.Checked := false;
XEdit.Text := '';
YEdit.Text := '';
XOutBtn.Visible := false;
YOutBtn.Visible := false;
XInBtn.Visible := true;
YinBtn.Visible := true;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TResistanceLineForm.StdCorChkChange(Sender: TObject);
begin
if StdCorChk.Checked then GroupBox1.Visible := true else GroupBox1.Visible := false;
end;
procedure TResistanceLineForm.ComputeBtnClick(Sender: TObject);
var
XYPoints : DblDyneMat;
XYMedians : DblDyneMat;
XMedians : DblDyneVec;
YMedians : DblDyneVec;
XVector, YVector : DblDyneVec;
cellstring, outline : string;
ColNoSelected : IntDyneVec;
UpConf : DblDyneVec;
lowConf : DblDyneVec;
GrpSize : IntDyneVec;
Xcol, Ycol, N, NoSelected, i, j, size, size1, size2, size3 : integer;
X, Y, tempX, tempY : double;
Xmin, Xmax, Ymin, Ymax, SSx, t, DF : double;
Xmean, Ymean, Xvariance, Yvariance, Xstddev, Ystddev, ConfBand : double;
R, temp, SEPred, Slope, Intercept, predicted, sedata : double;
intercept1, intercept2, slope1, slope2 : double;
c, c1, c2, c3 : double; // constants obtained from control points
begin
SetLength(XYPoints,NoCases,NoCases);
SetLength(XYMedians,3,3);
SetLength(XMedians,3);
SetLength(YMedians,3);
SetLength(XVector,NoCases);
SetLength(YVector,NoCases);
SetLength(ColNoSelected,NoVariables);
SetLength(UpConf,NoCases + 1);
SetLength(lowConf,NoCases + 1);
SetLength(GrpSize,3);
Xcol := 0;
Ycol := 0;
Xmax := -1.0e20;
Xmin := 1.0e20;
Ymax := -1.0e20;
Ymin := 1.0e20;
Xmean := 0.0;
Ymean := 0.0;
Xvariance := 0.0;
Yvariance := 0.0;
R := 0.0;
OutPutFrm.RichEdit.Clear;
for i := 1 to Novariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = XEdit.Text then Xcol := i;
if cellstring = YEdit.Text then Ycol := i;
end;
NoSelected := 2;
ColNoSelected[0] := Xcol;
ColNoSelected[1] := Ycol;
N := 0;
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[Xcol,i]));
Y := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[Ycol,i]));
if X > Xmax then Xmax := X;
if X < Xmin then Xmin := X;
if Y > Ymax then Ymax := Y;
if Y < Ymin then Ymin := Y;
Xmean := Xmean + X;
Ymean := Ymean + Y;
Xvariance := Xvariance + (X * X);
Yvariance := Yvariance + (Y * Y);
R := R + (X * Y);
XYPoints[N,0] := X;
XYPoints[N,1] := Y;
N := N+1;
end;
// sort on X values
for i := 0 to N-2 do
begin
for j := i + 1 to N-1 do
begin
if XYPoints[i,0] > XYPoints[j,0] then // swap
begin
tempX := XYPoints[i,0];
tempY := XYPoints[i,1];
XYPoints[i,0] := XYPoints[j,0];
XYPoints[i,1] := XYPoints[j,1];
XYPoints[j,0] := tempX;
XYPoints[j,1] := tempY;
end;
end;
end;
// calculate statistics
Xvariance := Xvariance - (Xmean * Xmean / N);
SSx := Xvariance;
Xvariance := Xvariance / (N - 1);
Xstddev := sqrt(Xvariance);
Yvariance := Yvariance - (Ymean * Ymean / N);
Yvariance := Yvariance / (N - 1);
Ystddev := sqrt(Yvariance);
R := R - (Xmean * Ymean / N);
R := R / (N - 1);
R := R / (Xstddev * Ystddev);
SEPred := sqrt(1.0 - (R * R)) * Ystddev;
SEPred := SEPred * sqrt((N - 1) / (N - 2));
Xmean := Xmean / N;
Ymean := Ymean / N;
Slope := R * Ystddev / Xstddev;
Intercept := Ymean - Slope * Xmean;
// Now, print the descriptive statistics if requested
if DescChk.Checked then
begin
OutPutFrm.RichEdit.Lines.Add('Original X versus Y Plot Data');
OutPutFrm.RichEdit.Lines.Add('');
outline := format('X = %s, Y = %s from file: %s',[Xedit.Text,
YEdit.Text,OS3MainFrm.FileNameEdit.Text]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Variable Mean Variance Std.Dev.');
outline := format('%-10s%8.2f %8.2f %8.2f',
[XEdit.Text,Xmean,Xvariance,Xstddev]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('%-10s%8.2f %8.2f %8.2f',
[YEdit.Text,Ymean,Yvariance,Ystddev]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Correlation = %6.4f, Slope = %8.2f, Intercept = %8.2f',
[R, Slope, Intercept]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Standard Error of Estimate = %8.2f',[SEPred]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Number of good cases = %d',[N]);
OutPutFrm.RichEdit.Lines.Add(outline);
// OutPutFrm.ShowModal;
end;
// get upper and lower confidence points for each X value
if ConfChk.Checked then
begin
ConfBand := StrToFloat(ConfEdit.Text) / 100.0;
DF := N - 2;
t := inverset(ConfBand,DF);
for i := 1 to N do
begin
X := XYpoints[i-1,0];
predicted := slope * X + intercept;
sedata := SEPred * sqrt(1.0 + (1.0 / N) + (sqr(X - Xmean) / SSx));
UpConf[i] := predicted + (t * sedata);
lowConf[i] := predicted - (t * sedata);
if UpConf[i] > Ymax then Ymax := UpConf[i];
if lowConf[i] < Ymin then Ymin := lowConf[i];
end;
end
else ConfBand := 0.0;
// plot the values (and optional line and confidence band if elected)
if PointsChk.Checked then
begin
for i := 0 to N-1 do
begin
XVector[i] := XYPoints[i,0];
YVector[i] := XYPoints[i,1];
end;
plotxy(XVector, YVector, UpConf, LowConf, ConfBand, Xmean, Ymean, R,
Slope, Intercept, Xmax, Xmin, Ymax, Ymin, N, 1);
end;
LineChk.Checked := false;
ConfChk.Checked := false;
ConfBand := 0.0;
OutPutFrm.RichEdit.Lines.Add('');
// Now do the resistant line analysis
// obtain 1/3 size
size := n div 3;
size1 := size;
size3 := size;
size2 := n - size1 - size3;
GrpSize[0] := size1;
GrpSize[1] := size2;
GrpSize[2] := size3;
OutPutFrm.RichEdit.Lines.Add('');
// get median for each group of x and y values
// first group:
for i := 0 to size1-1 do
begin
XVector[i] := XYPoints[i,0];
YVector[i] := XYPoints[i,1];
end;
XMedians[0] := Median(XVector,size1);
YMedians[0] := Median(YVector,size1);
OutPutFrm.RichEdit.Lines.Add('');
// second group
j := 0;
for i := size1 to size1 + size2 - 1 do
begin
XVector[j] := XYPoints[i,0];
YVector[j] := XYPoints[i,1];
j := j + 1;
end;
XMedians[1] := Median(XVector,size2);
YMedians[1] := Median(YVector,size2);
OutPutFrm.RichEdit.Lines.Add('');
// third group
j := 0;
for i := (size1 + size2) to N-1 do
begin
XVector[j] := XYPoints[i,0];
YVector[j] := XYPoints[i,1];
j := j + 1;
end;
XMedians[2] := Median(XVector,size3);
YMedians[2] := Median(YVector,size3);
// OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Group X Median Y Median Size');
for i := 0 to 2 do
begin
outline := format('%3d %5.3f %5.3f %d',
[i+1,XMedians[i],YMedians[i], GrpSize[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
slope1 := (YMedians[1] - YMedians[0]) / (XMedians[1] - XMedians[0]);
slope2 := (YMedians[2] - YMedians[1]) / (XMedians[2] - XMedians[1]);
outline := format('Half Slopes = %9.3f and %9.3f',[slope1,slope2]);
OutPutFrm.RichEdit.Lines.Add(outline);
Slope := (YMedians[2] - YMedians[0]) / (XMedians[2] - XMedians[0]);
outline := format('Slope = %9.3f',[Slope]);
OutPutFrm.RichEdit.Lines.Add(outline);
tempx := slope2 / slope1;
outline := format('Ratio of half slopes = %9.3f',[tempx]);
OutPutFrm.RichEdit.Lines.Add(outline);
// obtain estimate of the constant for the prediction equation
c1 := slope * XMedians[0] - YMedians[0];
c2 := slope * XMedians[1] - YMedians[1];
c3 := slope * XMedians[2] - YMedians[2];
c := (c1 + c2 + c3) / 3.0;
outline := format('Equation: y := %9.3f * X + (%9.3f)',[slope,c]);
OutPutFrm.RichEdit.Lines.Add(outline);
if GridChk.Checked then
begin
// Get the residuals (Y - predicted Y) for each X value and place in the grid
outline := 'Pred.';
outline := outline + OS3MainFrm.DataGrid.Cells[Ycol,0];
DictionaryFrm.NewVar(NoVariables+1);
DictionaryFrm.DictGrid.Cells[1,NoVariables] := outline;
OS3MainFrm.DataGrid.Cells[NoVariables,0] := outline;
outline := 'Residual';
DictionaryFrm.NewVar(NoVariables+1);
DictionaryFrm.DictGrid.Cells[1,NoVariables] := outline;
OS3MainFrm.DataGrid.Cells[NoVariables,0] := outline;
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[Xcol,i]));
Y := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[Ycol,i]));
if c >= 0 then predicted := slope * X + c
else predicted := slope * X - c;
Y := Y - predicted; // residual
outline := format('%9.3f',[predicted]);
OS3MainFrm.DataGrid.Cells[NoVariables-1,i] := outline;
outline := format('%9.3f',[Y]);
OS3MainFrm.DataGrid.Cells[NoVariables,i] := outline;
end;
end;
OutPutFrm.ShowModal;
// plot the values (and optional line and confidence band if elected)
if PlotMediansChk.Checked then
plotxy(XMedians, YMedians, UpConf, LowConf, ConfBand, Xmean, Ymean, R,
Slope, Intercept, Xmax, Xmin, Ymax, Ymin, 3, 2);
// OutPutFrm.ShowModal;
// cleanup
GrpSize := nil;
LowConf := nil;
UpConf := nil;
ColNoSelected := nil;
YVector := nil;
XVector := nil;
YMedians := nil;
XMedians := nil;
XYMedians := nil;
XYPoints := nil;
end;
procedure TResistanceLineForm.XInBtnClick(Sender: TObject);
var
index : integer;
begin
index := VarList.ItemIndex;
XEdit.Text := VarList.items.Strings[index];
VarList.Items.Delete(index);
XOutBtn.Visible := true;
XInBtn.Visible := false;
end;
procedure TResistanceLineForm.XOutBtnClick(Sender: TObject);
begin
VarList.Items.Add(XEdit.Text);
XEdit.Text := '';
XInBtn.Visible := true;
XOutBtn.Visible := false;
end;
procedure TResistanceLineForm.YInBtnClick(Sender: TObject);
var index : integer;
begin
index := VarList.ItemIndex;
YEdit.Text := VarList.items.Strings[index];
VarList.Items.Delete(index);
YOutBtn.Visible := true;
YInBtn.Visible := false;
end;
procedure TResistanceLineForm.YOutBtnClick(Sender: TObject);
begin
VarList.Items.Add(YEdit.Text);
YEdit.Text := '';
YInBtn.Visible := true;
YOutBtn.Visible := false;
end;
function TResistanceLineForm.Median(VAR X : DblDyneVec; size : integer) : double;
var
midpt : integer;
value : double;
i, j : integer;
cellstring : string;
begin
// sort values
for i := 0 to size-2 do
begin
for j := i + 1 to size-1 do
begin
if X[i] > X[j] then // swap
begin
value := X[i];
X[i] := X[j];
X[j] := value;
end;
end;
end;
(*
// check for correct median calculation
OutPutFrm.RichEdit.Lines.Add('Sorted values to get median');
cellstring := format('size of array = %d',[size]);
OutPutFrm.RichEdit.Lines.Add(cellstring);
for i := 0 to size-1 do
begin
cellstring := format('no. %d = %9.3f',[i+1,X[i]]);
OutPutFrm.RichEdit.Lines.Add(cellstring);
end;
*)
if size > 2 then
begin
midpt := size div 2;
// cellstring := format('midpt = %d',[midpt]);
// OutPutFrm.RichEdit.Lines.Add(cellstring);
if 2 * midpt = size then // even no. of values
begin
value := (X[midpt-1] + X[midpt]) / 2;
end
else value := X[midpt]; // odd no. of values
Median := value;
end
else if size = 2 then Median := (X[0] + X[1]) / 2;
// cellstring := format('Median = %9.3f',[value]);
// OutPutFrm.ShowModal;
end;
procedure TResistanceLineForm.plotxy(VAR Xpoints : DblDyneVec;
VAR Ypoints : DblDyneVec;
VAR UpConf : DblDyneVec;
VAR LowConf : DblDyneVec;
ConfBand : double;
Xmean, Ymean , R : double;
Slope, Intercept : double;
Xmax, Xmin, Ymax, Ymin : double;
N : integer; PlotNo : integer);
var
i, xpos, ypos, hleft, hright, vtop, vbottom, imagewide : integer;
vhi, hwide, offset, strhi, imagehi : integer;
maxval, minval, valincr, Yvalue, Xvalue : double;
Title : string;
YU,YL, XU, XL : double;
begin
BlankFrm.Image1.Canvas.Clear;
if PlotNo = 1 then
begin
Title := 'X versus Y PLOT Using File: ' + OS3MainFrm.FileNameEdit.Text;
BlankFrm.Caption := Title;
end
else
begin
Title := 'Median Plot for three groups';
BlankFrm.Caption := Title;
end;
imagewide := BlankFrm.Image1.Width;
imagehi := BlankFrm.Image1.Height;
vtop := 20;
vbottom := round(imagehi) - 80;
vhi := vbottom - vtop;
hleft := 100;
hright := imagewide - 80;
hwide := hright - hleft;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
// Draw chart border
BlankFrm.Image1.Canvas.Rectangle(0,0,imagewide,imagehi);
// end;
// draw Means
if MeansChk.Checked then
begin
ypos := round(vhi * ( (Ymax - Ymean) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clGreen;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'MEAN ';
Title := Title + YEdit.Text;
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
xpos := round(hwide * ( (Xmean - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
ypos := vtop;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := vbottom;
BlankFrm.Image1.Canvas.Pen.Color := clGreen;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'MEAN ';
Title := Title + XEdit.Text;
strhi := BlankFrm.Image1.Canvas.TextWidth(Title);
xpos := xpos - strhi div 2;
ypos := vtop - BlankFrm.Image1.Canvas.TextHeight(Title);
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
// draw slope line
if LineChk.Checked then
begin
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
Yvalue := (Xpoints[0] * slope) + intercept; // predicted score
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[0]- Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
Yvalue := (Xpoints[N-1] * slope) + intercept; // predicted score
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[N-1] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
// draw horizontal axis
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom);
BlankFrm.Image1.Canvas.LineTo(hright,vbottom);
valincr := (Xmax - Xmin) / 10.0;
for i := 1 to 11 do
begin
ypos := vbottom;
Xvalue := Xmin + valincr * (i - 1);
xpos := round(hwide * ((Xvalue - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := ypos + 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := format('%6.2f',[Xvalue]);
offset := BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
xpos := xpos - offset;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
if PlotNo = 1 then
begin
xpos := hleft + (hwide div 2) - (BlankFrm.Image1.Canvas.TextWidth(XEdit.Text) div 2);
ypos := vbottom + 20;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,XEdit.Text);
Title := format('R(X,Y) = %5.3f, Slope = %6.2f, Intercept = %6.2f',
[R,Slope,Intercept]);
xpos := hleft + (hwide div 2) - (BlankFrm.Image1.Canvas.TextWidth(Title) div 2);
ypos := ypos + 15;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
// Draw vertical axis
Title := YEdit.Text;
xpos := hleft - BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
ypos := vtop - BlankFrm.Image1.Canvas.TextHeight(Title);
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,YEdit.Text);
xpos := hleft;
ypos := vtop;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := vbottom;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
valincr := (Ymax - Ymin) / 10.0;
for i := 1 to 11 do
begin
Title := format('%8.2f',[Ymax - ((i-1)*valincr)]);
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := 10;
Yvalue := Ymax - (valincr * (i-1));
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
ypos := ypos + vtop - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
xpos := hleft;
ypos := ypos + strhi div 2;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hleft - 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
// draw points for x and y pairs
for i := 0 to N-1 do
begin
ypos := round(vhi * ( (Ymax - Ypoints[i]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[i] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.Brush.Color := clYellow;
BlankFrm.Image1.Canvas.Brush.Style := bsSolid;
BlankFrm.Image1.Canvas.Pen.Color := clNavy;
BlankFrm.Image1.Canvas.Ellipse(xpos,ypos,xpos+5,ypos+5);
if ((PlotNo = 2) and (i = 0)) then
begin
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,'M1');
end;
if ((PlotNo = 2) and (i > 0)) then
begin
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := format('M%d',[i+1]);
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
end;
if ((PlotNo = 2) and (i > 0)) then
begin // draw slope line
BlankFrm.Image1.Canvas.Pen.Color := clRed;
ypos := round(vhi * ( (Ymax - Ypoints[0]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[0] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
YL := Ypoints[0];
XL := xpoints[0];
ypos := round(vhi * ( (Ymax - Ypoints[2]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[2] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
YU := Ypoints[2];
XU := xpoints[2];
slope := (YU - YL) / (XU - XL);
ypos := vbottom + 20;
BlankFrm.Image1.Canvas.Brush.Color := clYellow;
Title := format('Slope = %6.2f',[Slope]);
xpos := hleft + (hwide div 2) - (BlankFrm.Image1.Canvas.TextWidth(Title) div 2);
ypos := ypos + 15;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
// draw confidence bands if requested
if ConfBand <> 0.0 then
begin
BlankFrm.Image1.Canvas.Pen.Color := clRed;
ypos := round(vhi * ((Ymax - UpConf[1]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[0] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
for i := 2 to N do
begin
ypos := round(vhi * ((Ymax - UpConf[i]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[i-1] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
ypos := round(vhi * ((Ymax - lowConf[1]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[0] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
for i := 2 to N do
begin
ypos := round(vhi * ((Ymax - lowConf[i]) / (Ymax - Ymin)));
ypos := ypos + vtop;
xpos := round(hwide * ( (Xpoints[i-1] - Xmin) / (Xmax - Xmin)));
xpos := xpos + hleft;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
end;
BlankFrm.ShowModal;
end;
//-------------------------------------------------------------------
initialization
{$I resistancelineunit.lrs}
end.

View File

@ -0,0 +1,405 @@
object RIDITFrm: TRIDITFrm
Left = 182
Height = 438
Top = 106
Width = 611
Caption = 'Relative to an Identified Distribution Analysis'
ClientHeight = 438
ClientWidth = 611
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 9
Height = 14
Top = 16
Width = 44
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
Left = 223
Height = 14
Top = 40
Width = 96
Caption = 'Row Labels Variable'
ParentColor = False
end
object Label3: TLabel
Left = 225
Height = 14
Top = 120
Width = 82
Caption = 'Column Variables'
ParentColor = False
end
object Label4: TLabel
Left = 224
Height = 14
Top = 336
Width = 92
Caption = 'Reference Variable'
ParentColor = False
end
object Label5: TLabel
Left = 379
Height = 14
Top = 280
Width = 142
Caption = '2-tailed Alpha for significance'
ParentColor = False
end
object VarList: TListBox
Left = 7
Height = 328
Top = 32
Width = 162
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object RowIn: TBitBtn
Left = 184
Height = 26
Top = 40
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = RowInClick
TabOrder = 1
end
object RowOut: TBitBtn
Left = 184
Height = 26
Top = 72
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = RowOutClick
TabOrder = 2
end
object ColIn: TBitBtn
Left = 184
Height = 26
Top = 120
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = ColInClick
TabOrder = 3
end
object ColOut: TBitBtn
Left = 184
Height = 26
Top = 152
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = ColOutClick
TabOrder = 4
end
object RowEdit: TEdit
Left = 223
Height = 21
Top = 56
Width = 142
TabOrder = 5
Text = 'RowEdit'
end
object ColList: TListBox
Left = 222
Height = 185
Top = 136
Width = 143
ItemHeight = 0
OnClick = ColListClick
TabOrder = 6
end
object RefEdit: TEdit
Left = 224
Height = 21
Top = 352
Width = 142
TabOrder = 7
Text = 'RefEdit'
end
object GroupBox1: TGroupBox
Left = 379
Height = 173
Top = 8
Width = 218
Caption = 'Options'
ClientHeight = 155
ClientWidth = 214
TabOrder = 8
object ObsChk: TCheckBox
Left = 10
Height = 17
Top = 8
Width = 157
Caption = 'Show Observed Frequencies'
TabOrder = 0
end
object ExpChk: TCheckBox
Left = 10
Height = 17
Top = 29
Width = 155
Caption = 'Show Expected Frequencies'
TabOrder = 1
end
object PropChk: TCheckBox
Left = 10
Height = 17
Top = 53
Width = 187
Caption = 'Show Row and Column Proportions'
TabOrder = 2
end
object ChiChk: TCheckBox
Left = 10
Height = 17
Top = 77
Width = 156
Caption = 'Show Cell Chi-Square Values'
TabOrder = 3
end
object YatesChk: TCheckBox
Left = 10
Height = 17
Top = 101
Width = 199
Caption = 'Use Yate''s Correction for a 2x2 Table'
TabOrder = 4
end
object DetailsChk: TCheckBox
Left = 10
Height = 17
Top = 125
Width = 153
Caption = 'Show Computational Details'
TabOrder = 5
end
end
object RefGrp: TRadioGroup
Left = 379
Height = 65
Top = 192
Width = 218
AutoFill = True
Caption = 'Reference Variable'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 47
ClientWidth = 214
Items.Strings = (
'Let each variable be a reference variable'
'Use only the reference variable selected'
)
OnClick = RefGrpClick
TabOrder = 9
end
object BonChk: TCheckBox
Left = 379
Height = 17
Top = 304
Width = 156
Caption = 'Use Bonferroni for contrasts'
TabOrder = 10
end
object AlphaEdit: TEdit
Left = 542
Height = 21
Top = 272
Width = 50
TabOrder = 11
Text = 'AlphaEdit'
end
object ResetBtn: TButton
Left = 112
Height = 31
Top = 384
Width = 88
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 12
end
object CancelBtn: TButton
Left = 222
Height = 31
Top = 384
Width = 88
Caption = 'Cancel'
ModalResult = 2
TabOrder = 13
end
object ReturnBtn: TButton
Left = 433
Height = 31
Top = 384
Width = 88
Caption = 'Return'
ModalResult = 1
TabOrder = 14
end
object ComputeBtn: TButton
Left = 328
Height = 31
Top = 384
Width = 88
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 15
end
object HelpBtn: TButton
Tag = 143
Left = 9
Height = 31
Top = 384
Width = 80
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 16
end
end

View File

@ -0,0 +1,267 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRIDITFrm','FORMDATA',[
'TPF0'#9'TRIDITFrm'#8'RIDITFrm'#4'Left'#3#182#0#6'Height'#3#182#1#3'Top'#2'j'
+#5'Width'#3'c'#2#7'Caption'#6'/Relative to an Identified Distribution Analys'
+'is'#12'ClientHeight'#3#182#1#11'ClientWidth'#3'c'#2#6'OnShow'#7#8'FormShow'
+#10'LCLVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2
+#14#3'Top'#2#16#5'Width'#2','#7'Caption'#6#9'Variables'#11'ParentColor'#8#0#0
+#6'TLabel'#6'Label2'#4'Left'#3#223#0#6'Height'#2#14#3'Top'#2'('#5'Width'#2'`'
+#7'Caption'#6#19'Row Labels Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Labe'
+'l3'#4'Left'#3#225#0#6'Height'#2#14#3'Top'#2'x'#5'Width'#2'R'#7'Caption'#6#16
+'Column Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#224#0
+#6'Height'#2#14#3'Top'#3'P'#1#5'Width'#2'\'#7'Caption'#6#18'Reference Variab'
+'le'#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#4'Left'#3'{'#1#6'Height'#2#14
+#3'Top'#3#24#1#5'Width'#3#142#0#7'Caption'#6#31'2-tailed Alpha for significa'
+'nce'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#7#6'Height'#3'H'
+#1#3'Top'#2' '#5'Width'#3#162#0#10'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOr'
+'der'#2#0#0#0#7'TBitBtn'#5'RowIn'#4'Left'#3#184#0#6'Height'#2#26#3'Top'#2'('
+#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0
+#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0
+#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'
+#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190
+'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255
+'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139
+'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160
+#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255
+#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128
+#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199
+'t'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150
+#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255
+#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255
+#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255
+'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163
+'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247
+';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187
+'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#10'RowInCl'
+'ick'#8'TabOrder'#2#1#0#0#7'TBitBtn'#6'RowOut'#4'Left'#3#184#0#6'Height'#2#26
+#3'Top'#2'H'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0
+#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'
+#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'
+#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161
+'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131
+#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/'
+'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'
+#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255
+#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132
+#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255
+#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154
+#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255
+#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201
+#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#7'OnC'
+'lick'#7#11'RowOutClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#5'ColIn'#4'Left'#3
+#184#0#6'Height'#2#26#3'Top'#2'x'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'
+#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0
+#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
,#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169
+'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255
+'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255
+#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161
+#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198
+#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196
+#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255
+#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149
+#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'
+#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195
+'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255
+'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#7'OnClick'#7#10'ColInClick'#8'TabOrder'#2#3#0#0#7'TBitBtn'#6
+'ColOut'#4'Left'#3#184#0#6'Height'#2#26#3'Top'#3#152#0#5'Width'#2' '#10'Glyp'
+'h.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0
+#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'
+#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'
+#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134
,#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203
+#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190
+'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201#127
+#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255
+#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135
+#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255
+#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177
+'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255
+'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#11'ColOutClick'#8'Ta'
+'bOrder'#2#4#0#0#5'TEdit'#7'RowEdit'#4'Left'#3#223#0#6'Height'#2#21#3'Top'#2
+'8'#5'Width'#3#142#0#8'TabOrder'#2#5#4'Text'#6#7'RowEdit'#0#0#8'TListBox'#7
+'ColList'#4'Left'#3#222#0#6'Height'#3#185#0#3'Top'#3#136#0#5'Width'#3#143#0
+#10'ItemHeight'#2#0#7'OnClick'#7#12'ColListClick'#8'TabOrder'#2#6#0#0#5'TEdi'
+'t'#7'RefEdit'#4'Left'#3#224#0#6'Height'#2#21#3'Top'#3'`'#1#5'Width'#3#142#0
+#8'TabOrder'#2#7#4'Text'#6#7'RefEdit'#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3
+'{'#1#6'Height'#3#173#0#3'Top'#2#8#5'Width'#3#218#0#7'Caption'#6#7'Options'
+#12'ClientHeight'#3#155#0#11'ClientWidth'#3#214#0#8'TabOrder'#2#8#0#9'TCheck'
+'Box'#6'ObsChk'#4'Left'#2#10#6'Height'#2#17#3'Top'#2#8#5'Width'#3#157#0#7'Ca'
+'ption'#6#25'Show Observed Frequencies'#8'TabOrder'#2#0#0#0#9'TCheckBox'#6'E'
+'xpChk'#4'Left'#2#10#6'Height'#2#17#3'Top'#2#29#5'Width'#3#155#0#7'Caption'#6
+#25'Show Expected Frequencies'#8'TabOrder'#2#1#0#0#9'TCheckBox'#7'PropChk'#4
+'Left'#2#10#6'Height'#2#17#3'Top'#2'5'#5'Width'#3#187#0#7'Caption'#6#31'Show'
+' Row and Column Proportions'#8'TabOrder'#2#2#0#0#9'TCheckBox'#6'ChiChk'#4'L'
+'eft'#2#10#6'Height'#2#17#3'Top'#2'M'#5'Width'#3#156#0#7'Caption'#6#27'Show '
+'Cell Chi-Square Values'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8'YatesChk'#4'Left'
+#2#10#6'Height'#2#17#3'Top'#2'e'#5'Width'#3#199#0#7'Caption'#6'%Use Yate''s '
+'Correction for a 2x2 Table'#8'TabOrder'#2#4#0#0#9'TCheckBox'#10'DetailsChk'
+#4'Left'#2#10#6'Height'#2#17#3'Top'#2'}'#5'Width'#3#153#0#7'Caption'#6#26'Sh'
+'ow Computational Details'#8'TabOrder'#2#5#0#0#0#11'TRadioGroup'#6'RefGrp'#4
+'Left'#3'{'#1#6'Height'#2'A'#3'Top'#3#192#0#5'Width'#3#218#0#8'AutoFill'#9#7
+'Caption'#6#18'Reference Variable'#28'ChildSizing.LeftRightSpacing'#2#6#28'C'
+'hildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crs'
+'HomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousCh'
+'ildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSi'
+'zing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLe'
+'ftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeig'
+'ht'#2'/'#11'ClientWidth'#3#214#0#13'Items.Strings'#1#6')Let each variable b'
+'e a reference variable'#6'(Use only the reference variable selected'#0#7'On'
+'Click'#7#11'RefGrpClick'#8'TabOrder'#2#9#0#0#9'TCheckBox'#6'BonChk'#4'Left'
+#3'{'#1#6'Height'#2#17#3'Top'#3'0'#1#5'Width'#3#156#0#7'Caption'#6#28'Use Bo'
+'nferroni for contrasts'#8'TabOrder'#2#10#0#0#5'TEdit'#9'AlphaEdit'#4'Left'#3
+#30#2#6'Height'#2#21#3'Top'#3#16#1#5'Width'#2'2'#8'TabOrder'#2#11#4'Text'#6#9
+'AlphaEdit'#0#0#7'TButton'#8'ResetBtn'#4'Left'#2'p'#6'Height'#2#31#3'Top'#3
+#128#1#5'Width'#2'X'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8
+'TabOrder'#2#12#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#222#0#6'Height'#2#31#3
+'Top'#3#128#1#5'Width'#2'X'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'Tab'
,'Order'#2#13#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#177#1#6'Height'#2#31#3'To'
+'p'#3#128#1#5'Width'#2'X'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOr'
+'der'#2#14#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3'H'#1#6'Height'#2#31#3'Top'
+#3#128#1#5'Width'#2'X'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnCli'
+'ck'#8'TabOrder'#2#15#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#143#0#4'Left'#2#9#6
+'Height'#2#31#3'Top'#3#128#1#5'Width'#2'P'#7'Caption'#6#4'Help'#7'OnClick'#7
+#12'HelpBtnClick'#8'TabOrder'#2#16#0#0#0
]);

View File

@ -0,0 +1,700 @@
unit RIDITUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, MainUnit, Globals, DataProcs, FunctionsLib,
OutPutUnit, MatrixLib, Math, contexthelpunit;
type
{ TRIDITFrm }
TRIDITFrm = class(TForm)
BonChk: TCheckBox;
AlphaEdit: TEdit;
HelpBtn: TButton;
ResetBtn: TButton;
CancelBtn: TButton;
ReturnBtn: TButton;
ComputeBtn: TButton;
Label5: TLabel;
ObsChk: TCheckBox;
ExpChk: TCheckBox;
PropChk: TCheckBox;
ChiChk: TCheckBox;
RefGrp: TRadioGroup;
YatesChk: TCheckBox;
DetailsChk: TCheckBox;
ColList: TListBox;
GroupBox1: TGroupBox;
RefEdit: TEdit;
Label4: TLabel;
RowEdit: TEdit;
Label2: TLabel;
Label3: TLabel;
RowIn: TBitBtn;
RowOut: TBitBtn;
ColIn: TBitBtn;
ColOut: TBitBtn;
Label1: TLabel;
VarList: TListBox;
procedure ColInClick(Sender: TObject);
procedure ColListClick(Sender: TObject);
procedure ColOutClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure RefGrpClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure RowInClick(Sender: TObject);
procedure RowOutClick(Sender: TObject);
procedure Analyze(RefCol : integer; ColNoSelected : IntDyneVec;
RowLabels : StrDyneVec; ColLabels : StrDyneVec;
NoToAnalyze : integer; Freq : IntDyneMat;
Props : DblDyneMat; NoRows : integer);
private
{ private declarations }
public
{ public declarations }
end;
var
RIDITFrm: TRIDITFrm;
implementation
{ TRIDITFrm }
procedure TRIDITFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
ColList.Clear;
RowEdit.Text := '';
RefEdit.Text := '';
AlphaEdit.Text := '0.05';
BonChk.Checked := true;
RowIn.Visible := true;
RowOut.Visible := false;
ColIn.Visible := true;
ColOut.Visible := false;
Label4.Visible := false;
RefEdit.Visible := false;
RefGrp.ItemIndex := 1;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TRIDITFrm.RowInClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
RowEdit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
RowIn.Visible := false;
RowOut.Visible := true;
end;
procedure TRIDITFrm.RowOutClick(Sender: TObject);
begin
VarList.Items.Add(RowEdit.Text);
RowEdit.Text := '';
RowIn.Visible := true;
RowOut.Visible := false;
end;
procedure TRIDITFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRIDITFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRIDITFrm.RefGrpClick(Sender: TObject);
begin
if (RefGrp.ItemIndex = 0) then // do all variables as reference variable
begin
Label4.Visible := false;
RefEdit.Visible := false;
end
else
begin
Label4.Visible := true;
RefEdit.Visible := true;
end;
end;
procedure TRIDITFrm.ColInClick(Sender: TObject);
VAR index, i : integer;
begin
index := VarList.Items.Count;
i := 0;
while (i < index) do
begin
if (VarList.Selected[i]) then
begin
ColList.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
ColOut.Visible := true;
end;
procedure TRIDITFrm.ColListClick(Sender: TObject);
VAR index : integer;
begin
index := ColList.ItemIndex;
RefEdit.Text := ColList.Items.Strings[index];
end;
procedure TRIDITFrm.ColOutClick(Sender: TObject);
VAR index : integer;
begin
index := ColList.ItemIndex;
if (index < 0) then
begin
ColOut.Visible := false;
exit;
end;
VarList.Items.Add(ColList.Items.Strings[index]);
ColList.Items.Delete(index);
end;
procedure TRIDITFrm.ComputeBtnClick(Sender: TObject);
VAR
AllRefs : boolean;
i, j, RowNo, ColNo, DepNo, RefColNo, NoToAnalyze : integer;
Row, Col, NoSelected, Ncases, Nrows, Ncols, FObs, df : integer;
RowLabels, ColLabels : StrDyneVec;
ColNoSelected : IntDyneVec;
cellstring : string;
outline : string;
Freq : IntDyneMat;
Prop, Expected, CellChi : DblDyneMat;
PObs, ChiSquare, ProbChi : double;
yates : boolean;
title : string;
filename : string;
Adjchisqr, Adjprobchi, G : double;
results, intvalue : integer;
dblvalue, liklihood, probliklihood, phi : double;
strvalue : string;
pearsonr, VarX, VarY, SumX, SumY, MantelHaenszel, MHProb, CoefCont : double;
CramerV : double;
begin
AllRefs := true;
if (RefGrp.ItemIndex = 1) then AllRefs := false;
SetLength(ColNoSelected,NoVariables+1);
yates := false;
RowNo := 0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if (cellstring = RowEdit.Text) then RowNo := i;
end;
{
results := VarTypeChk(RowNo,2);
if (result = 1)
begin
delete[] ColNoSelected;
return;
end;
}
Nrows := NoCases;
Ncols := ColList.Items.Count;
SetLength(RowLabels,Nrows+1);
SetLength(ColLabels,Ncols+1);
if (RowNo = 0) then
begin
ShowMessage('ERROR! A variable for the row labels was not entered.');
ColNoSelected := nil;
exit;
end;
ColNoSelected[0] := RowNo;
// Get Column labels
for i := 0 to Ncols - 1 do
begin
ColLabels[i] := ColList.Items.Strings[i];
for j := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[j,0];
if (cellstring = ColLabels[i]) then
begin
ColNoSelected[i+1] := j;
{ result := VarTypeChk(j,1);
if (result = 1)
begin
delete[] ColLabels;
delete[] RowLabels;
delete[] ColNoSelected;
return;
end; }
end;
end;
end;
// Get row labels
for i := 1 to NoCases do
begin
RowLabels[i-1] := OS3MainFrm.DataGrid.Cells[RowNo,i];
end;
// allocate and initialize
SetLength(Freq,Nrows+1,Ncols+1);
SetLength(Prop,Nrows+1,Ncols+1);
SetLength(Expected,Nrows,Ncols);
SetLength(CellChi,Nrows,Ncols);
for i := 1 to Nrows + 1 do
for j := 1 to Ncols + 1 do Freq[i-1,j-1] := 0;
RowLabels[Nrows] := 'Total';
ColLabels[Ncols] := 'Total';
// get cell data
Ncases := 0;
for i := 1 to NoCases do
begin
Row := i;
for j := 1 to Ncols do
begin
Col := ColNoSelected[j];
Freq[i-1,j-1] := StrToInt(OS3MainFrm.DataGrid.Cells[Col,Row]);
// result := GetValue(Row,Col,intvalue,dblvalue,strvalue);
// if (result = 1) Freq[i-1][j-1] := 0;
// else Freq[i-1][j-1] := intvalue;
Ncases := Ncases + Freq[i-1,j-1];
end;
end;
Freq[Nrows][Ncols] := Ncases;
// Now, calculate expected values
// Get row totals first
for i := 1 to Nrows do
begin
for j := 1 to Ncols do
begin
Freq[i-1,Ncols] := Freq[i-1,Ncols] + Freq[i-1,j-1];
end;
end;
// Get col totals next
for j := 1 to Ncols do
begin
for i := 1 to Nrows do
begin
Freq[Nrows,j-1] := Freq[Nrows,j-1] + Freq[i-1,j-1];
end;
end;
// Then get expected values and cell chi-squares
ChiSquare := 0.0;
Adjchisqr := 0.0;
if ((YatesChk.Checked) and (Nrows = 2) and (Ncols = 2)) then yates := true;
if ((Nrows > 1) and (Ncols > 1)) then
begin
for i := 1 to Nrows do
begin
for j := 1 to Ncols do
begin
Expected[i-1,j-1] := Freq[Nrows,j-1] * Freq[i-1,Ncols] / Ncases;
if (Expected[i-1,j-1] > 0.0) then
CellChi[i-1,j-1] := sqr(Freq[i-1,j-1] - Expected[i-1,j-1])
/ Expected[i-1,j-1]
else
begin
ShowMessage('ERROR! Zero expected value found.');
CellChi[i-1,j-1] := 0.0;
end;
ChiSquare := ChiSquare + CellChi[i-1,j-1];
end;
end;
df := (Nrows - 1) * (Ncols - 1);
if (yates = true) then // 2 x 2 corrected chi-square
begin
Adjchisqr := abs((Freq[0,0] * Freq[1,1]) - (Freq[0,1] * Freq[1,0]));
Adjchisqr := sqr(Adjchisqr - Ncases / 2.0) * Ncases; // numerator
Adjchisqr := Adjchisqr / (Freq[0,2] * Freq[1,2] * Freq[2,0] * Freq[2,1]);
Adjprobchi := 1.0 - chisquaredprob(Adjchisqr,df);
end;
end;
if (Nrows = 1) then // equal probability
begin
for j := 0 to Ncols - 1 do
begin
Expected[0,j] := Ncases / Ncols;
if (Expected[0][j] > 0) then
CellChi[0,j] := sqr(Freq[0,j] - Expected[0,j]) / Expected[0,j];
ChiSquare := ChiSquare + CellChi[0,j];
end;
df := Ncols - 1;
end;
if (Ncols = 1) then // equal probability
begin
for i := 0 to Nrows - 1 do
begin
Expected[i,0] := Ncases / Nrows;
if (Expected[i,0] > 0) then
CellChi[i,0] := sqr(Freq[i,0] - Expected[i,0]) / Expected[i,0];
ChiSquare := ChiSquare + CellChi[i,0];
end;
df := Nrows - 1;
end;
ProbChi := 1.0 - chisquaredprob(ChiSquare,df); // prob. larger chi
//Print results to output form
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Chi-square Analysis Results');
outline := format('No. of Cases = %d',[Ncases]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
// print tables requested by use
if (ObsChk.Checked) then
begin
IntArrayPrint(Freq, Nrows+1, Ncols+1,'Frequencies',
RowLabels, ColLabels,'OBSERVED FREQUENCIES');
end;
if (ExpChk.Checked) then
begin
outline := 'EXPECTED FREQUENCIES';
MAT_PRINT(Expected, Nrows, Ncols, outline, RowLabels, ColLabels,
NoCases);
end;
if (PropChk.Checked) then outline := 'ROW PROPORTIONS';
for i := 1 to Nrows + 1 do
begin
for j := 1 to Ncols do
begin
if (Freq[i-1,Ncols] > 0.0) then
Prop[i-1,j-1] := Freq[i-1,j-1] / Freq[i-1,Ncols]
else Prop[i-1,j-1] := 0.0;
end;
if (Freq[i-1,Ncols] > 0.0) then Prop[i-1,Ncols] := 1.0
else Prop[i-1,Ncols] := 0.0;
end;
if (PropChk.Checked) then
MAT_PRINT(Prop, Nrows+1, Ncols+1, outline, RowLabels, ColLabels,
NoCases);
if (PropChk.Checked) then outline := 'COLUMN PROPORTIONS';
for j := 1 to Ncols + 1 do
begin
for i := 1 to Nrows do
begin
if (Freq[Nrows,j-1] > 0.0) then
Prop[i-1,j-1] := Freq[i-1,j-1] / Freq[Nrows,j-1]
else Prop[i-1,j-1] := 0.0;
end;
if (Freq[Nrows,j-1] > 0.0) then Prop[Nrows,j-1] := 1.0
else Prop[Nrows,j-1] := 0.0;
end;
if (PropChk.Checked) then
MAT_PRINT(Prop, Nrows+1, Ncols+1, outline, RowLabels, ColLabels,
NoCases);
if (ChiChk.Checked) then
begin
outline := 'CHI-SQUARED VALUE FOR CELLS';
MAT_PRINT(CellChi, Nrows, Ncols, outline, RowLabels, ColLabels,
NoCases);
end;
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Chi-square = %8.3f with D.F. = %d. Prob. > value = %8.3f',
[ChiSquare,df,ProbChi]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
if (yates = true) then
begin
outline := format('Chi-square using Yates correction = %8.3f and Prob > value = %8.3f',
[Adjchisqr,Adjprobchi]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
liklihood := 0.0;
for i := 0 to Nrows - 1 do
for j := 0 to Ncols - 1 do
if (Freq[i,j] > 0.0) then
liklihood := liklihood + Freq[i,j] * (ln(Expected[i,j] / Freq[i,j]));
liklihood := -2.0 * liklihood;
probliklihood := 1.0 - chisquaredprob(liklihood,df);
outline := format('Liklihood Ratio = %8.3f with prob. > value = %6.4f',
[liklihood,probliklihood]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
if ((Nrows > 1) and (Ncols > 1)) then
begin
phi := sqrt(ChiSquare / Ncases);
outline := format('phi correlation = %6.4f',[phi]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
pearsonr := 0.0;
SumX := 0.0;
SumY := 0.0;
VarX := 0.0;
VarY := 0.0;
for i := 0 to Nrows - 1 do SumX := SumX + ( (i+1) * Freq[i,Ncols] );
for j := 0 to Ncols - 1 do SumY := SumY + ( (j+1) * Freq[Nrows,j] );
for i := 0 to Nrows - 1 do VarX := VarX + ( ((i+1)*(i+1)) * Freq[i,Ncols] );
for j := 0 to Ncols - 1 do VarY := VarY + ( ((j+1)*(j+1)) * Freq[Nrows,j] );
VarX := VarX - ((SumX * SumX) / Ncases);
VarY := VarY - ((SumY * SumY) / Ncases);
for i := 0 to Nrows - 1 do
for j := 0 to Ncols - 1 do
pearsonr := pearsonr + ((i+1)*(j+1) * Freq[i,j]);
pearsonr := pearsonr - (SumX * SumY / Ncases);
pearsonr := pearsonr / sqrt(VarX * VarY);
outline := format('Pearson Correlation r = %6.4f',[pearsonr]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
MantelHaenszel := (Ncases-1) * (pearsonr * pearsonr);
MHprob := 1.0 - chisquaredprob(MantelHaenszel,1);
outline := format('Mantel-Haenszel Test of Linear Association = %8.3f with probability > value = %6.4f',
[MantelHaenszel, MHprob]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
CoefCont := sqrt(ChiSquare / (ChiSquare + Ncases));
outline := format('The coefficient of contingency = %8.3f',[CoefCont]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
if (Nrows < Ncols) then CramerV := sqrt(ChiSquare / (Ncases * ((Nrows-1))))
else CramerV := sqrt(ChiSquare / (Ncases * ((Ncols-1))));
outline := format('Cramers V = %8.3f',[CramerV]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.ShowModal();
OutPutFrm.RichEdit.Clear();
// Now do RIDIT analysis
NoToAnalyze := ColList.Items.Count;
if (AllRefs) then // do an analysis for each variable as a reference variable
begin
NoToAnalyze := ColList.Items.Count;
for i := 0 to NoToAnalyze - 1 do
begin
RefColNo := ColNoSelected[i+1] - 2;
Analyze(RefColNo, ColNoSelected, RowLabels,ColLabels,
NoToAnalyze,Freq,Prop, Nrows);
end;
end
else // only one selected reference variable
begin
NoToAnalyze := ColList.Items.Count;
// get column of reference variable
for i := 1 to NoVariables do
begin
if (RefEdit.Text = OS3MainFrm.DataGrid.Cells[i,0]) then RefColNo := i;
end;
for j := 0 to NoToAnalyze - 1 do
begin
if (ColNoSelected[j+1] = RefColNo) then RefColNo := j;
end;
Analyze(RefColNo, ColNoSelected, RowLabels,ColLabels,
NoToAnalyze,Freq, Prop, Nrows);
end;
ColLabels := nil;
RowLabels := nil;
CellChi := nil;
Expected := nil;
Prop := nil;
Freq := nil;
ColNoSelected := nil;
end;
procedure TRIDITFrm.Analyze(RefCol : integer; ColNoSelected : IntDyneVec;
RowLabels : StrDyneVec; ColLabels : StrDyneVec;
NoToAnalyze : integer; Freq : IntDyneMat;
Props : DblDyneMat; NoRows : integer);
VAR
probdists : DblDyneMat;
refprob : DblDyneMat;
sizes : DblDyneVec;
meanridits : DblDyneVec;
Cratios : DblDyneVec;
OverMeanRidit : double;
chisquare : double;
probchi : double;
alpha : double;
StdErr : DblDyneVec;
Bonferroni : double;
chidf, K, i, j : integer;
outline : string;
outstring : string;
details : boolean;
term1,term2,term3,term4 : double;
begin
details := false;
SetLength(probdists,NoRows,NoToAnalyze);
SetLength(refprob,NoRows,4);
SetLength(sizes,NoToAnalyze);
SetLength(meanridits,NoToAnalyze);
SetLength(Cratios,NoToAnalyze);
SetLength(StdErr,NoToAnalyze);
alpha := StrToFloat(AlphaEdit.Text);
if (DetailsChk.Checked) then details := true;
outline := format('ANALYSIS FOR STANDARD %s',[ColLabels[RefCol]]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
// print frequencies
outline := 'Frequencies Observed';
IntArrayPrint(Freq, NoRows, NoToAnalyze, 'Frequencies', RowLabels, ColLabels,
outline);
// print column proportions
outline := 'Column Proportions Observed';
MAT_PRINT(Props, NoRows, NoToAnalyze, outline, RowLabels, ColLabels,
NoCases);
// Get sizes in each column
for i := 0 to NoToAnalyze - 1 do
begin
sizes[i] := Freq[NoRows,i];
end;
// Get the reference variable probabilities for all variables
for j := 0 to NoToAnalyze - 1 do
begin
for i := 0 to NoRows - 1 do
begin
refprob[i,0] := Props[i,j];
refprob[i,1] := Props[i,j] / 2.0;
end;
refprob[0,2] := 0.0;
for i := 1 to NoRows - 1 do refprob[i,2] := refprob[i-1,2] + refprob[i-1,0];
for i := 0 to NoRows - 1 do refprob[i,3] := refprob[i,1] + refprob[i,2];
if (details) then // print calculations table
begin
outstring := 'Ridit calculations for ' + ColLabels[j];
outline := outstring;
MAT_PRINT(refprob, NoRows, 4, outline, RowLabels, ColLabels,
NoCases);
end;
// store results in probdists
for i := 0 to NoRows - 1 do probdists[i,j] := refprob[i,3];
end;
outstring := 'Ridits for all variables';
outline := outstring;
MAT_PRINT(probdists, NoRows, NoToAnalyze, outline, RowLabels, ColLabels,
NoCases);
// obtain mean ridits for the all variables using the reference variable
for i := 0 to NoToAnalyze - 1 do
begin
meanridits[i] := 0.0;
for j := 0 to NoRows - 1 do
begin
meanridits[i] := meanridits[i] + (probdists[j,RefCol] * Freq[j,i]);
end;
meanridits[i] := meanridits[i] / sizes[i];
end;
// print the means using the reference variable
outline := 'Mean RIDITS Using the Reference Values';
DynVectorPrint(meanridits,NoToAnalyze,outline,ColLabels,NoCases);
// obtain the weighted grand mean ridit
OverMeanRidit := 0.0;
for i := 0 to NoToAnalyze - 1 do
begin
if (i <> RefCol) then OverMeanRidit := OverMeanRidit + sizes[i] * meanridits[i];
end;
OverMeanRidit := OverMeanRidit / (Freq[NoRows,NoToAnalyze] - sizes[RefCol]);
outline := format('Overall mean for RIDITS in non-reference groups := %8.4f',[OverMeanRidit]);
OutPutFrm.RichEdit.Lines.Add(outline);
// obtain chisquare
chisquare := 0.0;
term4 := (OverMeanRidit - 0.5) * (OverMeanRidit - 0.5);
term3 := 0.0;
for i := 0 to NoToAnalyze - 1 do
begin
if (i <> RefCol) then term3 := term3 + (sizes[i] * sizes[i]);
end;
term3 := 12.0 * term3;
term2 := Freq[NoRows,NoToAnalyze];
term1 := 0.0;
for i := 0 to NoToAnalyze - 1 do
begin
if (i <> RefCol) then
term1 := term1 + (sizes[i] * ((meanridits[i] - 0.5) * (meanridits[i] - 0.5)));
end;
term1 := term1 * 12.0;
chisquare := term1 - ((term3 / term2) * term4);
probchi := 1.0 - chisquaredprob(chisquare,NoToAnalyze-1);
outline := format('Chisquared := %8.3f with probability < %8.4f',[chisquare,probchi]);
OutPutFrm.RichEdit.Lines.Add(outline);
// do pairwise comparisons
Cratios[RefCol] := 0.0;
for i := 0 to NoToAnalyze - 1 do
begin
if (i <> RefCol) then
begin
StdErr[i] := sqrt(sizes[RefCol] + sizes[i]) /
(2.0 * sqrt(3.0 * sizes[RefCol] * sizes[i]));
Cratios[i] := ( meanridits[i] - 0.5) / StdErr[i];
end;
end;
outline := 'z critical ratios';
DynVectorPrint(Cratios,NoToAnalyze,outline,ColLabels,NoCases);
alpha := alpha / 2.0;
if (BonChk.Checked) then alpha := alpha / (NoToAnalyze - 1);
Bonferroni := inversez(1.0 - alpha);
outline := format('significance level used for comparisons := %8.3f',[Bonferroni]);
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 0 to NoToAnalyze - 1 do
begin
if (i <> RefCol) then
begin
if (abs(Cratios[i]) > Bonferroni) then
begin
outline := format('%s vs %s significant',[ColLabels[i],ColLabels[RefCol]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end
else
begin
outline := format('%s vs %s not significant',[ColLabels[i],ColLabels[RefCol]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
// cleanup
StdErr := nil;
Cratios := nil;
meanridits := nil;
sizes := nil;
refprob := nil;
probdists := nil;
end;
initialization
{$I riditunit.lrs}
end.

View File

@ -0,0 +1,272 @@
object RMatFrm: TRMatFrm
Left = 120
Height = 446
Top = 96
Width = 514
Caption = 'Product-Moment Correlations'
ClientHeight = 446
ClientWidth = 514
OnShow = FormShow
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 7
Height = 16
Top = 9
Width = 116
Caption = 'Variables to Correlate:'
ParentColor = False
end
object Label2: TLabel
Left = 225
Height = 16
Top = 10
Width = 98
Caption = 'Selected Variables:'
ParentColor = False
end
object VarList: TListBox
Left = 5
Height = 235
Top = 29
Width = 167
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 184
Height = 31
Top = 29
Width = 37
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 184
Height = 31
Top = 64
Width = 37
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object AllBtn: TBitBtn
Left = 184
Height = 31
Top = 120
Width = 37
Caption = 'ALL'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 3
end
object ListBox1: TListBox
Left = 231
Height = 234
Top = 32
Width = 164
ItemHeight = 0
TabOrder = 4
end
object GroupBox1: TGroupBox
Left = 5
Height = 160
Top = 272
Width = 391
Caption = 'Options:'
ClientHeight = 142
ClientWidth = 387
TabOrder = 5
object CPChkBox: TCheckBox
Left = 6
Height = 19
Top = 0
Width = 169
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 5
Height = 19
Top = 20
Width = 197
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 6
Height = 19
Top = 40
Width = 189
Caption = 'Show the Intercorrelation Matrix'
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 6
Height = 19
Top = 59
Width = 87
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 6
Height = 19
Top = 80
Width = 102
Caption = 'Show Variances'
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 6
Height = 19
Top = 100
Width = 157
Caption = 'Show Standard Deviations'
TabOrder = 5
end
object PairsChkBox: TCheckBox
Left = 5
Height = 19
Top = 118
Width = 138
Caption = 'Pair-Wise Calculations'
TabOrder = 6
end
object AugmentChk: TCheckBox
Left = 223
Height = 19
Top = 0
Width = 80
Caption = 'Autmented'
TabOrder = 7
end
object GridMatChk: TCheckBox
Left = 224
Height = 19
Top = 22
Width = 119
Caption = 'Save Matrix to Grid'
TabOrder = 8
end
end
object ResetBtn: TButton
Left = 424
Height = 29
Top = 64
Width = 75
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object CancelBtn: TButton
Left = 424
Height = 29
Top = 112
Width = 75
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object ComputeBtn: TButton
Left = 424
Height = 29
Top = 168
Width = 75
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 8
end
object ReturnBtn: TButton
Left = 424
Height = 29
Top = 216
Width = 75
Caption = 'Return'
ModalResult = 1
TabOrder = 9
end
object HelpBtn: TButton
Tag = 144
Left = 424
Height = 31
Top = 16
Width = 75
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 10
end
end

View File

@ -0,0 +1,149 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRMatFrm','FORMDATA',[
'TPF0'#8'TRMatFrm'#7'RMatFrm'#4'Left'#2'x'#6'Height'#3#190#1#3'Top'#2'`'#5'Wi'
+'dth'#3#2#2#7'Caption'#6#27'Product-Moment Correlations'#12'ClientHeight'#3
+#190#1#11'ClientWidth'#3#2#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#6'0.9.'
+'30'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#16#3'Top'#2#9#5'Width'#2
+'t'#7'Caption'#6#23'Variables to Correlate:'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label2'#4'Left'#3#225#0#6'Height'#2#16#3'Top'#2#10#5'Width'#2'b'#7'Captio'
+'n'#6#19'Selected Variables:'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4
+'Left'#2#5#6'Height'#3#235#0#3'Top'#2#29#5'Width'#3#167#0#10'ItemHeight'#2#0
+#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#184#0#6
+'Height'#2#31#3'Top'#2#29#5'Width'#2'%'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0
+'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4
+#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#1#0
+#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#184#0#6'Height'#2#31#3'Top'#2'@'#5'Width'#2
+'%'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0
+#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11
+'OutBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'AllBtn'#4'Left'#3#184#0#6'Hei'
+'ght'#2#31#3'Top'#2'x'#5'Width'#2'%'#7'Caption'#6#3'ALL'#9'NumGlyphs'#2#0#7
+'OnClick'#7#11'AllBtnClick'#8'TabOrder'#2#3#0#0#8'TListBox'#8'ListBox1'#4'Le'
+'ft'#3#231#0#6'Height'#3#234#0#3'Top'#2' '#5'Width'#3#164#0#10'ItemHeight'#2
+#0#8'TabOrder'#2#4#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#5#6'Height'#3#160
+#0#3'Top'#3#16#1#5'Width'#3#135#1#7'Caption'#6#8'Options:'#12'ClientHeight'#3
+#142#0#11'ClientWidth'#3#131#1#8'TabOrder'#2#5#0#9'TCheckBox'#8'CPChkBox'#4
+'Left'#2#6#6'Height'#2#19#3'Top'#2#0#5'Width'#3#169#0#7'Caption'#6#26'Show C'
+'ross-Products Matrix'#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'CovChkBox'#4'Left'
+#2#5#6'Height'#2#19#3'Top'#2#20#5'Width'#3#197#0#7'Caption'#6#31'Show Varian'
+'ce-Covariance Matrix'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'CorrsChkBox'#4'Le'
+'ft'#2#6#6'Height'#2#19#3'Top'#2'('#5'Width'#3#189#0#7'Caption'#6' Show the '
+'Intercorrelation Matrix'#8'TabOrder'#2#2#0#0#9'TCheckBox'#11'MeansChkBox'#4
+'Left'#2#6#6'Height'#2#19#3'Top'#2';'#5'Width'#2'W'#7'Caption'#6#10'Show Mea'
+'ns'#8'TabOrder'#2#3#0#0#9'TCheckBox'#9'VarChkBox'#4'Left'#2#6#6'Height'#2#19
+#3'Top'#2'P'#5'Width'#2'f'#7'Caption'#6#14'Show Variances'#8'TabOrder'#2#4#0
+#0#9'TCheckBox'#8'SDChkBox'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'd'#5'Width'#3
,#157#0#7'Caption'#6#24'Show Standard Deviations'#8'TabOrder'#2#5#0#0#9'TChec'
+'kBox'#11'PairsChkBox'#4'Left'#2#5#6'Height'#2#19#3'Top'#2'v'#5'Width'#3#138
+#0#7'Caption'#6#22'Pair-Wise Calculations'#8'TabOrder'#2#6#0#0#9'TCheckBox'
+#10'AugmentChk'#4'Left'#3#223#0#6'Height'#2#19#3'Top'#2#0#5'Width'#2'P'#7'Ca'
+'ption'#6#9'Autmented'#8'TabOrder'#2#7#0#0#9'TCheckBox'#10'GridMatChk'#4'Lef'
+'t'#3#224#0#6'Height'#2#19#3'Top'#2#22#5'Width'#2'w'#7'Caption'#6#19'Save Ma'
+'trix to Grid'#8'TabOrder'#2#8#0#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#168#1#6
+'Height'#2#29#3'Top'#2'@'#5'Width'#2'K'#7'Caption'#6#5'Reset'#7'OnClick'#7#13
+'ResetBtnClick'#8'TabOrder'#2#6#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#168#1#6
+'Height'#2#29#3'Top'#2'p'#5'Width'#2'K'#7'Caption'#6#6'Cancel'#11'ModalResul'
+'t'#2#2#8'TabOrder'#2#7#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#168#1#6'Heig'
+'ht'#2#29#3'Top'#3#168#0#5'Width'#2'K'#7'Caption'#6#7'Compute'#7'OnClick'#7
+#15'ComputeBtnClick'#8'TabOrder'#2#8#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3
+#168#1#6'Height'#2#29#3'Top'#3#216#0#5'Width'#2'K'#7'Caption'#6#6'Return'#11
+'ModalResult'#2#1#8'TabOrder'#2#9#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#144#0#4
+'Left'#3#168#1#6'Height'#2#31#3'Top'#2#16#5'Width'#2'K'#7'Caption'#6#4'Help'
+#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#10#0#0#0
]);

View File

@ -0,0 +1,442 @@
unit RMatUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, MatrixLib, OutPutUnit, DataProcs,
FunctionsLib, contexthelpunit;
type
{ TRMatFrm }
TRMatFrm = class(TForm)
GridMatChk: TCheckBox;
HelpBtn: TButton;
InBtn: TBitBtn;
OutBtn: TBitBtn;
AllBtn: TBitBtn;
AugmentChk: TCheckBox;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
CPChkBox: TCheckBox;
CovChkBox: TCheckBox;
CorrsChkBox: TCheckBox;
MeansChkBox: TCheckBox;
VarChkBox: TCheckBox;
SDChkBox: TCheckBox;
PairsChkBox: TCheckBox;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
VarList: TListBox;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
procedure PairsCalc(NoVars : integer;
VAR ColNoSelected : IntDyneVec;
VAR Matrix : DblDyneMat;
VAR ColLabels : StrDyneVec);
public
{ public declarations }
end;
var
RMatFrm: TRMatFrm;
implementation
{ TRMatFrm }
procedure TRMatFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
ListBox1.Clear;
for i := 1 to NoVariables do
begin
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
InBtn.Enabled := true;
OutBtn.Enabled := false;
AugmentChk.Checked := false;
PairsChkBox.Checked := false;
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
end;
procedure TRMatFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TRMatFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRMatFrm.AllBtnClick(Sender: TObject);
VAR count, index : integer;
begin
count := VarList.Items.Count;
for index := 0 to count-1 do
begin
ListBox1.Items.Add(VarList.Items.Strings[index]);
end;
VarList.Clear;
end;
procedure TRMatFrm.ComputeBtnClick(Sender: TObject);
label cleanit;
var
i, j : integer;
cellstring : string;
NoVars : integer;
ColNoSelected : IntDyneVec;
Matrix : DblDyneMat;
TestMat : DblDyneMat;
Means : DblDyneVec;
Variances : DblDyneVec;
StdDevs : DblDyneVec;
RowLabels, ColLabels : StrDyneVec;
Augment : boolean;
title : string;
errorcode : boolean;
Ngood : integer;
t, Sr, Probr, N, z : double;
begin
errorcode := false;
OutPutFrm.RichEdit.Clear;
NoVars := ListBox1.Items.Count;
Augment := false;
Ngood := 0;
SetLength(ColNoSelected,NoVars+1);
SetLength(Matrix,NoVars+1,NoVars+1); // 1 more for possible augmentation
SetLength(TestMat,NoVars,NoVars);
SetLength(Means,NoVars+1);
SetLength(Variances,NoVars+1);
SetLength(StdDevs,NoVars+1);
SetLength(RowLabels,NoVars+1);
SetLength(ColLabels,NoVars+1);
// identify the included variable locations and their labels
for i := 1 to NoVars do
begin
cellstring := ListBox1.Items.Strings[i-1];
for j := 1 to NoVariables do
begin
if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then
begin
ColNoSelected[i-1] := j;
RowLabels[i-1] := cellstring;
ColLabels[i-1] := cellstring;
end;
end;
end;
if PairsChkBox.Checked then
begin
PairsCalc(NoVars,ColNoSelected,Matrix,ColLabels);
goto cleanit;
end;
if AugmentChk.Checked then
begin
Augment := true;
ColLabels[NoVars] := 'Intercept';
RowLabels[NoVars] := 'Intercept';
end;
// get cross-products if elected
if CPChkBox.Checked = true then
begin
GridXProd(NoVars,ColNoSelected,Matrix,Augment,Ngood);
title := 'Cross-Products Matrix';
if NOT Augment then
MAT_PRINT(Matrix,NoVars,NoVars,title,RowLabels,ColLabels,Ngood)
else
MAT_PRINT(Matrix,NoVars+1,NoVars+1,title,RowLabels,ColLabels,Ngood);
end;
if CovChkBox.Checked = true then // get variance-covariance mat. if elected
begin
title := 'Variance-Covariance Matrix';
GridCovar(NoVars,ColNoSelected,Matrix,Means,Variances,StdDevs,errorcode, Ngood);
MAT_PRINT(Matrix,NoVars,NoVars,title,RowLabels,ColLabels,Ngood);
end;
if CorrsChkBox.Checked = true then // get correlations
begin
title := 'Product-Moment Correlations Matrix';
Correlations(NoVars,ColNoSelected,Matrix,Means,Variances,StdDevs,errorcode,Ngood);
MAT_PRINT(Matrix,NoVars,NoVars,title,RowLabels,ColLabels,Ngood);
N := Ngood;
for i := 1 to NoVars do
begin
for j := i+1 to NoVars do
begin
t := Matrix[i-1][j-1] * (sqrt((N-2.0) /
(1.0 - (Matrix[i-1][j-1] * Matrix[i-1][j-1]))));
TestMat[i-1,j-1] := t;
Probr := probt(t,N - 2.0);
TestMat[j-1,i-1] := Probr;
TestMat[i-1,i-1] := 0.0;
end;
end;
title := 't-test values (upper) and probabilities of t (lower)';
MAT_PRINT(TestMat,NoVars,NoVars,title,RowLabels,ColLabels,Ngood);
end;
title := 'Means';
if MeansChkBox.Checked = true then
DynVectorPrint(Means,NoVars,title,ColLabels,Ngood);
title := 'Variances';
if VarChkBox.Checked = true then
DynVectorPrint(Variances,NoVars,title,ColLabels,Ngood);
title := 'Standard Deviations';
if SDChkBox.Checked = true then
DynVectorPrint(StdDevs,NoVars,title,ColLabels,Ngood);
if errorcode then
OutPutFrm.RichEdit.Lines.Add('One or more correlations could not be computed due to zero variance of a variable.');
OutPutFrm.ShowModal;
if GridMatChk.Checked then MatToGrid(Matrix,NoVars);
// clean up the heap
cleanit:
ColLabels := nil;
RowLabels := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
Matrix := nil;
ColNoSelected := nil;
end;
procedure TRMatFrm.InBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
ListBox1.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
OutBtn.Enabled := true;
end;
procedure TRMatFrm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ListBox1.ItemIndex;
VarList.Items.Add(ListBox1.Items.Strings[index]);
ListBox1.Items.Delete(index);
InBtn.Enabled := true;
end;
procedure TRMatFrm.PairsCalc(NoVars: integer; var ColNoSelected: IntDyneVec;
var Matrix: DblDyneMat; var ColLabels: StrDyneVec);
Label nextpart;
var
i, j, k, XCol, YCol, Npairs, N : integer;
X, Y, XMean, XVar, XSD, YMean, YVar, YSD, pmcorr, z, rprob : double;
strout : string;
NMatrix : IntDyneMat;
tMatrix : DblDyneMat;
ProbMat : DblDyneMat;
startpos, endpos : integer;
begin
OutPutFrm.RichEdit.Clear;
SetLength(NMatrix,NoVars,NoVars);
SetLength(tMatrix,NoVars,NoVars);
SetLength(ProbMat,NoVars,NoVars);
for i := 1 to NoVars - 1 do
begin
for j := i + 1 to NoVars do
begin
XMean := 0.0;
XVar := 0.0;
XCol := ColNoSelected[i-1];
YMean := 0.0;
YVar := 0.0;
YCol := ColNoSelected[j-1];
pmcorr := 0.0;
Npairs := 0;
strout := ColLabels[i-1];
strout := strout + ' vs ';
strout := strout + ColLabels[j-1];
OutPutFrm.RichEdit.Lines.Add(strout);
for k := 1 to NoCases do
begin
if not ValidValue(k,XCol) then continue;
if not ValidValue(k,YCol) then continue;
X := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol,k]);
Y := StrToFloat(OS3MainFrm.DataGrid.Cells[YCol,k]);
pmcorr := pmcorr + (X * Y);
XMean := XMean + X;
YMean := YMean + Y;
XVar := XVar + (X * X);
YVar := YVar + (Y * Y);
Npairs := NPairs + 1;
end;
if CPChkBox.Checked then
begin
strout := format('CrossProducts[%d,%d]=%6.4f, N cases = %d',[i,j,pmcorr,Npairs]);
OutPutFrm.RichEdit.Lines.Add(strout);
end;
pmcorr := pmcorr - (XMean * YMean) / Npairs;
pmcorr := pmcorr / (Npairs - 1);
if CovChkBox.Checked then
begin
strout := format('Covariance[%d,%d]=%6.4f, N cases = %d',[i,j,pmcorr,Npairs]);
OutPutFrm.RichEdit.Lines.Add(strout);
end;
XVar := XVar - (XMean * XMean) / Npairs;
XVar := XVar / (Npairs - 1);
XSD := sqrt(XVar);
YVar := YVar - (YMean * YMean) / Npairs;
YVar := YVar / (Npairs - 1);
YSD := sqrt(YVar);
XMean := XMean / Npairs;
YMean := YMean / Npairs;
pmcorr := pmcorr / (XSD * YSD);
Matrix[i-1,j-1] := pmcorr;
Matrix[j-1,i-1] := pmcorr;
NMatrix[i-1,j-1] := Npairs;
NMatrix[j-1,i-1] := NPairs;
if CorrsChkBox.Checked then
begin
N := Npairs - 2;
z := abs(pmcorr) * (sqrt((N-2)/(1.0 - (pmcorr * pmcorr))));
rprob := probt(z,N);
// Using Fisher's z transform below gives SPSS results
// N := Npairs - 3;
// z := 0.5 * ln( (1.0 + pmcorr)/(1.0 - pmcorr) );
// z := z / sqrt(1.0/N);
// rprob := probz(z);
strout := format('r[%d,%d]=%6.4f, N cases = %d',[i,j,pmcorr,Npairs]);
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('t value with d.f. %d = %8.4f with Probability > t = %6.4f',[Npairs-2,z,rprob]);
OutPutFrm.RichEdit.Lines.Add(strout);
tMatrix[i-1,j-1] := z;
tMatrix[j-1,i-1] := z;
ProbMat[i-1,j-1] := rprob;
ProbMat[j-1,i-1] := rprob;
end;
if MeansChkBox.Checked or VarChkBox.Checked or SDChkBox.Checked then
begin
strout := format('Mean X = %8.4f, Variance X = %8.4f, Std.Dev. X = %8.4f',[XMean,XVar,XSD]);
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('Mean Y = %8.4f, Variance Y = %8.4f, Std.Dev. Y = %8.4f',[YMean,YVar,YSD]);
OutPutFrm.RichEdit.Lines.Add(strout);
end;
OutPutFrm.RichEdit.Lines.Add('');
end; // next j variable
Matrix[i-1,i-1] := 1.0;
end; // next i variable
Matrix[NoVars-1,NoVars-1] := 1.0;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Intercorrelation Matrix and Statistics');
OutPutFrm.RichEdit.Lines.Add('');
// strout := 'Correlation Matrix Summary (Ns in lower triangle)';
// MAT_PRINT(Matrix,NoVars,NoVars,strout,ColLabels,ColLabels,NoCases);
startpos := 1;
endpos := 6;
if endpos > NoVars then endpos := NoVars;
for i := 1 to NoVars do
begin
nextpart:
strout := ' ';
for j := startpos to endpos do
strout := strout + format(' %5d',[j]);
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('%2d PMCorr.',[i]);
for j := startpos to endpos do
strout := strout + format(' %7.4f',[Matrix[i-1,j-1]]);
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('%2d N Size ',[i]);
for j := startpos to endpos do
begin
if j <> i then
strout := strout + format(' %3d ',[NMatrix[i-1,j-1]])
else begin
Npairs := 0;
for k := 1 to NoCases do
begin
if ValidValue(k,ColNoSelected[j-1])
then Npairs := Npairs + 1;
end;
strout := strout + format(' %3d ',[Npairs]);
end;
end;
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('%2d t Value',[i]);
for j := startpos to endpos do
begin
if j <> i then
strout := strout + format(' %7.4f',[tMatrix[i-1,j-1]])
else strout := strout + ' ';
end;
OutPutFrm.RichEdit.Lines.Add(strout);
strout := format('%2d Prob. t',[i]);
for j := startpos to endpos do
begin
if j <> i then
strout := strout + format(' %7.4f',[ProbMat[i-1,j-1]])
else strout := strout + ' ';
end;
OutPutFrm.RichEdit.Lines.Add(strout);
OutPutFrm.RichEdit.Lines.Add('');
if endpos < NoVars then
begin
startpos := endpos + 1;
endpos := endpos + 6;
if endpos > NoVars then endpos := NoVars;
goto nextpart;
end;
end;
OutPutFrm.ShowModal;
ProbMat := nil;
tMatrix := nil;
NMatrix := nil;
end;
initialization
{$I rmatunit.lrs}
end.

View File

@ -0,0 +1,56 @@
object rootmethodfrm: Trootmethodfrm
Left = 246
Height = 257
Top = 136
Width = 477
Caption = 'Method to Obtain Roots'
ClientHeight = 257
ClientWidth = 477
LCLVersion = '0.9.28.2'
object MethodGroup: TRadioGroup
Left = 7
Height = 189
Top = 14
Width = 462
AutoFill = True
Caption = 'METHOD:'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 171
ClientWidth = 458
ItemIndex = 0
Items.Strings = (
'Use Veldman''s SEVS routine - Symetric matrix, unnormalized vectors, positive roots'
'Use Veldman''s AEVS routine - Nonsymetric matrix, unnormalized vectors, positive roots'
'Use Cooley-Lohnes ITER routine - Symetric matrix, normalized vectors, positive roots'
'Use Numerical Recipes routine - Symetric matrix, normalized vectors, positive roots'
'Use IMSL routine - Symetric Matrix, normalized vectors'
)
TabOrder = 0
end
object CancelBtn: TButton
Left = 112
Height = 28
Top = 217
Width = 76
Caption = 'Cancel'
ModalResult = 2
TabOrder = 1
end
object ReturnBtn: TButton
Left = 272
Height = 28
Top = 217
Width = 76
Caption = 'Return'
ModalResult = 1
OnClick = ReturnBtnClick
TabOrder = 2
end
end

View File

@ -0,0 +1,26 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('Trootmethodfrm','FORMDATA',[
'TPF0'#14'Trootmethodfrm'#13'rootmethodfrm'#4'Left'#3#246#0#6'Height'#3#1#1#3
+'Top'#3#136#0#5'Width'#3#221#1#7'Caption'#6#22'Method to Obtain Roots'#12'Cl'
+'ientHeight'#3#1#1#11'ClientWidth'#3#221#1#10'LCLVersion'#6#8'0.9.28.2'#0#11
+'TRadioGroup'#11'MethodGroup'#4'Left'#2#7#6'Height'#3#189#0#3'Top'#2#14#5'Wi'
+'dth'#3#206#1#8'AutoFill'#9#7'Caption'#6#7'METHOD:'#28'ChildSizing.LeftRight'
+'Spacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHor'
+'izontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24
+'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChi'
+'lds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Lay'
+'out'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1
+#12'ClientHeight'#3#171#0#11'ClientWidth'#3#202#1#9'ItemIndex'#2#0#13'Items.'
+'Strings'#1#6'RUse Veldman''s SEVS routine - Symetric matrix, unnormalized v'
+'ectors, positive roots'#6'UUse Veldman''s AEVS routine - Nonsymetric matrix'
+', unnormalized vectors, positive roots'#6'TUse Cooley-Lohnes ITER routine -'
+' Symetric matrix, normalized vectors, positive roots'#6'SUse Numerical Reci'
+'pes routine - Symetric matrix, normalized vectors, positive roots'#6'6Use I'
+'MSL routine - Symetric Matrix, normalized vectors'#0#8'TabOrder'#2#0#0#0#7
+'TButton'#9'CancelBtn'#4'Left'#2'p'#6'Height'#2#28#3'Top'#3#217#0#5'Width'#2
+'L'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#7'TButton'
+#9'ReturnBtn'#4'Left'#3#16#1#6'Height'#2#28#3'Top'#3#217#0#5'Width'#2'L'#7'C'
+'aption'#6#6'Return'#11'ModalResult'#2#1#7'OnClick'#7#14'ReturnBtnClick'#8'T'
+'abOrder'#2#2#0#0#0
]);

View File

@ -0,0 +1,43 @@
unit rootmethodunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ Trootmethodfrm }
Trootmethodfrm = class(TForm)
CancelBtn: TButton;
ReturnBtn: TButton;
MethodGroup: TRadioGroup;
procedure ReturnBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
Choice : integer;
end;
var
rootmethodfrm: Trootmethodfrm;
implementation
{ Trootmethodfrm }
procedure Trootmethodfrm.ReturnBtnClick(Sender: TObject);
begin
Choice := MethodGroup.ItemIndex + 1;
end;
initialization
{$I rootmethodunit.lrs}
end.

View File

@ -0,0 +1,266 @@
object Rot3DFrm: TRot3DFrm
Left = 77
Height = 577
Top = 102
Width = 757
Caption = 'Three Dimension Rotation'
ClientHeight = 577
ClientWidth = 757
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Label1: TLabel
Left = 624
Height = 14
Top = 8
Width = 93
Caption = 'Click the X, Y and Z'
ParentColor = False
end
object Label2: TLabel
Left = 623
Height = 14
Top = 24
Width = 93
Caption = 'Variables to Rotate'
ParentColor = False
end
object Label3: TLabel
Left = 600
Height = 14
Top = 256
Width = 7
Caption = 'X'
ParentColor = False
end
object Label4: TLabel
Left = 664
Height = 14
Top = 256
Width = 7
Caption = 'Y'
ParentColor = False
end
object Label5: TLabel
Left = 723
Height = 14
Top = 255
Width = 7
Caption = 'Z'
ParentColor = False
end
object Label6: TLabel
Left = 594
Height = 14
Top = 270
Width = 17
Caption = '-90'
ParentColor = False
end
object Label7: TLabel
Left = 656
Height = 14
Top = 270
Width = 17
Caption = '-90'
ParentColor = False
end
object Label8: TLabel
Left = 720
Height = 14
Top = 272
Width = 17
Caption = '-90'
ParentColor = False
end
object Label9: TLabel
Left = 598
Height = 14
Top = 448
Width = 13
Caption = '90'
ParentColor = False
end
object Label10: TLabel
Left = 660
Height = 14
Top = 448
Width = 13
Caption = '90'
ParentColor = False
end
object Label11: TLabel
Left = 723
Height = 14
Top = 448
Width = 13
Caption = '90'
ParentColor = False
end
object Label12: TLabel
Left = 641
Height = 14
Top = 472
Width = 41
Caption = 'Degrees'
ParentColor = False
end
object Label13: TLabel
Left = 16
Height = 14
Top = 537
Width = 7
Caption = 'X'
ParentColor = False
end
object Label14: TLabel
Left = 112
Height = 14
Top = 538
Width = 7
Caption = 'Y'
ParentColor = False
end
object Label15: TLabel
Left = 201
Height = 14
Top = 536
Width = 7
Caption = 'Z'
ParentColor = False
end
object Image1: TImage
Left = 8
Height = 500
Top = 7
Width = 562
end
object VarList: TListBox
Left = 593
Height = 204
Top = 40
Width = 147
OnClick = VarListClick
TabOrder = 0
end
object XScroll: TScrollBar
Left = 594
Height = 151
Top = 288
Width = 22
Kind = sbVertical
TabOrder = 1
OnScroll = XScrollScroll
end
object YScroll: TScrollBar
Left = 656
Height = 151
Top = 288
Width = 22
Kind = sbVertical
TabOrder = 2
OnScroll = YScrollScroll
end
object ZScroll: TScrollBar
Left = 720
Height = 151
Top = 288
Width = 19
Kind = sbVertical
TabOrder = 3
OnScroll = ZScrollScroll
end
object XDegEdit: TEdit
Left = 590
Height = 19
Top = 489
Width = 35
TabOrder = 4
Text = 'XDegEdit'
end
object YDegEdit: TEdit
Left = 656
Height = 19
Top = 489
Width = 35
TabOrder = 5
Text = 'XDegEdit'
end
object ZDegEdit: TEdit
Left = 712
Height = 19
Top = 489
Width = 35
TabOrder = 6
Text = 'XDegEdit'
end
object XEdit: TEdit
Left = 33
Height = 16
Top = 535
Width = 57
TabOrder = 7
Text = 'XEdit'
end
object YEdit: TEdit
Left = 127
Height = 18
Top = 534
Width = 57
TabOrder = 8
Text = 'YEdit'
end
object ZEdit: TEdit
Left = 214
Height = 16
Top = 535
Width = 56
TabOrder = 9
Text = 'ZEdit'
end
object ResetBtn: TButton
Left = 383
Height = 29
Top = 528
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 10
end
object CancelBtn: TButton
Left = 480
Height = 29
Top = 528
Width = 78
Caption = 'Cancel'
ModalResult = 2
OnClick = CancelBtnClick
TabOrder = 11
end
object PrintBtn: TButton
Left = 576
Height = 29
Top = 528
Width = 78
Caption = 'Print'
OnClick = PrintBtnClick
TabOrder = 12
end
object ReturnBtn: TButton
Left = 669
Height = 29
Top = 528
Width = 78
Caption = 'Return'
ModalResult = 1
OnClick = ReturnBtnClick
TabOrder = 13
end
object PrintDialog1: TPrintDialog
left = 315
top = 527
end
object PrinterSetupDialog1: TPrinterSetupDialog
left = 277
top = 518
end
end

View File

@ -0,0 +1,61 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRot3DFrm','FORMDATA',[
'TPF0'#9'TRot3DFrm'#8'Rot3DFrm'#4'Left'#2'M'#6'Height'#3'A'#2#3'Top'#2'f'#5'W'
+'idth'#3#245#2#7'Caption'#6#24'Three Dimension Rotation'#12'ClientHeight'#3
+'A'#2#11'ClientWidth'#3#245#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9'
+'.26.2'#0#6'TLabel'#6'Label1'#4'Left'#3'p'#2#6'Height'#2#14#3'Top'#2#8#5'Wid'
+'th'#2']'#7'Caption'#6#20'Click the X, Y and Z'#11'ParentColor'#8#0#0#6'TLab'
+'el'#6'Label2'#4'Left'#3'o'#2#6'Height'#2#14#3'Top'#2#24#5'Width'#2']'#7'Cap'
+'tion'#6#19'Variables to Rotate'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4
+'Left'#3'X'#2#6'Height'#2#14#3'Top'#3#0#1#5'Width'#2#7#7'Caption'#6#1'X'#11
+'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#152#2#6'Height'#2#14#3'Top'
+#3#0#1#5'Width'#2#7#7'Caption'#6#1'Y'#11'ParentColor'#8#0#0#6'TLabel'#6'Labe'
+'l5'#4'Left'#3#211#2#6'Height'#2#14#3'Top'#3#255#0#5'Width'#2#7#7'Caption'#6
+#1'Z'#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#4'Left'#3'R'#2#6'Height'#2#14
+#3'Top'#3#14#1#5'Width'#2#17#7'Caption'#6#3'-90'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#6'Label7'#4'Left'#3#144#2#6'Height'#2#14#3'Top'#3#14#1#5'Width'#2#17#7
+'Caption'#6#3'-90'#11'ParentColor'#8#0#0#6'TLabel'#6'Label8'#4'Left'#3#208#2
+#6'Height'#2#14#3'Top'#3#16#1#5'Width'#2#17#7'Caption'#6#3'-90'#11'ParentCol'
+'or'#8#0#0#6'TLabel'#6'Label9'#4'Left'#3'V'#2#6'Height'#2#14#3'Top'#3#192#1#5
+'Width'#2#13#7'Caption'#6#2'90'#11'ParentColor'#8#0#0#6'TLabel'#7'Label10'#4
+'Left'#3#148#2#6'Height'#2#14#3'Top'#3#192#1#5'Width'#2#13#7'Caption'#6#2'90'
+#11'ParentColor'#8#0#0#6'TLabel'#7'Label11'#4'Left'#3#211#2#6'Height'#2#14#3
+'Top'#3#192#1#5'Width'#2#13#7'Caption'#6#2'90'#11'ParentColor'#8#0#0#6'TLabe'
+'l'#7'Label12'#4'Left'#3#129#2#6'Height'#2#14#3'Top'#3#216#1#5'Width'#2')'#7
+'Caption'#6#7'Degrees'#11'ParentColor'#8#0#0#6'TLabel'#7'Label13'#4'Left'#2
+#16#6'Height'#2#14#3'Top'#3#25#2#5'Width'#2#7#7'Caption'#6#1'X'#11'ParentCol'
+'or'#8#0#0#6'TLabel'#7'Label14'#4'Left'#2'p'#6'Height'#2#14#3'Top'#3#26#2#5
+'Width'#2#7#7'Caption'#6#1'Y'#11'ParentColor'#8#0#0#6'TLabel'#7'Label15'#4'L'
+'eft'#3#201#0#6'Height'#2#14#3'Top'#3#24#2#5'Width'#2#7#7'Caption'#6#1'Z'#11
+'ParentColor'#8#0#0#6'TImage'#6'Image1'#4'Left'#2#8#6'Height'#3#244#1#3'Top'
+#2#7#5'Width'#3'2'#2#0#0#8'TListBox'#7'VarList'#4'Left'#3'Q'#2#6'Height'#3
+#204#0#3'Top'#2'('#5'Width'#3#147#0#7'OnClick'#7#12'VarListClick'#8'TabOrder'
+#2#0#0#0#10'TScrollBar'#7'XScroll'#4'Left'#3'R'#2#6'Height'#3#151#0#3'Top'#3
+' '#1#5'Width'#2#22#4'Kind'#7#10'sbVertical'#8'TabOrder'#2#1#8'OnScroll'#7#13
+'XScrollScroll'#0#0#10'TScrollBar'#7'YScroll'#4'Left'#3#144#2#6'Height'#3#151
+#0#3'Top'#3' '#1#5'Width'#2#22#4'Kind'#7#10'sbVertical'#8'TabOrder'#2#2#8'On'
+'Scroll'#7#13'YScrollScroll'#0#0#10'TScrollBar'#7'ZScroll'#4'Left'#3#208#2#6
+'Height'#3#151#0#3'Top'#3' '#1#5'Width'#2#19#4'Kind'#7#10'sbVertical'#8'TabO'
+'rder'#2#3#8'OnScroll'#7#13'ZScrollScroll'#0#0#5'TEdit'#8'XDegEdit'#4'Left'#3
+'N'#2#6'Height'#2#19#3'Top'#3#233#1#5'Width'#2'#'#8'TabOrder'#2#4#4'Text'#6#8
+'XDegEdit'#0#0#5'TEdit'#8'YDegEdit'#4'Left'#3#144#2#6'Height'#2#19#3'Top'#3
+#233#1#5'Width'#2'#'#8'TabOrder'#2#5#4'Text'#6#8'XDegEdit'#0#0#5'TEdit'#8'ZD'
+'egEdit'#4'Left'#3#200#2#6'Height'#2#19#3'Top'#3#233#1#5'Width'#2'#'#8'TabOr'
+'der'#2#6#4'Text'#6#8'XDegEdit'#0#0#5'TEdit'#5'XEdit'#4'Left'#2'!'#6'Height'
+#2#16#3'Top'#3#23#2#5'Width'#2'9'#8'TabOrder'#2#7#4'Text'#6#5'XEdit'#0#0#5'T'
+'Edit'#5'YEdit'#4'Left'#2''#6'Height'#2#18#3'Top'#3#22#2#5'Width'#2'9'#8'Ta'
+'bOrder'#2#8#4'Text'#6#5'YEdit'#0#0#5'TEdit'#5'ZEdit'#4'Left'#3#214#0#6'Heig'
+'ht'#2#16#3'Top'#3#23#2#5'Width'#2'8'#8'TabOrder'#2#9#4'Text'#6#5'ZEdit'#0#0
+#7'TButton'#8'ResetBtn'#4'Left'#3''#1#6'Height'#2#29#3'Top'#3#16#2#5'Width'
+#2'N'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#10#0
+#0#7'TButton'#9'CancelBtn'#4'Left'#3#224#1#6'Height'#2#29#3'Top'#3#16#2#5'Wi'
+'dth'#2'N'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#7'OnClick'#7#14'Cancel'
+'BtnClick'#8'TabOrder'#2#11#0#0#7'TButton'#8'PrintBtn'#4'Left'#3'@'#2#6'Heig'
+'ht'#2#29#3'Top'#3#16#2#5'Width'#2'N'#7'Caption'#6#5'Print'#7'OnClick'#7#13
+'PrintBtnClick'#8'TabOrder'#2#12#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#157#2
+#6'Height'#2#29#3'Top'#3#16#2#5'Width'#2'N'#7'Caption'#6#6'Return'#11'ModalR'
+'esult'#2#1#7'OnClick'#7#14'ReturnBtnClick'#8'TabOrder'#2#13#0#0#12'TPrintDi'
+'alog'#12'PrintDialog1'#4'left'#3';'#1#3'top'#3#15#2#0#0#19'TPrinterSetupDia'
+'log'#19'PrinterSetupDialog1'#4'left'#3#21#1#3'top'#3#6#2#0#0#0
]);

View File

@ -0,0 +1,564 @@
unit Rot3DUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls,MainUnit, Globals, functionsLib, OutPutUnit, DataProcs,
Printers, PrintersDlgs;
type
{ TRot3DFrm }
TRot3DFrm = class(TForm)
Image1: TImage;
PrintDialog1: TPrintDialog;
PrinterSetupDialog1: TPrinterSetupDialog;
ResetBtn: TButton;
CancelBtn: TButton;
PrintBtn: TButton;
ReturnBtn: TButton;
ZEdit: TEdit;
Label15: TLabel;
YEdit: TEdit;
Label14: TLabel;
XEdit: TEdit;
Label13: TLabel;
XDegEdit: TEdit;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
XScroll: TScrollBar;
YScroll: TScrollBar;
ZScroll: TScrollBar;
VarList: TListBox;
YDegEdit: TEdit;
ZDegEdit: TEdit;
procedure CancelBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure PrintBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure ReturnBtnClick(Sender: TObject);
procedure VarListClick(Sender: TObject);
procedure XScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure YScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure ZScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
private
{ private declarations }
DXmax, DXmin, DYmax, DYmin : integer;
WXleft, WXright, WYtop, WYbottom, RX, RY, RZ : double;
SINRX, COSRX, SINRY, COSRY, SINRZ, COSRZ : double;
GridColX, GridColY, GridColZ : integer;
degX, degY, degZ : double;
XScaled : DblDyneVec;
YScaled : DblDyneVec;
ZScaled : DblDyneVec;
procedure Rotate(Sender: TObject);
function DegToRad(deg : double; Sender: TObject) : double;
function World3DToWorld2D(p : POINT3D; Sender: TObject) : POINT3D;
function World2DToDevice(p :POINT3D; Sender: TObject) : POINTint;
procedure drawpoint( p1 : POINT3D; Sender: TObject);
procedure drawline(p1, p2 : POINT3D; Sender: TObject);
procedure drawaxis(Sender: TObject);
procedure SetAxesAngles(rx1, ry1, rz1 : double; Sender: TObject);
procedure ScaleValues(Sender: TObject);
procedure eraseaxis(Sender: TObject);
public
{ public declarations }
end;
var
Rot3DFrm: TRot3DFrm;
implementation
{ TRot3DFrm }
procedure TRot3DFrm.ResetBtnClick(Sender: TObject);
var i : integer;
begin
VarList.Items.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
XScroll.Position := 0;
YScroll.Position := 0;
ZScroll.Position := 0;
// set device limits
DXmin := 36;
DXmax := 436;
DYmin := 36;
DYmax := 436;
// set world limits
WXleft := -1.0;
WYbottom := -1.0;
WXright := 1.0;
WYtop := 1.0;
XDegEdit.Text := '0';
YDegEdit.Text := '0';
ZDegEdit.Text := '0';
XEdit.Text := '';
YEdit.Text := '';
ZEdit.Text := '';
end;
procedure TRot3DFrm.ReturnBtnClick(Sender: TObject);
begin
ZScaled := nil;
YScaled := nil;
XScaled := nil;
Rot3DFrm.Hide;
end;
procedure TRot3DFrm.VarListClick(Sender: TObject);
var
i, index : integer;
Xvar, Yvar, Zvar : string;
begin
index := VarList.ItemIndex;
if XEdit.Text = '' then
begin
XEdit.Text := VarList.Items.Strings[index];
exit;
end;
if YEdit.Text = '' then
begin
YEdit.Text := VarList.Items.Strings[index];
exit;
end;
ZEdit.Text := VarList.Items.Strings[index];
// Get column no.s of selected variables
Xvar := XEdit.Text;
Yvar := YEdit.Text;
Zvar := ZEdit.Text;
for i := 1 to NoVariables do
begin
if Xvar = OS3MainFrm.DataGrid.Cells[i,0] then GridColX := i;
if Yvar = OS3MainFrm.DataGrid.Cells[i,0] then GridColY := i;
if Zvar = OS3MainFrm.DataGrid.Cells[i,0] then GridColZ := i;
end;
ScaleValues(self); // get scaled X, y and Z values (-1.0 to 1.0)
XScroll.Position := 20;
YScroll.Position := -15;
ZScroll.Position := -5;
Canvas.Pen.Color := clBlack;
Rotate(self);
end;
procedure TRot3DFrm.XScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
Rotate(self);
end;
procedure TRot3DFrm.YScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
Rotate(self);
end;
procedure TRot3DFrm.ZScrollScroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
Rotate(self);
end;
procedure TRot3DFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRot3DFrm.PrintBtnClick(Sender: TObject);
var
labelstr : string;
p1, p2, p, pa, pb : POINT3D;
p11, p22 : POINTint;
i, t, X : integer;
offset, Clwidth, Clheight : double;
begin
labelstr := '3D PLOT';
Clwidth := Printer.PageWidth;
Clheight := Clwidth;
offset := Clwidth / 20.0;
Clwidth := Clwidth - (Clwidth / 20.0);
Printer.BeginDoc;
// First, draw axis
p1.x := -1;
p1.y := 0;
p1.z := 0;
p2.x := 1;
p2.y := 0;
p2.z := 0;
Printer.Canvas.Pen.Color := clRed;
//draw a 3d line
p1.z := -p1.z;
p2.z := -p2.z;
pa := World3DToWorld2D(p1,self);
pb := World3DToWorld2D(p2,self);
// scale it up
p11.x := round((WXleft-pa.x)*(Clwidth-offset) / (WXleft - WXright)+ offset + 0.5);
p11.y := round((WYtop-pa.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
p22.x := round((WXleft-pb.x)*(Clwidth-offset) / (WXleft - WXright) + offset + 0.5);
p22.y := round((WYtop-pb.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
Printer.Canvas.MoveTo(p11.x,p11.y);
Printer.Canvas.LineTo(p22.x,p22.y);
p1.x := 0;
p1.y := -1;
p2.x := 0;
p2.y := 1;
p2.z := 0;
Printer.Canvas.Pen.Color := clBlue;
//draw a 3d line
p1.z := -p1.z;
p2.z := -p2.z;
pa := World3DToWorld2D(p1,self);
pb := World3DToWorld2D(p2,self);
// scale it up
p11.x := round((WXleft-pa.x)*(Clwidth-offset) / (WXleft - WXright)+ offset + 0.5);
p11.y := round((WYtop-pa.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
p22.x := round((WXleft-pb.x)*(Clwidth-offset) / (WXleft - WXright) + offset + 0.5);
p22.y := round((WYtop-pb.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
Printer.Canvas.MoveTo(p11.x,p11.y);
Printer.Canvas.LineTo(p22.x,p22.y);
p1.y := 0;
p1.z := -1;
p2.x := 0;
p2.y := 0;
p2.z := 1;
Printer.Canvas.Pen.Color := clGreen;
//draw a 3d line
p1.z := -p1.z;
p2.z := -p2.z;
pa := World3DToWorld2D(p1,self);
pb := World3DToWorld2D(p2,self);
// scale it up
p11.x := round((WXleft-pa.x)*(Clwidth-offset) / (WXleft - WXright)+ offset + 0.5);
p11.y := round((WYtop-pa.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
p22.x := round((WXleft-pb.x)*(Clwidth-offset) / (WXleft - WXright) + offset + 0.5);
p22.y := round((WYtop-pb.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
Printer.Canvas.MoveTo(p11.x,p11.y);
Printer.Canvas.LineTo(p22.x,p22.y);
Printer.Canvas.Pen.Color := clBlack;
//Now, plot points
for i := 1 to NoCases do
begin
p.x := XScaled[i];
p.y := YScaled[i];
p.z := ZScaled[i];
// draws a 3d point
p.z := -p.z;
pa := World3DToWorld2D(p,self);
// scale it up
p11.x := round((WXleft-pa.x)*(Clwidth-offset) / (WXleft - WXright) + offset + 0.5);
p11.y := round((WYtop-pa.y)*(Clheight-offset) / (WYtop-WYbottom) + offset + 0.5);
Printer.Canvas.Rectangle(p11.x - 4,p11.y - 4,p11.x + 4, p11.y + 4);
end;
// Print Heading
t := Printer.Canvas.TextWidth(labelstr);
X := round((Clwidth / 2.0) - (t / 2.0));
Printer.Canvas.TextOut(X,0,labelstr);
labelstr := 'RED := X, BLUE := Y, GREEN := Z';
t := Printer.Canvas.TextWidth(labelstr);
X := round((Clwidth / 2.0) - (t / 2.0));
Printer.Canvas.TextOut(X,round(Clheight),labelstr);
labelstr := XEdit.Text;
labelstr := labelstr + ' ';
labelstr := labelstr + YEdit.Text;
labelstr := labelstr + ' ';
labelstr := labelstr + ZEdit.Text;
t := Printer.Canvas.TextWidth(labelstr);
X := round((Clwidth / 2.0) - (t / 2.0));
Printer.Canvas.TextOut(X,round(Clheight+40.0),labelstr);
labelstr := 'ROTATION: X deg. := ';
labelstr := labelstr + XDegEdit.Text;
labelstr := labelstr + ' Y deg. := ';
labelstr := labelstr + YDegEdit.Text;
labelstr := labelstr + ' Z deg. := ';
labelstr := labelstr + ZDegEdit.Text;
t := Printer.Canvas.TextWidth(labelstr);
X := round((Clwidth / 2.0) - (t / 2));
Printer.Canvas.TextOut(X,round(Clheight+80.0),labelstr);
Printer.EndDoc; // finish printing
end;
procedure TRot3DFrm.CancelBtnClick(Sender: TObject);
begin
ZScaled := nil;
YScaled := nil;
XScaled := nil;
Rot3DFrm.Hide;
end;
procedure TRot3DFrm.Rotate(Sender: TObject);
var
p : POINT3D;
i : integer;
begin
Image1.Canvas.Brush.Style := bsSolid;
Image1.Canvas.Brush.Color := clWhite;
Image1.Canvas.Pen.Color := clBlack;
Image1.Canvas.Rectangle(20,20,460,460);
//First, erase current points
Image1.Canvas.Pen.Color := clWhite;
Image1.Canvas.Brush.Color := clWhite;
for i := 1 to NoCases do
begin
p.x := XScaled[i];
p.y := YScaled[i];
p.z := ZScaled[i];
drawpoint(p,self);
end;
eraseaxis(self);
Image1.Canvas.Brush.Color := clBlack;
Image1.Canvas.Pen.Color := clBlack;
degX := XScroll.Position;
degY := YScroll.Position;
degZ := ZScroll.Position;
XDegEdit.Text := IntToStr(XScroll.Position);
YDegEdit.Text := IntToStr(YScroll.Position);
ZDegEdit.Text := IntToStr(ZScroll.Position);
SetAxesAngles(degX, degY, degZ,self);
drawaxis(self);
for i := 1 to NoCases do
begin
p.x := XScaled[i];
p.y := YScaled[i];
p.z := ZScaled[i];
drawpoint(p,self);
end;
end;
//---------------------------------------------------------------------------
function TRot3DFrm.DegToRad(deg : double; Sender: TObject) : double;
begin
Result := deg * PI / 180.0;
end;
//---------------------------------------------------------------------------
function TRot3DFrm.World3DToWorld2D(p : POINT3D; Sender: TObject) : POINT3D;
var
ptemp : POINT3D;
begin
ptemp := p;
if RX <> 0.0 then begin
ptemp.x := p.x;
ptemp.y := COSRX * p.y - SINRX * p.z;
ptemp.z := SINRX * p.y + COSRX * p.z;
p := ptemp;
end;
if RY <> 0.0 then begin
ptemp.x := COSRY * p.x + SINRY * p.z;
ptemp.y := p.y;
ptemp.z := SINRY * p.x + COSRY * p.z;
p := ptemp;
end;
if RZ <> 0.0 then begin
ptemp.x := COSRZ * p.x - SINRZ * p.y;
ptemp.y := SINRZ * p.x + COSRZ * p.y;
ptemp.z := p.z;
end;
if abs(ptemp.x) < TOL then ptemp.x := 0.0;
if abs(ptemp.y) < TOL then ptemp.y := 0.0;
if abs(ptemp.z) < TOL then ptemp.z := 0.0;
Result := ptemp;
end;
//---------------------------------------------------------------------------
function TRot3DFrm.World2DToDevice(p :POINT3D; Sender: TObject) : POINTint;
var
ptemp : POINTint;
begin
ptemp.x := round((WXleft - p.x) * (DXmax - DXmin) / (WXleft - WXright) + DXmin + 0.5);
ptemp.y := round((WYtop - p.y) * (DYmax - DYmin) / (WYtop - WYbottom) + DYmin + 0.5);
Result := ptemp;
end;
//---------------------------------------------------------------------------
procedure TRot3DFrm.drawpoint( p1 : POINT3D; Sender: TObject);
var
p2 : POINTint;
begin
// draws a 3d point
p1.z := -p1.z;
p2 := World2DToDevice(World3DToWorld2D(p1,self),self);
Image1.Canvas.Rectangle(p2.x - 2,p2.y - 2,p2.x + 2, p2.y + 2);
end;
//---------------------------------------------------------------------------
procedure TRot3DFrm.drawline(p1, p2 : POINT3D; Sender: TObject);
var
p11, p22 : POINTint;
begin
//draws a 3d line
p1.z := -p1.z;
p2.z := -p2.z;
p11 := World2DToDevice(World3DToWorld2D(p1,self),self);
p22 := World2DToDevice(World3DToWorld2D(p2,self),self);
Image1.Canvas.MoveTo(p11.x,p11.y);
Image1.Canvas.LineTo(p22.x,p22.y);
end;
//---------------------------------------------------------------------------
procedure TRot3DFrm.drawaxis(Sender: TObject);
var
p1, p2 : POINT3D;
begin
p1.x := -1;
p1.y := 0;
p1.z := 0;
p2.x := 1;
p2.y := 0;
p2.z := 0;
Image1.Canvas.Pen.Color := clRed;
drawline(p1,p2,self);
p1.x := 0;
p1.y := -1;
p2.x := 0;
p2.y := 1;
p2.z := 0;
Image1.Canvas.Pen.Color := clBlue;
drawline(p1,p2,self);
p1.y := 0;
p1.z := -1;
p2.x := 0;
p2.y := 0;
p2.z := 1;
Image1.Canvas.Pen.Color := clGreen;
drawline(p1,p2,self);
Image1.Canvas.Pen.Color := clWhite;
end;
//---------------------------------------------------------------------------
procedure TRot3DFrm.SetAxesAngles(rx1, ry1, rz1 : double; Sender: TObject);
begin
RX := DegToRad(rx1,self);
RY := DegToRad(ry1,self);
RZ := DegToRad(rz1,self);
COSRX := cos(RX);
SINRX := sin(RX);
COSRY := cos(RY);
SINRY := sin(RY);
COSRZ := cos(RZ);
SINRZ := sin(RZ);
end;
//---------------------------------------------------------------------------
procedure TRot3DFrm.ScaleValues(Sender: TObject);
var
Xmax, Ymax, Zmax, Xmin, Ymin, Zmin, value, prop : double;
i, NoSelected : integer;
ColNoSelected : IntDyneVec;
begin
// This routine scales the X, Y and Z values in the grid to new
// values ranging from -1 to 1 for each. The arrays of scaled
// values are pointed to by the private float pointers XScaled,
// YScaled and ZScaled;
SetLength(ColNoSelected,NoVariables);
SetLength(XScaled,NoCases+1);
SetLength(YScaled,NoCases+1);
SetLength(ZScaled,NoCases+1);
ColNoSelected[0] := GridColX;
ColNoSelected[1] := GridColY;
ColNoSelected[2] := GridColZ;
NoSelected := 3;
Xmax := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColX,1]);
Xmin := Xmax;
Ymin := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColY,1]);
Ymax := Ymin;
Zmax := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColZ,1]);
Zmin := Zmax;
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
value := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColX,i]);
if (value > Xmax) then Xmax := value;
if (value < Xmin) then Xmin := value;
value := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColY,i]);
if (value > Ymax) then Ymax := value;
if (value < Ymin) then Ymin := value;
value := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColZ,i]);
if (value > Zmax) then Zmax := value;
if (value < Zmin) then Zmin := value;
end;
// now scale values
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
value := StrTofloat(OS3MainFrm.DataGrid.Cells[GridColX,i]);
prop := (Xmax - value) / (Xmax - Xmin);
XScaled[i] := prop - 0.5; //scale between -1 and +1
value := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColY,i]);
prop := (Ymax - value) / (Ymax - Ymin);
YScaled[i] := prop - 0.5;
value := StrToFloat(OS3MainFrm.DataGrid.Cells[GridColZ,i]);
prop := (Zmax - value) / (Zmax - Zmin);
ZScaled[i] := prop - 0.5;
end;
ColNoSelected := nil;
end;
//-------------------------------------------------------------------
procedure TRot3DFrm.eraseaxis(Sender: TObject);
var
p1, p2 : POINT3D;
begin
p1.x := -1;
p1.y := 0;
p1.z := 0;
p2.x := 1;
p2.y := 0;
p2.z := 0;
Image1.Canvas.Pen.Color := clWhite;
drawline(p1,p2,self);
p1.x := 0;
p1.y := -1;
p2.x := 0;
p2.y := 1;
p2.z := 0;
drawline(p1,p2,self);
p1.y := 0;
p1.z := -1;
p2.x := 0;
p2.y := 0;
p2.z := 1;
drawline(p1,p2,self);
end;
initialization
{$I rot3dunit.lrs}
end.

View File

@ -0,0 +1,77 @@
object RotateFrm: TRotateFrm
Left = 135
Height = 442
Top = 95
Width = 662
Caption = 'Manual Rotation of Factors'
ClientHeight = 442
ClientWidth = 662
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Image1: TImage
Height = 396
Width = 662
Align = alClient
end
object Panel1: TPanel
Height = 46
Top = 396
Width = 662
Align = alBottom
ClientHeight = 46
ClientWidth = 662
TabOrder = 0
object Label1: TLabel
Left = 6
Height = 14
Top = 16
Width = 78
Caption = 'Points Rotation:'
ParentColor = False
end
object DegEdit: TEdit
Left = 88
Height = 18
Top = 10
Width = 36
TabOrder = 0
Text = 'DegEdit'
end
object ScrollBar1: TScrollBar
Left = 137
Height = 21
Top = 10
Width = 141
TabOrder = 1
OnChange = ScrollBar1Change
end
object NextBtn: TButton
Left = 296
Height = 30
Top = 10
Width = 80
Caption = 'Next Pair'
OnClick = NextBtnClick
TabOrder = 2
end
end
object PrintBtn: TButton
Left = 416
Height = 28
Top = 408
Width = 80
Caption = 'Print'
OnClick = PrintBtnClick
TabOrder = 1
end
object ReturnBtn: TButton
Left = 536
Height = 28
Top = 408
Width = 80
Caption = 'Return'
ModalResult = 1
OnClick = ReturnBtnClick
TabOrder = 2
end
end

View File

@ -0,0 +1,23 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TRotateFrm','FORMDATA',[
'TPF0'#10'TRotateFrm'#9'RotateFrm'#4'Left'#3#135#0#6'Height'#3#186#1#3'Top'#2
+'_'#5'Width'#3#150#2#7'Caption'#6#26'Manual Rotation of Factors'#12'ClientHe'
+'ight'#3#186#1#11'ClientWidth'#3#150#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'
+#6#8'0.9.26.2'#0#6'TImage'#6'Image1'#6'Height'#3#140#1#5'Width'#3#150#2#5'Al'
+'ign'#7#8'alClient'#0#0#6'TPanel'#6'Panel1'#6'Height'#2'.'#3'Top'#3#140#1#5
+'Width'#3#150#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'.'#11'ClientWidth'
+#3#150#2#8'TabOrder'#2#0#0#6'TLabel'#6'Label1'#4'Left'#2#6#6'Height'#2#14#3
+'Top'#2#16#5'Width'#2'N'#7'Caption'#6#16'Points Rotation:'#11'ParentColor'#8
+#0#0#5'TEdit'#7'DegEdit'#4'Left'#2'X'#6'Height'#2#18#3'Top'#2#10#5'Width'#2
+'$'#8'TabOrder'#2#0#4'Text'#6#7'DegEdit'#0#0#10'TScrollBar'#10'ScrollBar1'#4
+'Left'#3#137#0#6'Height'#2#21#3'Top'#2#10#5'Width'#3#141#0#8'TabOrder'#2#1#8
+'OnChange'#7#16'ScrollBar1Change'#0#0#7'TButton'#7'NextBtn'#4'Left'#3'('#1#6
+'Height'#2#30#3'Top'#2#10#5'Width'#2'P'#7'Caption'#6#9'Next Pair'#7'OnClick'
+#7#12'NextBtnClick'#8'TabOrder'#2#2#0#0#0#7'TButton'#8'PrintBtn'#4'Left'#3
+#160#1#6'Height'#2#28#3'Top'#3#152#1#5'Width'#2'P'#7'Caption'#6#5'Print'#7'O'
+'nClick'#7#13'PrintBtnClick'#8'TabOrder'#2#1#0#0#7'TButton'#9'ReturnBtn'#4'L'
+'eft'#3#24#2#6'Height'#2#28#3'Top'#3#152#1#5'Width'#2'P'#7'Caption'#6#6'Retu'
+'rn'#11'ModalResult'#2#1#7'OnClick'#7#14'ReturnBtnClick'#8'TabOrder'#2#2#0#0
+#0
]);

View File

@ -0,0 +1,251 @@
unit RotateUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, Printers, Globals;
type
{ TRotateFrm }
TRotateFrm = class(TForm)
Image1: TImage;
NextBtn: TButton;
PrintBtn: TButton;
ReturnBtn: TButton;
DegEdit: TEdit;
Label1: TLabel;
Panel1: TPanel;
ScrollBar1: TScrollBar;
procedure FormShow(Sender: TObject);
procedure NextBtnClick(Sender: TObject);
procedure PrintBtnClick(Sender: TObject);
procedure ReturnBtnClick(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
private
{ private declarations }
Axis1, Axis2 : integer;
ClWidth, ClHeight, XStart, XEnd, YStart, YEnd : integer;
Xoffset, Yoffset, XaxisLength, YaxisLength : integer;
Axis1Pos, Axis2Pos : integer;
q : DblDyneMat;
procedure PlotPts(AxisOne, AxisTwo : integer; acolor : TColor; Sender : TObject);
procedure DrawAxis(Sender : TObject);
public
{ public declarations }
Loadings : DblDyneMat;
NoVars : integer;
NoRoots : integer;
RowLabels : StrDyneVec;
ColLabels : StrDyneVec;
Order : IntDyneVec;
end;
var
RotateFrm: TRotateFrm;
implementation
{ TRotateFrm }
procedure TRotateFrm.ReturnBtnClick(Sender: TObject);
VAR i, j : integer;
begin
for i := 1 to NoVars do
BEGIN
for j := 1 to NoRoots do Loadings[i-1,j-1] := q[i-1,j-1];
END;
q := nil;
RotateFrm.Hide;
end;
procedure TRotateFrm.ScrollBar1Change(Sender: TObject);
var
D, A, B : double;
i, j, l : integer;
AxisOne, AxisTwo : integer;
begin
AxisOne := Axis1;
AxisTwo := Axis2;
PlotPts(AxisOne,AxisTwo,clWhite,self); // erase previous
DrawAxis(self);
for i := 1 to NoVars do
begin
for j := 1 to NoRoots do q[i-1,j-1] := Loadings[i-1,j-1];
end;
D := ScrollBar1.Position;
DegEdit.Text := FloatToStr(D);
D := D / 57.2958; // convert to radians
for l := 1 to NoVars do
BEGIN
A := sin(D);
B := cos(D);
q[l-1,AxisOne-1] := Loadings[l-1,AxisOne-1] * B - Loadings[l-1,AxisTwo-1] * A;
q[l-1,AxisTwo-1] := Loadings[l-1,AxisOne-1] * A + Loadings[l-1,AxisTwo-1] * B;
END;
PlotPts(AxisOne,AxisTwo,clBlack,self); // plot new
end;
procedure TRotateFrm.FormShow(Sender: TObject);
VAR i, j : integer;
begin
if NoRoots < 2 then
begin
ShowMessage('ERROR! Only 1 factor-exiting');
exit;
end;
SetLength(q,NoVars,NoVars);
for i := 1 to NoVars do
begin
for j := 1 to NoRoots do q[i-1,j-1] := Loadings[i-1,j-1];
end;
ClWidth := Image1.Width;
ClHeight := Image1.Height;
XOffset := ClWidth div 10;
YOffset := ClHeight div 10;
XStart := Xoffset;
XEnd := ClWidth - XOffset;
XAxisLength := XEnd - XStart;
YStart := ClHeight - YOffset;
YEnd := YOffset;
YAxisLength := YStart - YEnd;
Image1.Canvas.Brush.Color := clWhite;
Image1.Canvas.Pen.Color := clBlack;
Image1.Canvas.Rectangle(0,0,ClWidth,ClHeight);
Axis1 := 1;
Axis2 := 2;
Axis2Pos := XAxisLength div 2 + XStart; // position of y axis from left
Axis1Pos := YAxisLength div 2 + YEnd; // position of X axis from top
ScrollBar1.Position := 0;
DrawAxis(self);
PlotPts(Axis1, Axis2, clBlack, self);
end;
procedure TRotateFrm.NextBtnClick(Sender: TObject);
VAR i, j : integer;
begin
if (Axis2 = NoRoots) and (Axis1 = NoRoots-1) then
begin
ShowMessage('ALL DONE! All pairs completed.');
exit;
end;
PlotPts(Axis1,Axis2,clWhite,self);
for i := 1 to NoVars do
BEGIN
for j := 1 to NoRoots do Loadings[i-1,j-1] := q[i-1,j-1];
END;
Axis2 := Axis2 + 1;
if Axis2 <= NoRoots then
begin
ScrollBar1.Position := 0;
DrawAxis(self);
PlotPts(Axis1,Axis2,clBlack,self);
exit;
end;
Axis1 := Axis1 + 1;
Axis2 := Axis1 + 1;
if Axis2 > NoRoots then exit;
ScrollBar1.Position := 0;
DrawAxis(self);
PlotPts(Axis1,Axis2,clBlack,self);
end;
procedure TRotateFrm.PrintBtnClick(Sender: TObject);
var r : Trect;
begin
with Printer do
begin
Printer.Orientation := poPortrait;
r := Rect(20,20,printer.pagewidth-20,printer.pageheight div 2 + 20);
BeginDoc;
Canvas.StretchDraw(r,Image1.Picture.BitMap);
EndDoc;
end;
end;
procedure TRotateFrm.PlotPts(AxisOne, AxisTwo: integer; acolor: TColor;
Sender: TObject);
var i, xpos, ypos, xmid, ymid, size : integer;
begin
xmid := Axis2Pos;
ymid := Axis1Pos;
Image1.Canvas.Pen.Color := acolor;
// if color <> clWhite then size := 2 else size := 4;
size := 4;
for i := 1 to NoVars do
begin
if q[i-1,AxisOne-1] >= 0 then // positive x value
begin
xpos := round(q[i-1,AxisOne-1] * (XAxisLength div 2));
xpos := xpos + xmid;
end
else // negative x value (factor 1)
begin
xpos := round(abs(q[i-1,AxisOne-1]) * (XAxisLength div 2));
xpos := xmid - xpos;
end;
if q[i-1,AxisTwo-1] >= 0 then // positive y value (factor 2)
begin
ypos := round(q[i-1,AxisTwo-1] * (YAxisLength div 2));
ypos := ymid - ypos;
end
else // negative y factor loading
begin
ypos := round(abs(q[i-1,AxisTwo-1]) * (YAxisLength div 2));
ypos := ymid + ypos;
end;
Image1.Canvas.Ellipse(xpos-size,ypos-size,xpos+size,Ypos+size);
end;
DrawAxis(self);
end;
procedure TRotateFrm.DrawAxis(Sender: TObject);
var
i, xincr, yincr, TextLong : integer;
step : double;
Title : string;
begin
xincr := XAxisLength div 10;
yincr := YAxisLength div 10;
// draw X axis
Image1.Canvas.MoveTo(XOffset,Axis1Pos);
Image1.Canvas.LineTo(XEnd,Axis1Pos);
Title := 'Factor ' + IntToStr(Axis1);
Image1.Canvas.TextOut(0,Axis1Pos,Title);
step := -1.0;
for i := 0 to 10 do
begin
Title := format('%4.1f',[step]);
Image1.Canvas.TextOut(XOffset+xincr*i,Axis1Pos+2,Title);
step := step + 0.2;
end;
// draw Y axis
Image1.Canvas.MoveTo(Axis2Pos,YEnd);
Image1.Canvas.LineTo(Axis2Pos,YStart);
Title := 'Factor ' + IntToStr(Axis2);
Image1.Canvas.TextOut(Axis2Pos,0,Title);
step := -1.0;
for i := 0 to 10 do
begin
Title := format('%4.1f',[step]);
TextLong := Image1.Canvas.TextWidth(Title);
Image1.Canvas.TextOut(Axis2Pos-TextLong,YStart-(i*yincr),Title);
step := step + 0.2;
end;
end;
initialization
{$I rotateunit.lrs}
end.

View File

@ -0,0 +1,77 @@
object rowinsertfrm: Trowinsertfrm
Left = 338
Height = 147
Top = 176
Width = 217
Caption = 'Row Insert'
ClientHeight = 147
ClientWidth = 217
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 9
Height = 14
Top = 16
Width = 136
Caption = 'Insert a Row in Which Grid? '
ParentColor = False
end
object Label2: TLabel
Left = 30
Height = 14
Top = 47
Width = 83
Caption = 'Before the Row :'
ParentColor = False
end
object Label3: TLabel
Left = 31
Height = 14
Top = 79
Width = 79
Caption = 'After the Row : '
ParentColor = False
end
object GridNoEdit: TEdit
Left = 160
Height = 21
Top = 5
Width = 42
TabOrder = 0
Text = 'GridNoEdit'
end
object BeforeEdit: TEdit
Left = 161
Height = 21
Top = 41
Width = 42
TabOrder = 1
Text = 'BeforeEdit'
end
object AfterEdit: TEdit
Left = 161
Height = 21
Top = 76
Width = 42
TabOrder = 2
Text = 'AfterEdit'
end
object CancelBtn: TButton
Left = 9
Height = 28
Top = 112
Width = 68
Caption = 'Cancel'
ModalResult = 2
TabOrder = 3
end
object ReturnBtn: TButton
Left = 134
Height = 28
Top = 112
Width = 68
Caption = 'Return'
ModalResult = 1
TabOrder = 4
end
end

View File

@ -0,0 +1,22 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('Trowinsertfrm','FORMDATA',[
'TPF0'#13'Trowinsertfrm'#12'rowinsertfrm'#4'Left'#3'R'#1#6'Height'#3#147#0#3
+'Top'#3#176#0#5'Width'#3#217#0#7'Caption'#6#10'Row Insert'#12'ClientHeight'#3
+#147#0#11'ClientWidth'#3#217#0#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.'
+'9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2#14#3'Top'#2#16#5'Widt'
+'h'#3#136#0#7'Caption'#6#28'Insert a Row in Which Grid? '#11'ParentColor'#8#0
+#0#6'TLabel'#6'Label2'#4'Left'#2#30#6'Height'#2#14#3'Top'#2'/'#5'Width'#2'S'
+#7'Caption'#6#16'Before the Row :'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'
+#4'Left'#2#31#6'Height'#2#14#3'Top'#2'O'#5'Width'#2'O'#7'Caption'#6#16'After'
+' the Row : '#11'ParentColor'#8#0#0#5'TEdit'#10'GridNoEdit'#4'Left'#3#160#0#6
+'Height'#2#21#3'Top'#2#5#5'Width'#2'*'#8'TabOrder'#2#0#4'Text'#6#10'GridNoEd'
+'it'#0#0#5'TEdit'#10'BeforeEdit'#4'Left'#3#161#0#6'Height'#2#21#3'Top'#2')'#5
+'Width'#2'*'#8'TabOrder'#2#1#4'Text'#6#10'BeforeEdit'#0#0#5'TEdit'#9'AfterEd'
+'it'#4'Left'#3#161#0#6'Height'#2#21#3'Top'#2'L'#5'Width'#2'*'#8'TabOrder'#2#2
+#4'Text'#6#9'AfterEdit'#0#0#7'TButton'#9'CancelBtn'#4'Left'#2#9#6'Height'#2
+#28#3'Top'#2'p'#5'Width'#2'D'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'T'
+'abOrder'#2#3#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#134#0#6'Height'#2#28#3'T'
+'op'#2'p'#5'Width'#2'D'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrde'
+'r'#2#4#0#0#0
]);

View File

@ -0,0 +1,48 @@
unit rowinsertunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
{ Trowinsertfrm }
Trowinsertfrm = class(TForm)
BeforeEdit: TEdit;
AfterEdit: TEdit;
CancelBtn: TButton;
ReturnBtn: TButton;
GridNoEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormShow(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
rowinsertfrm: Trowinsertfrm;
implementation
uses matmanunit;
{ Trowinsertfrm }
procedure Trowinsertfrm.FormShow(Sender: TObject);
begin
GridNoEdit.Text := matmanfrm.GridNoEdit.Text;
end;
initialization
{$I rowinsertunit.lrs}
end.

View File

@ -0,0 +1,312 @@
object runstestform: Trunstestform
Left = 288
Height = 488
Top = 161
Width = 450
Caption = 'Test for Randomness'
ClientHeight = 488
ClientWidth = 450
OnShow = ResetBtnClick
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 16
Height = 16
Top = 8
Width = 102
Caption = 'Available Variables:'
ParentColor = False
end
object Label2: TLabel
Left = 248
Height = 16
Top = 120
Width = 111
Caption = 'Test Randomness of:'
ParentColor = False
end
object VarList: TListBox
Left = 16
Height = 256
Top = 24
Width = 181
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 208
Height = 26
Top = 128
Width = 30
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 208
Height = 26
Top = 160
Width = 30
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object TestVarEdit: TEdit
Left = 248
Height = 23
Top = 144
Width = 139
TabOrder = 3
Text = 'TestVarEdit'
end
object Memo1: TMemo
Left = 208
Height = 80
Top = 16
Width = 230
Lines.Strings = (
'This is a test for the randomness of a '
'series'
'of values in a variable. Select the variable'
'to analyze and click the Compute button.'
)
TabOrder = 4
end
object Label3: TLabel
Left = 208
Height = 16
Top = 200
Width = 34
Caption = 'Mean:'
ParentColor = False
end
object Label4: TLabel
Left = 207
Height = 16
Top = 235
Width = 104
Caption = 'Standard Deviation:'
ParentColor = False
end
object Label5: TLabel
Left = 208
Height = 16
Top = 265
Width = 94
Caption = 'N Values > Mean:'
ParentColor = False
end
object Label6: TLabel
Left = 209
Height = 16
Top = 298
Width = 94
Caption = 'N Values < Mean:'
ParentColor = False
end
object Label7: TLabel
Left = 208
Height = 16
Top = 329
Width = 91
Caption = 'Number of Runs:'
ParentColor = False
end
object Label8: TLabel
Left = 207
Height = 16
Top = 360
Width = 70
Caption = 'Test Statistic:'
ParentColor = False
end
object Label9: TLabel
Left = 209
Height = 16
Top = 393
Width = 61
Caption = 'Probability:'
ParentColor = False
end
object Label10: TLabel
Left = 208
Height = 16
Top = 425
Width = 64
Caption = 'Conclusion:'
ParentColor = False
end
object MeanEdit: TEdit
Left = 360
Height = 23
Top = 193
Width = 77
TabOrder = 5
Text = 'MeanEdit'
end
object StdDevEdit: TEdit
Left = 360
Height = 23
Top = 224
Width = 77
TabOrder = 6
Text = 'Edit1'
end
object NUpEdit: TEdit
Left = 360
Height = 23
Top = 256
Width = 77
TabOrder = 7
Text = 'Edit1'
end
object NDownEdit: TEdit
Left = 361
Height = 23
Top = 291
Width = 77
TabOrder = 8
Text = 'Edit1'
end
object NRunsEdit: TEdit
Left = 361
Height = 23
Top = 320
Width = 77
TabOrder = 9
Text = 'Edit1'
end
object StatEdit: TEdit
Left = 360
Height = 23
Top = 353
Width = 77
TabOrder = 10
Text = 'Edit1'
end
object ProbEdit: TEdit
Left = 360
Height = 23
Top = 386
Width = 77
TabOrder = 11
Text = 'Edit1'
end
object ConclusionEdit: TEdit
Left = 209
Height = 23
Top = 448
Width = 229
TabOrder = 12
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 64
Height = 27
Top = 304
Width = 89
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 13
end
object CancelBtn: TButton
Left = 64
Height = 27
Top = 353
Width = 89
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 14
end
object ComputeBtn: TButton
Left = 64
Height = 27
Top = 400
Width = 89
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 15
end
object ReturnBtn: TButton
Left = 64
Height = 27
Top = 448
Width = 89
Caption = 'Return'
ModalResult = 1
TabOrder = 16
end
end

View File

@ -0,0 +1,157 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('Trunstestform','FORMDATA',[
'TPF0'#13'Trunstestform'#12'runstestform'#4'Left'#3' '#1#6'Height'#3#232#1#3
+'Top'#3#161#0#5'Width'#3#194#1#7'Caption'#6#19'Test for Randomness'#12'Clien'
+'tHeight'#3#232#1#11'ClientWidth'#3#194#1#6'OnShow'#7#13'ResetBtnClick'#10'L'
+'CLVersion'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#16#6'Height'#2#16#3
+'Top'#2#8#5'Width'#2'f'#7'Caption'#6#20'Available Variables:'#11'ParentColor'
+#8#0#0#6'TLabel'#6'Label2'#4'Left'#3#248#0#6'Height'#2#16#3'Top'#2'x'#5'Widt'
+'h'#2'o'#7'Caption'#6#19'Test Randomness of:'#11'ParentColor'#8#0#0#8'TListB'
+'ox'#7'VarList'#4'Left'#2#16#6'Height'#3#0#1#3'Top'#2#24#5'Width'#3#181#0#10
+'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'InBtn'#4
+'Left'#3#208#0#6'Height'#2#26#3'Top'#3#128#0#5'Width'#2#30#10'Glyph.Data'#10
+':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0
+' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'
+#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'
+#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0
+#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255
+#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142
+#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'
+#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162
+#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255
+#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130
+#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199
+'t'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255
+'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'
+#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8
+'TabOrder'#2#1#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#208#0#6'Height'#2#26#3'Top'
+#3#160#0#5'Width'#2#30#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0
+'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0
+#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
,#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'
+#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161
+'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131
+#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/'
+'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'
+#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255
+#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132
+#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255
+#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154
+#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255
+#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201
+#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num'
+'Glyphs'#2#0#7'OnClick'#7#11'OutBtnClick'#8'TabOrder'#2#2#0#0#5'TEdit'#11'Te'
+'stVarEdit'#4'Left'#3#248#0#6'Height'#2#23#3'Top'#3#144#0#5'Width'#3#139#0#8
+'TabOrder'#2#3#4'Text'#6#11'TestVarEdit'#0#0#5'TMemo'#5'Memo1'#4'Left'#3#208
+#0#6'Height'#2'P'#3'Top'#2#16#5'Width'#3#230#0#13'Lines.Strings'#1#6'''This '
+'is a test for the randomness of a '#6#6'series'#6'-of values in a variable.'
+' Select the variable'#6'(to analyze and click the Compute button.'#0#8'Tab'
+'Order'#2#4#0#0#6'TLabel'#6'Label3'#4'Left'#3#208#0#6'Height'#2#16#3'Top'#3
+#200#0#5'Width'#2'"'#7'Caption'#6#5'Mean:'#11'ParentColor'#8#0#0#6'TLabel'#6
+'Label4'#4'Left'#3#207#0#6'Height'#2#16#3'Top'#3#235#0#5'Width'#2'h'#7'Capti'
+'on'#6#19'Standard Deviation:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#4'L'
+'eft'#3#208#0#6'Height'#2#16#3'Top'#3#9#1#5'Width'#2'^'#7'Caption'#6#16'N Va'
+'lues > Mean:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#4'Left'#3#209#0#6'H'
+'eight'#2#16#3'Top'#3'*'#1#5'Width'#2'^'#7'Caption'#6#16'N Values < Mean:'#11
+'ParentColor'#8#0#0#6'TLabel'#6'Label7'#4'Left'#3#208#0#6'Height'#2#16#3'Top'
+#3'I'#1#5'Width'#2'['#7'Caption'#6#15'Number of Runs:'#11'ParentColor'#8#0#0
+#6'TLabel'#6'Label8'#4'Left'#3#207#0#6'Height'#2#16#3'Top'#3'h'#1#5'Width'#2
+'F'#7'Caption'#6#15'Test Statistic:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label'
,'9'#4'Left'#3#209#0#6'Height'#2#16#3'Top'#3#137#1#5'Width'#2'='#7'Caption'#6
+#12'Probability:'#11'ParentColor'#8#0#0#6'TLabel'#7'Label10'#4'Left'#3#208#0
+#6'Height'#2#16#3'Top'#3#169#1#5'Width'#2'@'#7'Caption'#6#11'Conclusion:'#11
+'ParentColor'#8#0#0#5'TEdit'#8'MeanEdit'#4'Left'#3'h'#1#6'Height'#2#23#3'Top'
+#3#193#0#5'Width'#2'M'#8'TabOrder'#2#5#4'Text'#6#8'MeanEdit'#0#0#5'TEdit'#10
+'StdDevEdit'#4'Left'#3'h'#1#6'Height'#2#23#3'Top'#3#224#0#5'Width'#2'M'#8'Ta'
+'bOrder'#2#6#4'Text'#6#5'Edit1'#0#0#5'TEdit'#7'NUpEdit'#4'Left'#3'h'#1#6'Hei'
+'ght'#2#23#3'Top'#3#0#1#5'Width'#2'M'#8'TabOrder'#2#7#4'Text'#6#5'Edit1'#0#0
+#5'TEdit'#9'NDownEdit'#4'Left'#3'i'#1#6'Height'#2#23#3'Top'#3'#'#1#5'Width'#2
+'M'#8'TabOrder'#2#8#4'Text'#6#5'Edit1'#0#0#5'TEdit'#9'NRunsEdit'#4'Left'#3'i'
+#1#6'Height'#2#23#3'Top'#3'@'#1#5'Width'#2'M'#8'TabOrder'#2#9#4'Text'#6#5'Ed'
+'it1'#0#0#5'TEdit'#8'StatEdit'#4'Left'#3'h'#1#6'Height'#2#23#3'Top'#3'a'#1#5
+'Width'#2'M'#8'TabOrder'#2#10#4'Text'#6#5'Edit1'#0#0#5'TEdit'#8'ProbEdit'#4
+'Left'#3'h'#1#6'Height'#2#23#3'Top'#3#130#1#5'Width'#2'M'#8'TabOrder'#2#11#4
+'Text'#6#5'Edit1'#0#0#5'TEdit'#14'ConclusionEdit'#4'Left'#3#209#0#6'Height'#2
+#23#3'Top'#3#192#1#5'Width'#3#229#0#8'TabOrder'#2#12#4'Text'#6#5'Edit1'#0#0#7
+'TButton'#8'ResetBtn'#4'Left'#2'@'#6'Height'#2#27#3'Top'#3'0'#1#5'Width'#2'Y'
+#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#13#0#0#7
+'TButton'#9'CancelBtn'#4'Left'#2'@'#6'Height'#2#27#3'Top'#3'a'#1#5'Width'#2
+'Y'#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#14#0
+#0#7'TButton'#10'ComputeBtn'#4'Left'#2'@'#6'Height'#2#27#3'Top'#3#144#1#5'Wi'
+'dth'#2'Y'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrd'
+'er'#2#15#0#0#7'TButton'#9'ReturnBtn'#4'Left'#2'@'#6'Height'#2#27#3'Top'#3
+#192#1#5'Width'#2'Y'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2
+#16#0#0#0
]);

View File

@ -0,0 +1,245 @@
unit RunsTestUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, MainUnit, OutPutUnit, FunctionsLib, Globals,
DataProcs, Math;
type
{ Trunstestform }
Trunstestform = class(TForm)
CancelBtn: TButton;
ComputeBtn: TButton;
MeanEdit: TEdit;
ResetBtn: TButton;
ReturnBtn: TButton;
StdDevEdit: TEdit;
NUpEdit: TEdit;
NDownEdit: TEdit;
NRunsEdit: TEdit;
StatEdit: TEdit;
ProbEdit: TEdit;
ConclusionEdit: TEdit;
InBtn: TBitBtn;
OutBtn: TBitBtn;
Label10: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
TestVarEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Memo1: TMemo;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
runstestform: Trunstestform;
implementation
{ Trunstestform }
procedure Trunstestform.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
TestVarEdit.Text := '';
MeanEdit.Text := '';
StdDevEdit.Text := '';
NUpEdit.Text := '';
NDownEdit.Text := '';
StatEdit.Text := '';
ProbEdit.Text := '';
ConclusionEdit.Text := '';
NRunsEdit.Text := '';
InBtn.Visible := true;
OutBtn.Visible := false;
end;
procedure Trunstestform.ComputeBtnClick(Sender: TObject);
VAR
result, a, intvalue, i, j, col, N, N1, N2, NLess, Nmore, R : integer;
dblvalue, Mean, ExpMean, SD1, SD2, SD3, SD4, SD, z1, z2, z, t, p1, p : double;
strvalue, outstr, astring : string;
values : DblDyneVec;
begin
col := 0;
N := 0;
N1 := 0;
N2 := 0;
Nless := 0;
Nmore := 0;
R := 1;
Mean := 0.0;
for i := 1 to NoVariables do
begin
strvalue := Trim(OS3MainFrm.DataGrid.Cells[i,0]);
if TestVarEdit.Text = strvalue then col := i;
end;
if col = 0 then
begin
ShowMessage('No variable was selected. Returning.');
exit;
end;
SetLength(values,NoCases);
for i := 1 to NoCases do
begin
if not ValidValue(i,col) then continue;
values[i-1] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i]));
N := N + 1;
end;
if N <= 10 then
begin
ShowMessage('Insufficient data. You must have at least 11 values.');
values := nil;
exit;
end;
for i := 0 to N-1 do Mean := Mean + values[i];
Mean := Mean / N;
// run through each value and compare with the mean
for i := 0 to N-1 do
begin // check and discard the ties with the mean
if Mean <> values[i] then
begin // check if it is greater than the mean
if values[i] > mean then
begin
N1 := N1 + 1;
a := i;
while a > 0 do
begin
a := a - 1;
if values[a] <> Mean then break;
end;
if values[a] < Mean then
begin
R := R + 1;
NLess := NLess + 1;
end;
end
// check to see if it is less than the mean
else if values[i] < Mean then
begin
N2 := N2 + 1;
a := i;
while a > 0 do
begin
a := a - 1;
if values[a] <> Mean then break;
end;
if values[a] > Mean then
begin
R := R + 1;
Nmore := Nmore + 1;
end;
end; // close of else i
end; // end of if values[i] not equal to the mean
end; // end of i loop
// compute the expected mean and variance of R
ExpMean := 1.0 + ((2 * N1 * N2) / (N1 + N2)); // mean mu
SD1 := 2 * N1 * N2 * (2 * N1 * N2 - N1 - N2);
SD2 := power((N1 + N2),2);
SD3 := N1 + N2 - 1;
SD4 := SD1 / (SD2 * SD3); // standard deviation "sigma"
SD := sqrt(SD4);
// calculating P Value
z1 := (R - ExpMean) / SD;
z2 := abs(z1);
z := z2;
if z > 0 then t := z else t := -z;
p1 := power((1 + t * (0.049867347 + t * (0.0211410061 + t * (0.0032776283 +
t * (0.0000380036 + t * (0.0000488906 + t * (0.000005383))))))), -16);
p := 1.0 - p1 / 2.0;
if z > 0.0 then t := 1.0 - p
else t := 1.0 - (1.0 - p); // this is P value
// show results
outstr := format('%8.3f',[Mean]);
MeanEdit.Text := outstr;
outstr := format('%8.3f',[SD]);
StdDevEdit.Text := outstr;
NUpEdit.Text := IntToStr(N1);
NDownEdit.Text := IntToStr(N2);
NRunsEdit.Text := IntToStr(R);
outstr := format('%8.3f',[z]);
StatEdit.Text := outstr;
// if t < 0.0001 then astring := 'Almost Zero'
// else
// begin
outstr := format('%6.4f',[t]);
ProbEdit.Text := outstr;
// end;
// determine the conclusion
if t < 0.01 then
begin
astring := 'Very strong evidence against randomness (trend or seasonality';
ConclusionEdit.Text := astring;
end
else if (t < 0.05) and (t >= 0.01) then
begin
astring := 'Moderate evidence against randomness';
ConclusionEdit.Text := astring;
end
else if (t < 0.10) and (t >= 0.05) then
begin
astring := 'Suggestive evidence against normality';
ConclusionEdit.Text := astring;
end
else if t >= 0.10 then
begin
astring := 'Little or no real evidence against randomness';
ConclusionEdit.Text := astring;
end
else
begin
astring := 'Strong evidence against randomness (trend or seasonality exists)';
ConclusionEdit.Text := astring;
end;
values := nil;
end;
procedure Trunstestform.InBtnClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
if index < 0 then exit;
TestVarEdit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
InBtn.Visible := false;
OutBtn.Visible := true;
end;
procedure Trunstestform.OutBtnClick(Sender: TObject);
begin
if TestVarEdit.Text = '' then exit;
VarList.Items.Add(TestVarEdit.Text);
TestVarEdit.Text := '';
InBtn.Visible := true;
OutBtn.Visible := false;
end;
initialization
{$I runstestunit.lrs}
end.

View File

@ -0,0 +1,164 @@
object scripteditorfrm: Tscripteditorfrm
Left = 224
Height = 508
Top = 121
Width = 691
Caption = 'MatMan Script Editor'
ClientHeight = 508
ClientWidth = 691
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 10
Height = 14
Top = 56
Width = 124
Caption = 'Current Script File Name: '
ParentColor = False
end
object Label2: TLabel
Left = 65
Height = 14
Top = 81
Width = 68
Caption = 'Current Script'
ParentColor = False
end
object Label3: TLabel
Left = 456
Height = 14
Top = 224
Width = 69
Caption = 'Directory Files'
ParentColor = False
end
object Label4: TLabel
Left = 321
Height = 14
Top = 182
Width = 32
Caption = 'Label4'
ParentColor = False
end
object Memo1: TMemo
Left = 6
Height = 32
Top = 8
Width = 674
Lines.Strings = (
'Your script is shown in the list to your left. Select a line by clicking on a line in the script and then click on one of the edit option buttons.'
'When finished editing, click on the Save button.'
)
TabOrder = 0
end
object ScriptFileEdit: TEdit
Left = 146
Height = 21
Top = 47
Width = 534
TabOrder = 1
Text = 'ScriptFileEdit'
end
object ScriptList: TListBox
Left = 9
Height = 360
Top = 96
Width = 294
ItemHeight = 0
OnClick = ScriptListClick
TabOrder = 2
end
object RadioGroup1: TRadioGroup
Left = 321
Height = 104
Top = 72
Width = 361
AutoFill = True
Caption = 'Editing Options'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 86
ClientWidth = 357
Items.Strings = (
'Delete the line'
'Insert a new line prior to selected line'
'Modify the current line'
'Append another script'
)
OnClick = RadioGroup1Click
TabOrder = 3
end
object FileListBox1: TFileListBox
Left = 321
Height = 217
Top = 240
Width = 359
Directory = 'C:\Windows\system32'
ItemHeight = 13
OnDblClick = FileListBox1DblClick
TabOrder = 4
end
object SaveBtn: TButton
Left = 432
Height = 27
Top = 472
Width = 74
Caption = 'Save'
OnClick = SaveBtnClick
TabOrder = 5
end
object CancelBtn: TButton
Left = 520
Height = 27
Top = 472
Width = 74
Caption = 'Cancel'
ModalResult = 2
TabOrder = 6
end
object ReturnBtn: TButton
Left = 608
Height = 27
Top = 472
Width = 74
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
object DirChangeBtn: TButton
Left = 318
Height = 28
Top = 472
Width = 100
Caption = 'Change Directory'
OnClick = DirChangeBtnClick
TabOrder = 8
end
object LineEdit: TEdit
Left = 327
Height = 21
Top = 199
Width = 352
OnKeyPress = LineEditKeyPress
TabOrder = 9
Text = 'LineEdit'
end
object SaveDialog1: TSaveDialog
left = 24
top = 464
end
object OpenDialog1: TOpenDialog
left = 87
top = 464
end
object SelectDirectoryDialog1: TSelectDirectoryDialog
left = 184
top = 466
end
end

View File

@ -0,0 +1,48 @@
LazarusResources.Add('Tscripteditorfrm','FORMDATA',[
'TPF0'#16'Tscripteditorfrm'#15'scripteditorfrm'#4'Left'#3#224#0#6'Height'#3
+#252#1#3'Top'#2'y'#5'Width'#3#179#2#7'Caption'#6#20'MatMan Script Editor'#12
+'ClientHeight'#3#252#1#11'ClientWidth'#3#179#2#6'OnShow'#7#8'FormShow'#10'LC'
+'LVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#10#6'Height'#2#14#3
+'Top'#2'8'#5'Width'#2'|'#7'Caption'#6#26'Current Script File Name: '#11'Pare'
+'ntColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2'A'#6'Height'#2#14#3'Top'#2'Q'#5
+'Width'#2'D'#7'Caption'#6#14'Current Script'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label3'#4'Left'#3#200#1#6'Height'#2#14#3'Top'#3#224#0#5'Width'#2'E'#7'Cap'
+'tion'#6#15'Directory Files'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Lef'
+'t'#3'A'#1#6'Height'#2#14#3'Top'#3#182#0#5'Width'#2' '#7'Caption'#6#6'Label4'
+#11'ParentColor'#8#0#0#5'TMemo'#5'Memo1'#4'Left'#2#6#6'Height'#2' '#3'Top'#2
+#8#5'Width'#3#162#2#13'Lines.Strings'#1#6#148'Your script is shown in the li'
+'st to your left. Select a line by clicking on a line in the script and th'
+'en click on one of the edit option buttons.'#6'0When finished editing, clic'
+'k on the Save button.'#0#8'TabOrder'#2#0#0#0#5'TEdit'#14'ScriptFileEdit'#4
+'Left'#3#146#0#6'Height'#2#21#3'Top'#2'/'#5'Width'#3#22#2#8'TabOrder'#2#1#4
+'Text'#6#14'ScriptFileEdit'#0#0#8'TListBox'#10'ScriptList'#4'Left'#2#9#6'Hei'
+'ght'#3'h'#1#3'Top'#2'`'#5'Width'#3'&'#1#10'ItemHeight'#2#0#7'OnClick'#7#15
+'ScriptListClick'#8'TabOrder'#2#2#0#0#11'TRadioGroup'#11'RadioGroup1'#4'Left'
+#3'A'#1#6'Height'#2'h'#3'Top'#2'H'#5'Width'#3'i'#1#8'AutoFill'#9#7'Caption'#6
+#15'Editing Options'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.Top'
+'BottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChil'
+'dResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28
+'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVer'
+'tical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenT'
+'opToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2'V'#11'Cl'
+'ientWidth'#3'e'#1#13'Items.Strings'#1#6#15'Delete the line'#6'(Insert a new'
+' line prior to selected line'#6#23'Modify the current line'#6#21'Append ano'
+'ther script'#0#7'OnClick'#7#16'RadioGroup1Click'#8'TabOrder'#2#3#0#0#12'TFi'
+'leListBox'#12'FileListBox1'#4'Left'#3'A'#1#6'Height'#3#217#0#3'Top'#3#240#0
+#5'Width'#3'g'#1#9'Directory'#6#19'C:\Windows\system32'#10'ItemHeight'#2#13
+#10'OnDblClick'#7#20'FileListBox1DblClick'#8'TabOrder'#2#4#0#0#7'TButton'#7
+'SaveBtn'#4'Left'#3#176#1#6'Height'#2#27#3'Top'#3#216#1#5'Width'#2'J'#7'Capt'
+'ion'#6#4'Save'#7'OnClick'#7#12'SaveBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'
+#9'CancelBtn'#4'Left'#3#8#2#6'Height'#2#27#3'Top'#3#216#1#5'Width'#2'J'#7'Ca'
+'ption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#6#0#0#7'TButton'#9'Ret'
+'urnBtn'#4'Left'#3'`'#2#6'Height'#2#27#3'Top'#3#216#1#5'Width'#2'J'#7'Captio'
+'n'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#7#0#0#7'TButton'#12'DirCha'
+'ngeBtn'#4'Left'#3'>'#1#6'Height'#2#28#3'Top'#3#216#1#5'Width'#2'd'#7'Captio'
+'n'#6#16'Change Directory'#7'OnClick'#7#17'DirChangeBtnClick'#8'TabOrder'#2#8
+#0#0#5'TEdit'#8'LineEdit'#4'Left'#3'G'#1#6'Height'#2#21#3'Top'#3#199#0#5'Wid'
+'th'#3'`'#1#10'OnKeyPress'#7#16'LineEditKeyPress'#8'TabOrder'#2#9#4'Text'#6#8
+'LineEdit'#0#0#11'TSaveDialog'#11'SaveDialog1'#4'left'#2#24#3'top'#3#208#1#0
+#0#11'TOpenDialog'#11'OpenDialog1'#4'left'#2'W'#3'top'#3#208#1#0#0#22'TSelec'
+'tDirectoryDialog'#22'SelectDirectoryDialog1'#4'left'#3#184#0#3'top'#3#210#1
+#0#0#0
]);

View File

@ -0,0 +1,207 @@
unit scripteditorunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, FileCtrl, rowinsertunit;
type
{ Tscripteditorfrm }
Tscripteditorfrm = class(TForm)
DirChangeBtn: TButton;
LineEdit: TEdit;
Label4: TLabel;
OpenDialog1: TOpenDialog;
SaveBtn: TButton;
CancelBtn: TButton;
ReturnBtn: TButton;
FileListBox1: TFileListBox;
Label2: TLabel;
Label3: TLabel;
RadioGroup1: TRadioGroup;
SaveDialog1: TSaveDialog;
ScriptList: TListBox;
ScriptFileEdit: TEdit;
Label1: TLabel;
Memo1: TMemo;
SelectDirectoryDialog1: TSelectDirectoryDialog;
procedure DirChangeBtnClick(Sender: TObject);
procedure FileListBox1DblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure LineEditKeyPress(Sender: TObject; var Key: char);
procedure RadioGroup1Click(Sender: TObject);
procedure SaveBtnClick(Sender: TObject);
procedure ScriptListClick(Sender: TObject);
private
{ private declarations }
EditOption : integer;
index : integer;
currdir : string;
public
{ public declarations }
end;
var
scripteditorfrm: Tscripteditorfrm;
implementation
uses matmanunit;
{ Tscripteditorfrm }
procedure Tscripteditorfrm.FormShow(Sender: TObject);
begin
Label4.Visible := false;
LineEdit.Visible := false;
// currdir := GetCurrentDir;
// FileListBox1.Directory := currdir;
end;
procedure Tscripteditorfrm.FileListBox1DblClick(Sender: TObject);
var
delfile, prmptstr, info : string;
aindex : integer;
begin
aindex := FileListBox1.ItemIndex;
delfile := FileListBox1.Items.Strings[aindex];
prmptstr := 'Delete ' + delfile + '?';
info := InputBox('DELETE?',prmptstr,'Y');
if info <> 'Y' then exit
else DeleteFile(delfile);
FileListBox1.Update;
end;
procedure Tscripteditorfrm.DirChangeBtnClick(Sender: TObject);
begin
if SelectDirectoryDialog1.Execute then
begin
currdir := GetCurrentDir;
FileListBox1.Directory := currdir;
end;
end;
procedure Tscripteditorfrm.LineEditKeyPress(Sender: TObject; var Key: char);
begin
if ord(Key) = 13 then
begin
ScriptList.Items.Insert(index,LineEdit.Text);
LineEdit.Text := '';
LineEdit.Visible := false;
Label3.Visible := false;
end;
end;
procedure Tscripteditorfrm.RadioGroup1Click(Sender: TObject);
var
SaveFile : TextFile;
CurrentObjType : integer;
CurrentObjName, cellstring : string;
Count, i : integer;
begin
EditOption := RadioGroup1.ItemIndex + 1;
case EditOption of
1 : begin // delete a line
label3.Visible := false;
LineEdit.Visible := false;
ScriptList.Items.Delete(index);
ScriptList.SetFocus;
RadioGroup1.ItemIndex := -1;
end;
2 : begin // insert a line
label3.Visible := true;
label3.Caption := 'Enter a new line. End by pressing the Enter key.';
LineEdit.Visible := true;
LineEdit.Text := '';
LineEdit.SetFocus;
RadioGroup1.ItemIndex := -1;
end;
3 : begin // edit a line
label3.Visible := true;
label3.Caption := 'Edit the line. End by pressing the Enter key.';
LineEdit.Visible := true;
if index >= 0 then
begin
LineEdit.Text := ScriptList.Items.Strings[index];
ScriptList.Items.Delete(index);
LineEdit.SetFocus;
end;
RadioGroup1.ItemIndex := -1;
end;
4 : begin // append another script file
OpenDialog1.DefaultExt := '.SCP';
OpenDialog1.Filter := 'Script (*.SCP)|*.SCP|All (*.*)|*.*';
OpenDialog1.FilterIndex := 1;
if OpenDialog1.Execute then
begin
AssignFile(SaveFile, OpenDialog1.FileName);
Reset(SaveFile);
Readln(SaveFile,CurrentObjType);
if CurrentObjType <> 5 then
begin
ShowMessage('Not a script file!');
CloseFile(SaveFile);
exit;
end;
Readln(SaveFile,CurrentObjName);
Readln(SaveFile,Count);
for i := 0 to Count - 1 do
begin
Readln(SaveFile,cellstring);
ScriptList.Items.Add(cellstring);
end;
CloseFile(SaveFile);
end;
end; // end case 4
end; // end cases
end;
procedure Tscripteditorfrm.SaveBtnClick(Sender: TObject);
var
SaveFile : TextFile;
i, Count, CurrentObjType : integer;
CurrentObjName, edititem : string;
begin
Count := ScriptList.Items.Count;
if Count < 1 then exit;
CurrentObjType := 5;
CurrentObjName := ScriptFileEdit.Text;
SaveDialog1.FileName := ScriptFileEdit.Text;
SaveDialog1.Filter := 'Script (*.SCP)|*.SCP|All(*.*)|*.*';
SaveDialog1.DefaultExt := '.SCP';
SaveDialog1.FilterIndex := 1;
if SaveDialog1.Execute then
begin
AssignFile(SaveFile, SaveDialog1.FileName);
Rewrite(SaveFile);
Writeln(SaveFile,CurrentObjType);
Writeln(SaveFile,CurrentObjName);
Writeln(SaveFile,Count);
MatManFrm.ScriptList.Clear;
for i := 0 to Count - 1 do
begin
edititem := ScriptList.Items.Strings[i];
Writeln(SaveFile,edititem);
MatManFrm.ScriptList.Items.Add(edititem);
end;
CloseFile(SaveFile);
end;
end;
procedure Tscripteditorfrm.ScriptListClick(Sender: TObject);
begin
index := ScriptList.ItemIndex;
end;
initialization
{$I scripteditorunit.lrs}
end.

View File

@ -0,0 +1,53 @@
object scriptoptsfrm: Tscriptoptsfrm
Left = 254
Height = 125
Top = 130
Width = 281
Caption = 'Script Options'
ClientHeight = 125
ClientWidth = 281
LCLVersion = '0.9.28.2'
object CheckGroup1: TCheckGroup
Left = 5
Height = 72
Top = 8
Width = 269
AutoFill = True
Caption = 'Options'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
Items.Strings = (
'Do NOT record file Open Operations'
'Do NOT record file Save Operations'
)
TabOrder = 0
Data = {
020000000202
}
end
object CancelBtn: TButton
Left = 7
Height = 30
Top = 88
Width = 73
Caption = 'Cancel'
ModalResult = 2
TabOrder = 1
end
object ReturnBtn: TButton
Left = 200
Height = 30
Top = 88
Width = 73
Caption = 'Return'
ModalResult = 1
OnClick = ReturnBtnClick
TabOrder = 2
end
end

View File

@ -0,0 +1,18 @@
LazarusResources.Add('Tscriptoptsfrm','FORMDATA',[
'TPF0'#14'Tscriptoptsfrm'#13'scriptoptsfrm'#4'Left'#3#254#0#6'Height'#2'}'#3
+'Top'#3#130#0#5'Width'#3#25#1#7'Caption'#6#14'Script Options'#12'ClientHeigh'
+'t'#2'}'#11'ClientWidth'#3#25#1#10'LCLVersion'#6#8'0.9.28.2'#0#11'TCheckGrou'
+'p'#11'CheckGroup1'#4'Left'#2#5#6'Height'#2'H'#3'Top'#2#8#5'Width'#3#13#1#8
+'AutoFill'#9#7'Caption'#6#7'Options'#28'ChildSizing.LeftRightSpacing'#2#6#28
+'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'cr'
+'sHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousC'
+'hildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildS'
+'izing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclL'
+'eftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#13'Items.Str'
+'ings'#1#6'"Do NOT record file Open Operations'#6'"Do NOT record file Save O'
+'perations'#0#8'TabOrder'#2#0#4'Data'#10#6#0#0#0#2#0#0#0#2#2#0#0#7'TButton'#9
+'CancelBtn'#4'Left'#2#7#6'Height'#2#30#3'Top'#2'X'#5'Width'#2'I'#7'Caption'#6
+#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#7'TButton'#9'ReturnBtn'#4
+'Left'#3#200#0#6'Height'#2#30#3'Top'#2'X'#5'Width'#2'I'#7'Caption'#6#6'Retur'
+'n'#11'ModalResult'#2#1#7'OnClick'#7#14'ReturnBtnClick'#8'TabOrder'#2#2#0#0#0
]);

View File

@ -0,0 +1,52 @@
unit scriptoptsunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ Tscriptoptsfrm }
Tscriptoptsfrm = class(TForm)
CancelBtn: TButton;
ReturnBtn: TButton;
CheckGroup1: TCheckGroup;
procedure ReturnBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
scriptoptsfrm: Tscriptoptsfrm;
implementation
{ Tscriptoptsfrm }
procedure Tscriptoptsfrm.ReturnBtnClick(Sender: TObject);
var
scriptopts : textfile;
checked : integer;
begin
AssignFile(scriptopts, 'Options.SCR');
Rewrite(scriptopts);
if CheckGroup1.Checked[0] then checked := 1 else checked := 0;
Writeln(scriptopts,checked);
if CheckGroup1.Checked[1] then checked := 1 else checked := 0;
Writeln(scriptopts,checked);
closefile(scriptopts);
end;
initialization
{$I scriptoptsunit.lrs}
end.

View File

@ -0,0 +1,224 @@
object SelectFrm: TSelectFrm
Left = 172
Height = 335
Top = 112
Width = 829
Caption = 'Select Cases'
ClientHeight = 335
ClientWidth = 829
OnShow = FormShow
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 8
Height = 16
Top = 9
Width = 48
Caption = 'Variables'
ParentColor = False
end
object Label3: TLabel
Left = 368
Height = 16
Top = 6
Width = 53
Caption = 'Left Value'
ParentColor = False
end
object Label4: TLabel
Left = 488
Height = 16
Top = 6
Width = 66
Caption = 'Comparison'
ParentColor = False
end
object Label5: TLabel
Left = 599
Height = 16
Top = 9
Width = 61
Caption = 'Right Value'
ParentColor = False
end
object Label6: TLabel
Left = 712
Height = 16
Top = 8
Width = 54
Caption = 'Join Logic'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 291
Top = 26
Width = 160
ItemHeight = 0
TabOrder = 0
end
object GroupBox1: TGroupBox
Left = 177
Height = 233
Top = 23
Width = 178
Caption = 'Select:'
ClientHeight = 215
ClientWidth = 174
TabOrder = 1
object Label2: TLabel
Left = 14
Height = 16
Top = 161
Width = 117
Caption = 'Click one from the list'
ParentColor = False
end
object AllCasesBtn: TRadioButton
Left = 8
Height = 19
Top = 10
Width = 67
Caption = 'All Cases'
OnClick = AllCasesBtnClick
TabOrder = 0
end
object IfCondBtn: TRadioButton
Left = 8
Height = 19
Top = 40
Width = 138
Caption = 'If condition is satisfied'
OnClick = IfCondBtnClick
TabOrder = 1
end
object RandomBtn: TRadioButton
Left = 8
Height = 19
Top = 73
Width = 118
Caption = 'A Random Sample'
OnClick = RandomBtnClick
TabOrder = 2
end
object RangeBtn: TRadioButton
Left = 9
Height = 19
Top = 104
Width = 111
Caption = 'A Range of Cases'
OnClick = RangeBtnClick
TabOrder = 3
end
object FilterBtn: TRadioButton
Left = 9
Height = 19
Top = 136
Width = 133
Caption = 'Use the Filter Variable'
OnClick = FilterBtnClick
TabOrder = 4
end
object FiltVarEdit: TEdit
Left = 14
Height = 23
Top = 185
Width = 123
TabOrder = 5
Text = 'FiltVarEdit'
end
end
object GroupBox2: TGroupBox
Left = 177
Height = 58
Top = 264
Width = 175
Caption = 'Unselected Cases Are:'
ClientHeight = 40
ClientWidth = 171
TabOrder = 2
object FilterOutBtn: TRadioButton
Left = 8
Height = 19
Top = 2
Width = 82
Caption = 'Filtered Out'
TabOrder = 0
end
object DeleteBtn: TRadioButton
Left = 8
Height = 19
Top = 20
Width = 130
Caption = 'Deleted from the File'
TabOrder = 1
end
end
object ExpListBox: TListBox
Left = 368
Height = 229
Top = 24
Width = 110
ItemHeight = 0
TabOrder = 3
end
object JoinList: TListBox
Left = 488
Height = 227
Top = 25
Width = 102
ItemHeight = 0
TabOrder = 4
end
object NotList: TListBox
Left = 598
Height = 226
Top = 26
Width = 106
ItemHeight = 0
TabOrder = 5
end
object OpsList: TListBox
Left = 712
Height = 229
Top = 24
Width = 98
ItemHeight = 0
TabOrder = 6
end
object ResetBtn: TButton
Left = 369
Height = 29
Top = 280
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 7
end
object CancelBtn: TButton
Left = 496
Height = 29
Top = 282
Width = 78
Caption = 'Cancel'
ModalResult = 2
TabOrder = 8
end
object ComputeBtn: TButton
Left = 616
Height = 29
Top = 280
Width = 78
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 9
end
object ReturnBtn: TButton
Left = 732
Height = 29
Top = 282
Width = 78
Caption = 'Return'
ModalResult = 1
TabOrder = 10
end
end

View File

@ -0,0 +1,55 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSelectFrm','FORMDATA',[
'TPF0'#10'TSelectFrm'#9'SelectFrm'#4'Left'#3#172#0#6'Height'#3'O'#1#3'Top'#2
+'p'#5'Width'#3'='#3#7'Caption'#6#12'Select Cases'#12'ClientHeight'#3'O'#1#11
+'ClientWidth'#3'='#3#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#6'0.9.30'#0#6
+'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#16#3'Top'#2#9#5'Width'#2'0'#7'Cap'
+'tion'#6#9'Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3'p'
+#1#6'Height'#2#16#3'Top'#2#6#5'Width'#2'5'#7'Caption'#6#10'Left Value'#11'Pa'
+'rentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#232#1#6'Height'#2#16#3'Top'#2
+#6#5'Width'#2'B'#7'Caption'#6#10'Comparison'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label5'#4'Left'#3'W'#2#6'Height'#2#16#3'Top'#2#9#5'Width'#2'='#7'Caption'
+#6#11'Right Value'#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#4'Left'#3#200#2
+#6'Height'#2#16#3'Top'#2#8#5'Width'#2'6'#7'Caption'#6#10'Join Logic'#11'Pare'
+'ntColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6'Height'#3'#'#1#3'Top'#2
+#26#5'Width'#3#160#0#10'ItemHeight'#2#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'G'
+'roupBox1'#4'Left'#3#177#0#6'Height'#3#233#0#3'Top'#2#23#5'Width'#3#178#0#7
+'Caption'#6#7'Select:'#12'ClientHeight'#3#215#0#11'ClientWidth'#3#174#0#8'Ta'
+'bOrder'#2#1#0#6'TLabel'#6'Label2'#4'Left'#2#14#6'Height'#2#16#3'Top'#3#161#0
+#5'Width'#2'u'#7'Caption'#6#23'Click one from the list'#11'ParentColor'#8#0#0
+#12'TRadioButton'#11'AllCasesBtn'#4'Left'#2#8#6'Height'#2#19#3'Top'#2#10#5'W'
+'idth'#2'C'#7'Caption'#6#9'All Cases'#7'OnClick'#7#16'AllCasesBtnClick'#8'Ta'
+'bOrder'#2#0#0#0#12'TRadioButton'#9'IfCondBtn'#4'Left'#2#8#6'Height'#2#19#3
+'Top'#2'('#5'Width'#3#138#0#7'Caption'#6#25'If condition is satisfied'#7'OnC'
+'lick'#7#14'IfCondBtnClick'#8'TabOrder'#2#1#0#0#12'TRadioButton'#9'RandomBtn'
+#4'Left'#2#8#6'Height'#2#19#3'Top'#2'I'#5'Width'#2'v'#7'Caption'#6#15'A Rand'
+'om Sample'#7'OnClick'#7#14'RandomBtnClick'#8'TabOrder'#2#2#0#0#12'TRadioBut'
+'ton'#8'RangeBtn'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'h'#5'Width'#2'o'#7'Cap'
+'tion'#6#16'A Range of Cases'#7'OnClick'#7#13'RangeBtnClick'#8'TabOrder'#2#3
+#0#0#12'TRadioButton'#9'FilterBtn'#4'Left'#2#9#6'Height'#2#19#3'Top'#3#136#0
+#5'Width'#3#133#0#7'Caption'#6#23'Use the Filter Variable'#7'OnClick'#7#14'F'
+'ilterBtnClick'#8'TabOrder'#2#4#0#0#5'TEdit'#11'FiltVarEdit'#4'Left'#2#14#6
+'Height'#2#23#3'Top'#3#185#0#5'Width'#2'{'#8'TabOrder'#2#5#4'Text'#6#11'Filt'
+'VarEdit'#0#0#0#9'TGroupBox'#9'GroupBox2'#4'Left'#3#177#0#6'Height'#2':'#3'T'
+'op'#3#8#1#5'Width'#3#175#0#7'Caption'#6#21'Unselected Cases Are:'#12'Client'
+'Height'#2'('#11'ClientWidth'#3#171#0#8'TabOrder'#2#2#0#12'TRadioButton'#12
+'FilterOutBtn'#4'Left'#2#8#6'Height'#2#19#3'Top'#2#2#5'Width'#2'R'#7'Caption'
+#6#12'Filtered Out'#8'TabOrder'#2#0#0#0#12'TRadioButton'#9'DeleteBtn'#4'Left'
+#2#8#6'Height'#2#19#3'Top'#2#20#5'Width'#3#130#0#7'Caption'#6#21'Deleted fro'
+'m the File'#8'TabOrder'#2#1#0#0#0#8'TListBox'#10'ExpListBox'#4'Left'#3'p'#1
+#6'Height'#3#229#0#3'Top'#2#24#5'Width'#2'n'#10'ItemHeight'#2#0#8'TabOrder'#2
+#3#0#0#8'TListBox'#8'JoinList'#4'Left'#3#232#1#6'Height'#3#227#0#3'Top'#2#25
+#5'Width'#2'f'#10'ItemHeight'#2#0#8'TabOrder'#2#4#0#0#8'TListBox'#7'NotList'
+#4'Left'#3'V'#2#6'Height'#3#226#0#3'Top'#2#26#5'Width'#2'j'#10'ItemHeight'#2
+#0#8'TabOrder'#2#5#0#0#8'TListBox'#7'OpsList'#4'Left'#3#200#2#6'Height'#3#229
+#0#3'Top'#2#24#5'Width'#2'b'#10'ItemHeight'#2#0#8'TabOrder'#2#6#0#0#7'TButto'
+'n'#8'ResetBtn'#4'Left'#3'q'#1#6'Height'#2#29#3'Top'#3#24#1#5'Width'#2'N'#7
+'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#7#0#0#7'TB'
+'utton'#9'CancelBtn'#4'Left'#3#240#1#6'Height'#2#29#3'Top'#3#26#1#5'Width'#2
+'N'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#8#0#0#7'TButton'
+#10'ComputeBtn'#4'Left'#3'h'#2#6'Height'#2#29#3'Top'#3#24#1#5'Width'#2'N'#7
+'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#9#0#0#7
+'TButton'#9'ReturnBtn'#4'Left'#3#220#2#6'Height'#2#29#3'Top'#3#26#1#5'Width'
+#2'N'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#10#0#0#0
]);

View File

@ -0,0 +1,448 @@
unit SelectCasesUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, MainUnit, OutPutUnit, FunctionsLib, Globals, DataProcs,
DictionaryUnit, SelectIfUnit, RandomSampUnit, RangeSelectUnit;
type
{ TSelectFrm }
TSelectFrm = class(TForm)
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
FiltVarEdit: TEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel;
AllCasesBtn: TRadioButton;
IfCondBtn: TRadioButton;
FilterBtn: TRadioButton;
Label2: TLabel;
FilterOutBtn: TRadioButton;
DeleteBtn: TRadioButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
ExpListBox: TListBox;
JoinList: TListBox;
NotList: TListBox;
OpsList: TListBox;
RandomBtn: TRadioButton;
RangeBtn: TRadioButton;
VarList: TListBox;
procedure AllCasesBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FilterBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure IfCondBtnClick(Sender: TObject);
procedure RandomBtnClick(Sender: TObject);
procedure RangeBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
selectstr : string;
public
{ public declarations }
end;
var
SelectFrm: TSelectFrm;
implementation
{ TSelectFrm }
procedure TSelectFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
NOTList.Clear;
ExpListBox.Clear;
JoinList.Clear;
OpsList.Clear;
AllCasesBtn.Checked := true;
FilterOutBtn.Checked := true;
FiltVarEdit.Text := '';
AllCasesBtn.Checked := true;
IfCondBtn.Checked := false;
RandomBtn.Checked := false;
RangeBtn.Checked := false;
FilterBtn.Checked := false;
FilterOutBtn.Checked := true;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSelectFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TSelectFrm.IfCondBtnClick(Sender: TObject);
begin
if SelectIfFrm.ShowModal = mrCancel then exit;
selectstr := SelectIfFrm.ifstring;
end;
procedure TSelectFrm.RandomBtnClick(Sender: TObject);
begin
if RandomSampFrm.ShowModal = mrCancel then exit;
end;
procedure TSelectFrm.RangeBtnClick(Sender: TObject);
begin
if RangeSelectFrm.ShowModal = mrCancel then exit;
end;
procedure TSelectFrm.AllCasesBtnClick(Sender: TObject);
begin
FilterOutBtn.Checked := false;
DeleteBtn.Checked := false;
end;
procedure TSelectFrm.ComputeBtnClick(Sender: TObject);
var
cellstring, outline, FirstCase, LastCase, filtvar : string;
FilterVar : boolean;
FilterDel : boolean;
IfFilter : boolean;
RandomFilter : boolean;
RangeFilter : boolean;
AllCases : boolean;
testresult, Truth : boolean;
TValue : array[1..20] of boolean;
i, j, filtcol, firstrow, lastrow, norndm, caserow, cases : integer;
NoExpr, delrow : integer;
pcntrndm : double;
Expression : string; // main select if string
leftstr, rightstr, opstr : string;
ExpList, LeftValue, RightValue, JoinOps, Ops, VarLabels : StrDyneVec;
begin
FilterVar := false; // true if a filter variable is selected to use
FilterDel := false; // true if deleting non-selected cases
IfFilter := false; // true if a select if option is used
FilterOn := false; // set to no filtering
RandomFilter := false; // true if random selected cases is used
RangeFilter := false; // true if a range of cases are selected
AllCases := true; // default when selecting all cases
outline := '';
filtcol := 0;
lastrow := 0;
if FilterCol > 0 then filtcol := FilterCol;
if AllCasesBtn.Checked then
begin
FilterOn := false;
OS3MainFrm.FilterEdit.Text := 'OFF';
exit;
end;
if FilterBtn.Checked then // use filter variable
begin
cellstring := FiltVarEdit.Text;
FilterVar := true;
AllCases := false;
FilterOn := true; // global value
OS3MainFrm.FilterEdit.Text := 'ON';
FilterDel := false;
if DeleteBtn.Checked then FilterDel := true;
end;
if IfCondBtn.Checked then
begin
IfFilter := true;
// FilterOn := true;
OS3MainFrm.FilterEdit.Text := 'ON';
AllCases := false;
if DeleteBtn.Checked then FilterDel := true
else FilterDel := false;
end;
if RandomBtn.Checked then
begin
RandomFilter := true;
AllCases := false;
FilterOn := true;
OS3MainFrm.FilterEdit.Text := 'ON';
if DeleteBtn.Checked then FilterDel := true else FilterDel := false;
end;
if RangeBtn.Checked then
begin
RangeFilter := true;
FilterOn := true;
OS3MainFrm.FilterEdit.Text := 'ON';
AllCases := false;
if DeleteBtn.Checked then FilterDel := true else FilterDel := false;
end;
if FilterOutBtn.Checked then
begin
// FilterOn := true;
OS3MainFrm.FilterEdit.Text := 'ON';
end;
if Not FilterOn and AllCases then exit // no current filtering
else
begin
if (RangeFilter) or (RandomFilter) or (IfFilter) then
begin
if filtcol = 0 then
begin
// create a filter variable and select cases
filtcol := NoVariables + 1;
outline := format('Filter%d',[NoVariables]);
OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1;
OS3MainFrm.DataGrid.Cells[filtcol,0] := outline;
// update the dictionary
DictionaryFrm.DictGrid.RowCount := filtcol + 1;
DictionaryFrm.DictGrid.Cells[0,filtcol] := IntToStr(filtcol);
DictionaryFrm.DictGrid.Cells[2,filtcol] := 'Filter';
DictionaryFrm.DictGrid.Cells[3,filtcol] := '3';
DictionaryFrm.DictGrid.Cells[4,filtcol] := 'S';
DictionaryFrm.DictGrid.Cells[5,filtcol] := '0';
DictionaryFrm.DictGrid.Cells[6,filtcol] := ' ';
DictionaryFrm.DictGrid.Cells[7,filtcol] := 'L';
varDefined[filtcol] := true;
OS3MainFrm.NoVarsEdit.Text := IntToStr(filtcol);
NoVariables := filtcol;
end;
end;
// select cases using the method selected
if RangeFilter then
begin
FirstCase := Trim(RangeSelectFrm.FirstCaseEdit.Text);
LastCase := Trim(RangeSelectFrm.LastCaseEdit.Text);
outline := 'RangeFilter';
OS3MainFrm.DataGrid.Cells[filtcol,0] := outline;
DictionaryFrm.DictGrid.Cells[1,filtcol] := outline;
// find first case
firstrow := NoCases;
for i := 1 to NoCases do
begin
if FirstCase = Trim(OS3MainFrm.DataGrid.Cells[0,i]) then // matched!
begin
OS3MainFrm.DataGrid.Cells[filtcol,i] := 'YES';
firstrow := i;
break;
end
else OS3MainFrm.DataGrid.Cells[filtcol,i] := 'NO';
end;
for i := firstrow + 1 to NoCases do
begin
if LastCase = Trim(OS3MainFrm.DataGrid.Cells[0,i]) then //matched
begin
OS3MainFrm.DataGrid.Cells[filtcol,i] := 'YES';
lastrow := i;
break;
end
else OS3MainFrm.DataGrid.Cells[filtcol,i] := 'YES';
end;
for i := lastrow + 1 to NoCases do
OS3MainFrm.DataGrid.Cells[filtcol,i] := 'NO';
end; // end if range filtering
if RandomFilter then
begin
outline := 'RandomFilter';
OS3MainFrm.DataGrid.Cells[filtcol,0] := outline;
DictionaryFrm.DictGrid.Cells[1,filtcol] := outline;
Randomize;
if RandomSampFrm.ApproxBtn.Checked then
begin
pcntrndm := StrToFloat(RandomSampFrm.PcntEdit.Text);
norndm := round((pcntrndm / 100.0) * NoCases);
i := norndm;
while i > 0 do
begin
caserow := random(NoCases-1) + 1;
if OS3MainFrm.DataGrid.Cells[filtcol,caserow] <> 'YES' then
begin
OS3MainFrm.DataGrid.Cells[filtcol,caserow] := 'YES';
i := i - 1;
end;
end;
end
else // exact no from first N cases
begin
norndm := StrToInt(RandomSampFrm.ExactEdit.Text);
cases := StrToInt(RandomSampFrm.CasesEdit.Text);
i := norndm;
while i > 0 do
begin
caserow := random(cases-1) + 1;
if OS3MainFrm.DataGrid.Cells[filtcol,caserow] <> 'YES' then
begin
OS3MainFrm.DataGrid.Cells[filtcol,caserow] := 'YES';
i := i - 1;
end;
end;
end;
// put No in all without a Yes
for i := 1 to NoCases do
if OS3MainFrm.DataGrid.Cells[filtcol,i] <> 'YES' then
OS3MainFrm.DataGrid.Cells[filtcol,i] := 'NO';
end; // end if random filtering
if FilterVar then // use an existing filter variable
begin
filtvar := Trim(FiltVarEdit.Text);
// find column of the variable
filtcol := 0;
for i := 1 to NoVariables do
begin
cellstring := Trim(OS3MainFrm.DataGrid.Cells[i,0]);
if cellstring = filtvar then
begin
filtcol := i;
break;
end;
end;
FilterCol := filtcol;
if filtcol = 0 then
begin
FilterOn := false; // bad filter column
OS3MainFrm.FilterEdit.Text := 'OFF';
end;
end; // end if filter variable
if IfFilter then // user chose the select if button
begin
SetLength(ExpList, 20);
SetLength(LeftValue, 20);
SetLength(RightValue, 20);
SetLength(JoinOps, 20);
SetLength(Ops, 20);
SetLength(VarLabels, NoVariables);
for i := 0 to 19 do
begin
ExpList[i] := '';
LeftValue[i] := '';
RightValue[i] := '';
JoinOps[i] := '';
Ops[i] := '';
end;
for i := 0 to NoVariables-1 do
VarLabels[i] := OS3MainFrm.DataGrid.Cells[i+1,0];
outline := 'IfFilter';
OS3MainFrm.DataGrid.Cells[filtcol,0] := outline;
DictionaryFrm.DictGrid.Cells[1,filtcol] := outline;
Expression := SelectIfFrm.ifstring;
SelectIfFrm.parse(Expression,ExpList,NoExpr,Ops,LeftValue,RightValue,JoinOps);
// Now, for each sub-expression, check left and right values for
// matches to a variable or numeric value and apply the operation
// to each record in the grid.
for i := 0 to NoExpr-1 do
begin
ExpListBox.Items.Add(Ops[i]);
NOTList.Items.Add(LeftValue[i]);
JoinList.Items.Add(RightValue[i]);
OpsList.Items.Add(JoinOps[i]);
end;
for i := 1 to NoCases do
begin
Truth := false;
TestResult := false;
for j := 0 to NoExpr-1 do
begin
leftstr := LeftValue[j];
rightstr := RightValue[j];
opstr := Ops[j];
TValue[j+1] := SelectIfFrm.TruthValue(i,j,leftstr,rightstr,
opstr, VarLabels, NoVariables);
end;
// now evalute the truth table using joing operations
if NoExpr > 0 then
begin
Truth := false;
for j := 0 to NoExpr-1 do
begin
if JoinOps[j] = '&' then
begin
if TValue[j+1] and TValue[j+2] then
TestResult := true;
end;
if JoinOps[j] = '|' then
begin
if TValue[j+1] or TValue[j+2] then
TestResult := true;
end;
if JoinOps[j] = '!' then
begin
if TValue[j+1] <> TValue[j+2] then
TestResult := true;
end;
if (JoinOps[j] = '') and
(NoExpr = 1) then // no join operation
begin
if TValue[j+1] then TestResult := true;
end;
Truth := TestResult;
end; // next jth expression
end; // last jth expression if NoExpr > 0
if Truth then OS3MainFrm.DataGrid.Cells[filtcol,i] := 'YES'
else OS3MainFrm.DataGrid.Cells[filtcol,i] := 'NO';
end; // next case
VarLabels := nil;
Ops := nil;
JoinOps := nil;
RightValue := nil;
LeftValue := nil;
ExpList := nil;
FilterCol := filtcol;
FilterOn := true;
end; // select if filtering
// should we delete the 'NO' cases ?
if FilterDel then
begin
delrow := 1;
while delrow < OS3MainFrm.DataGrid.RowCount do
begin
if OS3MainFrm.DataGrid.Cells[filtcol,delrow] = 'NO' then
begin
OS3MainFrm.DataGrid.Row := delrow;
CutaRow;
end
else delrow := delrow + 1;
end;
end;
end; // else filtering
// SelectFrm.Hide;
end;
procedure TSelectFrm.FilterBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.ItemIndex;
if index >= 0 then FiltVarEdit.Text := VarList.Items.Strings[index];
if FiltVarEdit.Text = '' then
begin
ShowMessage('ERROR! First, click the name of a filter variable');
exit;
end;
FilterOn := true;
for i := 1 to NoVariables do
if OS3MainFrm.DataGrid.Cells[i,0] = FiltVarEdit.Text then FilterCol := i;
end;
initialization
{$I selectcasesunit.lrs}
end.

View File

@ -0,0 +1,332 @@
object SelectIfFrm: TSelectIfFrm
Left = 240
Height = 358
Top = 107
Width = 474
Caption = 'Select Cases IF:'
ClientHeight = 358
ClientWidth = 474
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 8
Height = 14
Top = 8
Width = 44
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
Left = 200
Height = 14
Top = 8
Width = 79
Caption = 'Select Cases IF:'
ParentColor = False
end
object VarList: TListBox
Left = 7
Height = 249
Top = 26
Width = 140
ItemHeight = 0
TabOrder = 0
end
object SelectMemo: TMemo
Left = 193
Height = 91
Top = 26
Width = 267
ReadOnly = True
TabOrder = 1
end
object LeftParenBtn: TBitBtn
Left = 193
Height = 26
Top = 130
Width = 32
Caption = '('
OnClick = LeftParenBtnClick
TabOrder = 2
end
object LessBtn: TBitBtn
Left = 232
Height = 26
Top = 130
Width = 32
Caption = '<'
OnClick = LessBtnClick
TabOrder = 3
end
object GreaterBtn: TBitBtn
Left = 272
Height = 26
Top = 130
Width = 32
Caption = '>'
OnClick = GreaterBtnClick
TabOrder = 4
end
object SevenBtn: TBitBtn
Left = 328
Height = 26
Top = 130
Width = 32
Caption = '7'
OnClick = SevenBtnClick
TabOrder = 5
end
object EightBtn: TBitBtn
Left = 368
Height = 26
Top = 130
Width = 32
Caption = '8'
OnClick = EightBtnClick
TabOrder = 6
end
object NineBtn: TBitBtn
Left = 408
Height = 26
Top = 130
Width = 32
Caption = '9'
OnClick = NineBtnClick
TabOrder = 7
end
object RightParenBtn: TBitBtn
Left = 193
Height = 26
Top = 168
Width = 32
Caption = ')'
OnClick = RightParenBtnClick
TabOrder = 8
end
object LEBtn: TBitBtn
Left = 232
Height = 26
Top = 168
Width = 32
Caption = '<='
OnClick = LEBtnClick
TabOrder = 9
end
object GEBtn: TBitBtn
Left = 272
Height = 26
Top = 168
Width = 32
Caption = '>='
OnClick = GEBtnClick
TabOrder = 10
end
object FourBtn: TBitBtn
Left = 328
Height = 26
Top = 168
Width = 32
Caption = '4'
OnClick = FourBtnClick
TabOrder = 11
end
object FiveBtn: TBitBtn
Left = 368
Height = 26
Top = 168
Width = 32
Caption = '5'
OnClick = FiveBtnClick
TabOrder = 12
end
object SixBtn: TBitBtn
Left = 408
Height = 26
Top = 168
Width = 32
Caption = '6'
OnClick = SixBtnClick
TabOrder = 13
end
object EQBtn: TBitBtn
Left = 193
Height = 26
Top = 208
Width = 32
Caption = '='
OnClick = EQBtnClick
TabOrder = 14
end
object NotBtn: TBitBtn
Left = 232
Height = 26
Top = 208
Width = 32
Caption = '<>'
OnClick = NotBtnClick
TabOrder = 15
end
object MinusBatn: TBitBtn
Left = 272
Height = 26
Top = 208
Width = 32
Caption = '-'
OnClick = MinusBatnClick
TabOrder = 16
end
object OneBtn: TBitBtn
Left = 328
Height = 26
Top = 208
Width = 32
Caption = '1'
OnClick = OneBtnClick
TabOrder = 17
end
object TwoBtn: TBitBtn
Left = 368
Height = 26
Top = 208
Width = 32
Caption = '2'
OnClick = TwoBtnClick
TabOrder = 18
end
object ThreeBtn: TBitBtn
Left = 408
Height = 26
Top = 208
Width = 32
Caption = '3'
OnClick = ThreeBtnClick
TabOrder = 19
end
object PlusBtn: TBitBtn
Left = 272
Height = 26
Top = 249
Width = 32
Caption = '+'
OnClick = PlusBtnClick
TabOrder = 20
end
object ZeroBtn: TBitBtn
Left = 328
Height = 26
Top = 249
Width = 72
Caption = '0'
OnClick = ZeroBtnClick
TabOrder = 21
end
object DotBtn: TBitBtn
Left = 408
Height = 26
Top = 249
Width = 32
Caption = '.'
OnClick = DotBtnClick
TabOrder = 22
end
object AndBtn: TBitBtn
Left = 193
Height = 26
Top = 288
Width = 32
Caption = 'and'
OnClick = AndBtnClick
TabOrder = 23
end
object OrBtn: TBitBtn
Left = 232
Height = 26
Top = 288
Width = 32
Caption = 'or'
OnClick = OrBtnClick
TabOrder = 24
end
object LNotBtn: TBitBtn
Left = 272
Height = 26
Top = 288
Width = 32
Caption = 'not'
OnClick = LNotBtnClick
TabOrder = 25
end
object ResetBtn: TButton
Left = 190
Height = 27
Top = 320
Width = 74
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 26
end
object CancelBtn: TButton
Left = 280
Height = 27
Top = 320
Width = 74
Caption = 'Cancel'
ModalResult = 2
OnClick = CancelBtnClick
TabOrder = 27
end
object OKBtn: TButton
Left = 368
Height = 27
Top = 320
Width = 74
Caption = 'OK'
ModalResult = 1
OnClick = OKBtnClick
TabOrder = 28
end
object InBtn: TBitBtn
Left = 159
Height = 26
Top = 34
Width = 26
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = InBtnClick
TabOrder = 29
end
end

View File

@ -0,0 +1,120 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSelectIfFrm','FORMDATA',[
'TPF0'#12'TSelectIfFrm'#11'SelectIfFrm'#4'Left'#3#240#0#6'Height'#3'f'#1#3'To'
+'p'#2'k'#5'Width'#3#218#1#7'Caption'#6#16'Select Cases IF:'#12'ClientHeight'
+#3'f'#1#11'ClientWidth'#3#218#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0'
+'.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#8#5'Widt'
+'h'#2','#7'Caption'#6#9'Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'
+#4'Left'#3#200#0#6'Height'#2#14#3'Top'#2#8#5'Width'#2'O'#7'Caption'#6#16'Sel'
+'ect Cases IF:'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#7#6'H'
+'eight'#3#249#0#3'Top'#2#26#5'Width'#3#140#0#10'ItemHeight'#2#0#8'TabOrder'#2
+#0#0#0#5'TMemo'#10'SelectMemo'#4'Left'#3#193#0#6'Height'#2'['#3'Top'#2#26#5
+'Width'#3#11#1#8'ReadOnly'#9#8'TabOrder'#2#1#0#0#7'TBitBtn'#12'LeftParenBtn'
+#4'Left'#3#193#0#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Caption'#6#1
+'('#7'OnClick'#7#17'LeftParenBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#7'Less'
+'Btn'#4'Left'#3#232#0#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Caption'
+#6#1'<'#7'OnClick'#7#12'LessBtnClick'#8'TabOrder'#2#3#0#0#7'TBitBtn'#10'Grea'
+'terBtn'#4'Left'#3#16#1#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Captio'
+'n'#6#1'>'#7'OnClick'#7#15'GreaterBtnClick'#8'TabOrder'#2#4#0#0#7'TBitBtn'#8
+'SevenBtn'#4'Left'#3'H'#1#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Capt'
+'ion'#6#1'7'#7'OnClick'#7#13'SevenBtnClick'#8'TabOrder'#2#5#0#0#7'TBitBtn'#8
+'EightBtn'#4'Left'#3'p'#1#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Capt'
+'ion'#6#1'8'#7'OnClick'#7#13'EightBtnClick'#8'TabOrder'#2#6#0#0#7'TBitBtn'#7
+'NineBtn'#4'Left'#3#152#1#6'Height'#2#26#3'Top'#3#130#0#5'Width'#2' '#7'Capt'
+'ion'#6#1'9'#7'OnClick'#7#12'NineBtnClick'#8'TabOrder'#2#7#0#0#7'TBitBtn'#13
+'RightParenBtn'#4'Left'#3#193#0#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '#7
+'Caption'#6#1')'#7'OnClick'#7#18'RightParenBtnClick'#8'TabOrder'#2#8#0#0#7'T'
+'BitBtn'#5'LEBtn'#4'Left'#3#232#0#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '
+#7'Caption'#6#2'<='#7'OnClick'#7#10'LEBtnClick'#8'TabOrder'#2#9#0#0#7'TBitBt'
+'n'#5'GEBtn'#4'Left'#3#16#1#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '#7'Ca'
+'ption'#6#2'>='#7'OnClick'#7#10'GEBtnClick'#8'TabOrder'#2#10#0#0#7'TBitBtn'#7
+'FourBtn'#4'Left'#3'H'#1#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '#7'Capti'
+'on'#6#1'4'#7'OnClick'#7#12'FourBtnClick'#8'TabOrder'#2#11#0#0#7'TBitBtn'#7
+'FiveBtn'#4'Left'#3'p'#1#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '#7'Capti'
+'on'#6#1'5'#7'OnClick'#7#12'FiveBtnClick'#8'TabOrder'#2#12#0#0#7'TBitBtn'#6
+'SixBtn'#4'Left'#3#152#1#6'Height'#2#26#3'Top'#3#168#0#5'Width'#2' '#7'Capti'
+'on'#6#1'6'#7'OnClick'#7#11'SixBtnClick'#8'TabOrder'#2#13#0#0#7'TBitBtn'#5'E'
+'QBtn'#4'Left'#3#193#0#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'
+#6#1'='#7'OnClick'#7#10'EQBtnClick'#8'TabOrder'#2#14#0#0#7'TBitBtn'#6'NotBtn'
+#4'Left'#3#232#0#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'#6#2
+'<>'#7'OnClick'#7#11'NotBtnClick'#8'TabOrder'#2#15#0#0#7'TBitBtn'#9'MinusBat'
+'n'#4'Left'#3#16#1#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'#6#1
+'-'#7'OnClick'#7#14'MinusBatnClick'#8'TabOrder'#2#16#0#0#7'TBitBtn'#6'OneBtn'
+#4'Left'#3'H'#1#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'#6#1'1'
+#7'OnClick'#7#11'OneBtnClick'#8'TabOrder'#2#17#0#0#7'TBitBtn'#6'TwoBtn'#4'Le'
+'ft'#3'p'#1#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'#6#1'2'#7
+'OnClick'#7#11'TwoBtnClick'#8'TabOrder'#2#18#0#0#7'TBitBtn'#8'ThreeBtn'#4'Le'
+'ft'#3#152#1#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2' '#7'Caption'#6#1'3'#7
+'OnClick'#7#13'ThreeBtnClick'#8'TabOrder'#2#19#0#0#7'TBitBtn'#7'PlusBtn'#4'L'
+'eft'#3#16#1#6'Height'#2#26#3'Top'#3#249#0#5'Width'#2' '#7'Caption'#6#1'+'#7
+'OnClick'#7#12'PlusBtnClick'#8'TabOrder'#2#20#0#0#7'TBitBtn'#7'ZeroBtn'#4'Le'
+'ft'#3'H'#1#6'Height'#2#26#3'Top'#3#249#0#5'Width'#2'H'#7'Caption'#6#1'0'#7
+'OnClick'#7#12'ZeroBtnClick'#8'TabOrder'#2#21#0#0#7'TBitBtn'#6'DotBtn'#4'Lef'
+'t'#3#152#1#6'Height'#2#26#3'Top'#3#249#0#5'Width'#2' '#7'Caption'#6#1'.'#7
+'OnClick'#7#11'DotBtnClick'#8'TabOrder'#2#22#0#0#7'TBitBtn'#6'AndBtn'#4'Left'
+#3#193#0#6'Height'#2#26#3'Top'#3' '#1#5'Width'#2' '#7'Caption'#6#3'and'#7'On'
+'Click'#7#11'AndBtnClick'#8'TabOrder'#2#23#0#0#7'TBitBtn'#5'OrBtn'#4'Left'#3
+#232#0#6'Height'#2#26#3'Top'#3' '#1#5'Width'#2' '#7'Caption'#6#2'or'#7'OnCli'
+'ck'#7#10'OrBtnClick'#8'TabOrder'#2#24#0#0#7'TBitBtn'#7'LNotBtn'#4'Left'#3#16
+#1#6'Height'#2#26#3'Top'#3' '#1#5'Width'#2' '#7'Caption'#6#3'not'#7'OnClick'
+#7#12'LNotBtnClick'#8'TabOrder'#2#25#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#190
+#0#6'Height'#2#27#3'Top'#3'@'#1#5'Width'#2'J'#7'Caption'#6#5'Reset'#7'OnClic'
+'k'#7#13'ResetBtnClick'#8'TabOrder'#2#26#0#0#7'TButton'#9'CancelBtn'#4'Left'
+#3#24#1#6'Height'#2#27#3'Top'#3'@'#1#5'Width'#2'J'#7'Caption'#6#6'Cancel'#11
+'ModalResult'#2#2#7'OnClick'#7#14'CancelBtnClick'#8'TabOrder'#2#27#0#0#7'TBu'
+'tton'#5'OKBtn'#4'Left'#3'p'#1#6'Height'#2#27#3'Top'#3'@'#1#5'Width'#2'J'#7
+'Caption'#6#2'OK'#11'ModalResult'#2#1#7'OnClick'#7#10'OKBtnClick'#8'TabOrder'
,#2#28#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#159#0#6'Height'#2#26#3'Top'#2'"'#5'W'
+'idth'#2#26#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0
+'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0
+#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'
+#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190
+'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255
+'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139
+'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160
+#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255
+#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128
+#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199
+'t'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150
+#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255
+#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255
+#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255
+'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163
+'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247
+';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187
+'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#10'InBtnCl'
+'ick'#8'TabOrder'#2#29#0#0#0
]);

View File

@ -0,0 +1,787 @@
unit SelectIfUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, DataProcs, DictionaryUnit, OptionsUnit;
type
{ TSelectIfFrm }
TSelectIfFrm = class(TForm)
LeftParenBtn: TBitBtn;
FourBtn: TBitBtn;
FiveBtn: TBitBtn;
SixBtn: TBitBtn;
EQBtn: TBitBtn;
NotBtn: TBitBtn;
MinusBatn: TBitBtn;
OneBtn: TBitBtn;
TwoBtn: TBitBtn;
ThreeBtn: TBitBtn;
PlusBtn: TBitBtn;
LessBtn: TBitBtn;
ZeroBtn: TBitBtn;
DotBtn: TBitBtn;
AndBtn: TBitBtn;
OrBtn: TBitBtn;
LNotBtn: TBitBtn;
InBtn: TBitBtn;
GreaterBtn: TBitBtn;
SevenBtn: TBitBtn;
EightBtn: TBitBtn;
NineBtn: TBitBtn;
RightParenBtn: TBitBtn;
LEBtn: TBitBtn;
GEBtn: TBitBtn;
ResetBtn: TButton;
CancelBtn: TButton;
OKBtn: TButton;
Label1: TLabel;
Label2: TLabel;
SelectMemo: TMemo;
VarList: TListBox;
procedure AndBtnClick(Sender: TObject);
procedure CancelBtnClick(Sender: TObject);
procedure DotBtnClick(Sender: TObject);
procedure EightBtnClick(Sender: TObject);
procedure EQBtnClick(Sender: TObject);
procedure FiveBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FourBtnClick(Sender: TObject);
procedure GEBtnClick(Sender: TObject);
procedure GreaterBtnClick(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure LEBtnClick(Sender: TObject);
procedure LeftParenBtnClick(Sender: TObject);
procedure LessBtnClick(Sender: TObject);
procedure LNotBtnClick(Sender: TObject);
procedure MinusBatnClick(Sender: TObject);
procedure NineBtnClick(Sender: TObject);
procedure NotBtnClick(Sender: TObject);
procedure OKBtnClick(Sender: TObject);
procedure OneBtnClick(Sender: TObject);
procedure OrBtnClick(Sender: TObject);
procedure PlusBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure RightParenBtnClick(Sender: TObject);
procedure SevenBtnClick(Sender: TObject);
procedure SixBtnClick(Sender: TObject);
procedure ThreeBtnClick(Sender: TObject);
procedure TwoBtnClick(Sender: TObject);
procedure ZeroBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
ifstring : string;
procedure CheckParens(VAR LeftCnt : integer;
VAR RightCnt : integer;
VAR Expression : string);
procedure GetExpression(VAR Expression : string;
VAR SubExpr : string;
VAR LeftParen : integer;
VAR RightParen : integer);
procedure DelSubSt(VAR Expression : string;
FromPos, ToPos : integer);
procedure TrimParens(VAR Expression : string);
function LeadOp(VAR Expression : string) : integer;
function OpPosition(VAR Expression : string;
VAR chr : string;
VAR OpLong : integer) : integer;
procedure RemoveBlanks(VAR Expression : string);
procedure GetLeftSt(VAR Expression : string;
VAR LeftSt : string;
FromPos : integer);
procedure GetRightSt(VAR Expression : string;
VAR RightSt : string;
FromPos : integer;
OpLong : integer);
function isnumeric(VAR Expression : string) : integer;
function GetVarIndex(VAR varstring : string;
VAR VarLabels : StrDyneVec;
NoVars : integer) : integer;
procedure BuildIfList(VAR Expression : string;
VAR ExprList : StrDyneVec;
VAR NoExpr : integer;
VAR JoinOps : StrDyneVec);
procedure parse(VAR Expression : string;
VAR ExprList : StrDyneVec;
VAR NoExpr : integer;
VAR Ops : StrDyneVec;
VAR LeftValue : StrDyneVec;
VAR RightValue : StrDyneVec;
VAR JoinOps : StrDyneVec);
function TruthValue(caseno, ExpNo : integer;
VAR LeftStr : string;
VAR RightStr : string;
VAR OpCode : string;
VAR VarLabels : StrDyneVec;
NoVars : integer) : boolean;
end;
var
SelectIfFrm: TSelectIfFrm;
implementation
uses SelectCasesUnit;
{ TSelectIfFrm }
procedure TSelectIfFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
SelectMemo.Clear;
ifstring := '(';
SelectMemo.Lines.Add(ifstring);
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSelectIfFrm.RightParenBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' ) ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.SevenBtnClick(Sender: TObject);
begin
ifstring := ifstring + '7';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.SixBtnClick(Sender: TObject);
begin
ifstring := ifstring + '6';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.ThreeBtnClick(Sender: TObject);
begin
ifstring := ifstring + '3';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.TwoBtnClick(Sender: TObject);
begin
ifstring := ifstring + '2';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.ZeroBtnClick(Sender: TObject);
begin
ifstring := ifstring + '0';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
if OptionsFrm.fractiontype = 1 then DotBtn.Caption := ','
else DotBtn.Caption := '.';
end;
procedure TSelectIfFrm.FourBtnClick(Sender: TObject);
begin
ifstring := ifstring + '4';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.EQBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' = ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.FiveBtnClick(Sender: TObject);
begin
ifstring := ifstring + '5';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.AndBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' & ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.CancelBtnClick(Sender: TObject);
begin
SelectFrm.ResetBtnClick(self) ;
end;
procedure TSelectIfFrm.DotBtnClick(Sender: TObject);
begin
if OptionsFrm.fractiontype = 0 then ifstring := ifstring + '.'
else ifstring := ifstring + ',';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.EightBtnClick(Sender: TObject);
begin
ifstring := ifstring + '8';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.GEBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' >= ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.GreaterBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' > ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.InBtnClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
ifstring := ifstring + ' ' + VarList.Items.Strings[index] + ' ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.LEBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' <= ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.LeftParenBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' ( ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.LessBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' < ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.LNotBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' ! ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.MinusBatnClick(Sender: TObject);
begin
ifstring := ifstring + ' -';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.NineBtnClick(Sender: TObject);
begin
ifstring := ifstring + '9';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.NotBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' <> ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.OKBtnClick(Sender: TObject);
begin
SelectFrm.FilterOutBtn.Checked := true;
end;
procedure TSelectIfFrm.OneBtnClick(Sender: TObject);
begin
ifstring := ifstring + '1';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.OrBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' | ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.PlusBtnClick(Sender: TObject);
begin
ifstring := ifstring + ' + ';
SelectMemo.Clear;
SelectMemo.Lines.Add(ifstring);
end;
procedure TSelectIfFrm.CheckParens(var LeftCnt: integer; var RightCnt: integer;
var Expression: string);
VAR i : integer;
begin
LeftCnt := 0;
RightCnt := 0;
for i := 1 to Length(Expression) do
begin
if Expression[i] = '(' then LeftCnt := LeftCnt + 1;
if Expression[i] = ')' then RightCnt := RightCnt + 1;
end;
end;
procedure TSelectIfFrm.GetExpression(var Expression: string;
var SubExpr: string; var LeftParen: integer; var RightParen: integer);
VAR i, j : integer;
begin
// Search from left for for first right paren.
// Search back for first left paren (corresponding paren.)
// Extract sub string.
RightParen := 0;
LeftParen := 0;
for i := 1 to Length(Expression) do
begin
if Expression[i] = ')' then
begin
RightParen := i;
break;
end;
end;
for i := RightParen downto 1 do
begin
if Expression[i] = '(' then
begin
LeftParen := i;
break;
end;
end;
if RightParen = 0 then // no parentheses - take whole expression
begin
SubExpr := Expression;
exit;
end;
j := 0;
for i := LeftParen to RightParen do
begin
j := j + 1;
SubExpr := SubExpr + Expression[i];
end;
SetLength(SubExpr,j);
end;
procedure TSelectIfFrm.DelSubSt(var Expression: string; FromPos, ToPos: integer
);
var
stlength : integer;
awidth : integer;
begin
// tempstr := '';
stlength := Length(Expression);
if stlength <= (ToPos - FromPos+1) then exit; // whole expression
awidth := ToPos - FromPos + 1;
Delete(Expression,FromPos,awidth);
end;
procedure TSelectIfFrm.TrimParens(var Expression: string);
var
stlength, i : integer;
begin
stlength := Length(Expression);
if Expression[stlength] = ')' then // paren at right end of string
SetLength(Expression,stlength-1);
stlength := Length(Expression);
if Expression[1] = '(' then // left paren
begin
for i := 1 to stlength - 1 do // copy including null char
Expression[i] := Expression[i+1];
SetLength(Expression,stlength-1);
end;
end;
function TSelectIfFrm.LeadOp(var Expression: string): integer;
VAR chr : char;
begin
chr := Expression[1];
if ( (chr = '|') or (chr = '&') or (chr = '!') )then Result := 1
else Result := 0;
end;
function TSelectIfFrm.OpPosition(var Expression: string; var chr: string;
var OpLong: integer): integer;
var
i, pos : integer;
achar : char;
begin
pos := -1;
chr := '';
for i := 1 to Length(Expression) do
begin
achar := Expression[i];
if (achar = '<') or (achar = '>') or (achar = '=') or (achar = '+') or (achar = '-')
then
begin
pos := i;
chr := chr + achar;
// check for second character
achar := Expression[i+1];
if (achar = '=') or (achar = '<') or (achar = '>') then
chr := chr + achar;
OpLong := Length(chr);
break;
end;
end;
Result := pos;
end;
procedure TSelectIfFrm.RemoveBlanks(var Expression: string);
var
stlength, i : integer;
tempstr : string;
begin
tempstr := '';
stlength := Length(Expression);
for i := 1 to stlength do
begin
if Expression[i] <> ' ' then tempstr := tempstr + Expression[i];
end;
Expression := tempstr;
end;
procedure TSelectIfFrm.GetLeftSt(var Expression: string; var LeftSt: string;
FromPos: integer);
VAR i : integer;
begin
LeftSt := '';
for i := 1 to FromPos - 1 do
if Expression[i] <> ' ' then LeftSt := LeftSt + Expression[i];
end;
procedure TSelectIfFrm.GetRightSt(var Expression: string; var RightSt: string;
FromPos: integer; OpLong: integer);
VAR i : integer;
begin
RightSt := '';
for i := FromPos + OpLong to Length(Expression) do
begin
RightSt := RightSt + Expression[i];
end;
end;
function TSelectIfFrm.isnumeric(var Expression: string): integer;
var
valid : boolean;
i : integer;
begin
valid := false;
for i := 1 to Length(Expression) do
begin
if ( (Expression[i] >= '0') and (Expression[i] <= '9') ) or
(Expression[i] = '.') or (Expression[i] = '-') or
(Expression[i] = '+') or (Expression[i] = ',') then valid := true
else begin
valid := false;
break;
end;
end;
if valid = true then Result := 1 else Result := 0;
end;
function TSelectIfFrm.GetVarIndex(var varstring: string;
var VarLabels: StrDyneVec; NoVars: integer): integer;
var
i, varno : integer;
tempstr : string;
begin
// find a match, if any, between varstring and a VarLabel. Return the
// sequence number of the matching VarLabel if found, else -1.
varno := -1;
for i := 1 to NoVars do
begin
tempstr := VarLabels[i-1];
RemoveBlanks(tempstr);
if varstring = tempstr then
begin
varno := i;
break;
end;
end;
Result := varno;
end;
procedure TSelectIfFrm.BuildIfList(var Expression: string;
var ExprList: StrDyneVec; var NoExpr: integer; var JoinOps: StrDyneVec);
var
stlength, LeftCnt, RightCnt, LeftParen, RightParen, i : integer;
SubExpr : string;
done, found : boolean;
delpos : integer;
begin
//This routine parses a compound expression into a list of sub-expressions
// and joining logical operations
done := false;
NoExpr := 0;
RemoveBlanks(Expression);
stlength := Length(Expression);
if stlength = 0 then exit;
CheckParens(LeftCnt, RightCnt, Expression);
if LeftCnt <> RightCnt then
begin
ShowMessage('ERROR! Unmatched parentheses');
ResetBtnClick(self);
exit;
end;
while not done do
begin
SubExpr := '';
GetExpression(Expression, SubExpr, LeftParen, RightParen);
if LeftParen < RightParen then
begin
TrimParens(SubExpr);
LeftCnt := LeftCnt - 1;
RightCnt := RightCnt - 1;
end;
stlength := Length(SubExpr);
if stlength = 0 then
begin
ShowMessage('Warning! Empty expression found (extraneous parentheses)');
ResetBtnClick(self);
exit;
end;
NoExpr := NoExpr + 1;
ExprList[NoExpr-1] := SubExpr;
if LeftCnt > 0 then // more than one set of parentheses
begin
// Look for a logical connection to next subexpression, if any
found := false;
delpos := RightParen;
if RightParen > 0 then
begin
for i := RightParen+1 to Length(Expression) do
begin
if Expression[i] = '(' then break // start of expression
else begin
if (Expression[i] = '|') or (Expression[i] = '&') or (Expression[i] = '!') then
begin
JoinOps[NoExpr-1] := JoinOps[NoExpr-1] + Expression[i];
found := true;
delpos := i;
end;
end; // end if Expession[i] = '('
end; // next i
end; // if RightParen > 0
if found = false then JoinOps[NoExpr-1] := ' '
else JoinOps[NoExpr-1] := Trim(JoinOps[NoExpr-1]);
if RightParen = 1 then //whole expression left
begin
Expression := ''; // make empty
done := true;
end;
//delete both the substring and the adjacent operator
if done = false then
begin
if found = true then// join operation was found
RightParen := delpos;
DelSubSt(Expression, LeftParen, RightParen);
end;
if (LeftCnt = 1) then // single expression left
begin
TrimParens(Expression);
LeftCnt := LeftCnt - 1;
RightCnt := RightCnt - 1;
end;
if Length(Expression) = 0 then done := true;
end // end if LeftCnt > 0
else done := true;
end; // end while not done
end;
procedure TSelectIfFrm.parse(var Expression: string; var ExprList: StrDyneVec;
var NoExpr: integer; var Ops: StrDyneVec; var LeftValue: StrDyneVec;
var RightValue: StrDyneVec; var JoinOps: StrDyneVec);
var
OpPos, i, OpLong : integer;
chr : string;
tempstr, tempstr2 : string;
begin
// An Expression string should contain one or more parenthetical substrings.
// Each substring should contain an arithmetic or logical operation and have
// a variable or numeric value to the left and right of the operand. The
// substrings should have a logical operand between them (&, |, or !).
// The parse routine first obtains a list of subexpressions and their
// logical seperators (operands). It then parses each subexpression and
// builds a list of operations, left values and right values.
BuildIfList(Expression, ExprList, NoExpr, JoinOps);
for i := 1 to NoExpr do
begin
tempstr := ExprList[i-1];
OpPos := OpPosition(tempstr, chr, OpLong);
if (OpPos = -1) then
begin
ShowMessage('ERROR! Expression missing an operator');
exit;
end;
Ops[i-1] := Ops[i-1] + chr;
tempstr := ExprList[i-1];
GetLeftSt(tempstr, tempstr2, OpPos);
LeftValue[i-1] := tempstr2;
tempstr := ExprList[i-1];
GetRightSt(tempstr,tempstr2, OpPos, OpLong);
RightValue[i-1] := tempstr2;
end;
end;
function TSelectIfFrm.TruthValue(caseno, ExpNo: integer; var LeftStr: string;
var RightStr: string; var OpCode: string; var VarLabels: StrDyneVec;
NoVars: integer): boolean;
var
TempValueLeft, TempValueRight : double;
typeresult, LeftVarPos, RightVarPos : integer;
LeftIsNo, RightIsNo, Truth, badvalue : boolean;
begin
badvalue := false;
TempValueLeft := 0.0;
TempValueRight := 0.0;
LeftVarPos := 0;
RightVarPos := 0;
typeresult := isnumeric(LeftStr);
if typeresult = 1 then
begin
TempValueLeft := StrToFloat(LeftStr);
LeftIsNo := true;
end
else begin //check for a variable label
LeftIsNo := false;
LeftVarPos := GetVarIndex(LeftStr, VarLabels, NoVars);
if LeftVarPos = -1 then
begin
ShowMessage('ERROR! Invalid variable label');
Result := false;
exit;
end;
end;
typeresult := isnumeric(RightStr);
if typeresult = 1 then
begin
TempValueRight := StrToFloat(RightStr);
RightIsNo := true;
end
else begin //check for a variable label
RightIsNo := false;
RightVarPos := GetVarIndex(LeftStr, VarLabels, NoVars);
if RightVarPos = -1 then
begin
ShowMessage('ERROR! Invalid variable label');
Result := false;
exit;
end;
end;
// Now evaluate record truth or falseness
if (RightIsNo) and (not LeftIsNo) then // Left is variable, right is value
begin
if ValidValue(caseno,LeftVarPos) then
TempValueLeft := StrToFloat(OS3MainFrm.DataGrid.Cells[LeftVarPos,caseno])
else badvalue := true;
end;
if (Not RightIsNo) and (LeftIsNo) then // Left is value, right is variable
begin
if ValidValue(caseno,RightVarPos) then
TempValueRight := StrToFloat(OS3MainFrm.DataGrid.Cells[RightVarPos,caseno])
else badvalue := true;
end;
if ( Not RightIsNo) and ( Not LeftIsNo) then // Both are variables
begin
if ValidValue(caseno,LeftVarPos) then
TempValueLeft := StrToFloat(OS3MainFrm.DataGrid.Cells[LeftVarPos,caseno])
else badvalue := true;
if ValidValue(caseno,RightVarPos) then
TempValueRight := StrToFloat(OS3MainFrm.DataGrid.Cells[RightVarPos,caseno])
else badvalue := true;
end;
Truth := false;
if OpCode = '=' then
begin
if (TempValueLeft = TempValueRight) then Truth := true;
end;
if OpCode = '<' then
begin
if (TempValueLeft < TempValueRight) then Truth := true;
end;
if OpCode = '>' then
begin
if (TempValueLeft > TempValueRight) then Truth := true;
end;
if OpCode = '>=' then
begin
if (TempValueLeft >= TempValueRight) then Truth := true;
end;
if OpCode = '<=' then
begin
if (TempValueLeft <= TempValueRight) then Truth := true;
end;
if OpCode = '<>' then
begin
if (TempValueLeft <> TempValueRight) then Truth := true;
end;
if badvalue then Truth := false;
Result := Truth;
end;
initialization
{$I selectifunit.lrs}
end.

View File

@ -0,0 +1,299 @@
object SensForm: TSensForm
Left = 288
Height = 604
Top = 161
Width = 425
Caption = 'Sens Trend Analysis'
ClientHeight = 604
ClientWidth = 425
OnShow = ResetBtnClick
LCLVersion = '0.9.30'
object Memo1: TMemo
Left = 9
Height = 124
Top = 9
Width = 401
Lines.Strings = (
'Sens method for the detection and estimation of trents is used to analyze'
'one or more variable observations collected at equally spaced intervals of'
'time. First, select one or more series variables to analyze. Next, if you'
'have entered more than one variable, indicate how the measures are to'
'be combined (mean or median) and if the values are to be standardized '
'(z scores with mean of 0 and standard deviation of 1.) Finally, select the'
'options desired and click the compute button to complete the analysis.'
)
TabOrder = 0
end
object GroupBox1: TGroupBox
Left = 10
Height = 81
Top = 143
Width = 193
Caption = 'If more than one variable:'
ClientHeight = 63
ClientWidth = 189
TabOrder = 1
object StandardizeChk: TCheckBox
Left = 8
Height = 19
Top = 7
Width = 154
Caption = 'Standardize the measures'
TabOrder = 0
end
object AvgSlopeChk: TCheckBox
Left = 8
Height = 19
Top = 37
Width = 147
Caption = 'Calculate Average Slope'
TabOrder = 1
end
end
object GroupBox2: TGroupBox
Left = 217
Height = 80
Top = 142
Width = 191
Caption = 'Plot'
ClientHeight = 62
ClientWidth = 187
TabOrder = 2
object PlotChk: TCheckBox
Left = 6
Height = 19
Top = 8
Width = 90
Caption = 'Each Variable'
TabOrder = 0
end
object SlopesChk: TCheckBox
Left = 9
Height = 19
Top = 39
Width = 96
Caption = 'Ranked Slopes'
TabOrder = 1
end
end
object GroupBox3: TGroupBox
Left = 16
Height = 110
Top = 234
Width = 184
Caption = 'Print'
ClientHeight = 92
ClientWidth = 180
TabOrder = 3
object PrtDataChk: TCheckBox
Left = 9
Height = 19
Top = 7
Width = 44
Caption = 'Data'
TabOrder = 0
end
object PrtSlopesChk: TCheckBox
Left = 9
Height = 19
Top = 37
Width = 90
Caption = 'Slopes Matrix'
TabOrder = 1
end
object PrtRanksChk: TCheckBox
Left = 10
Height = 19
Top = 62
Width = 96
Caption = 'Ranked Slopes'
TabOrder = 2
end
end
object Label1: TLabel
Left = 216
Height = 16
Top = 243
Width = 65
Caption = 'Alpha Level:'
ParentColor = False
end
object AlphaEdit: TEdit
Left = 298
Height = 23
Top = 239
Width = 47
TabOrder = 4
Text = '0.05'
end
object Label2: TLabel
Left = 16
Height = 16
Top = 350
Width = 102
Caption = 'Available Variables:'
ParentColor = False
end
object VarList: TListBox
Left = 16
Height = 180
Top = 372
Width = 159
ItemHeight = 0
MultiSelect = True
TabOrder = 5
end
object InBtn: TBitBtn
Left = 184
Height = 39
Top = 372
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 6
end
object OutBtn: TBitBtn
Left = 184
Height = 39
Top = 420
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 7
end
object AllBtn: TBitBtn
Left = 184
Height = 39
Top = 484
Width = 38
Caption = 'ALL'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 8
end
object Label3: TLabel
Left = 236
Height = 16
Top = 350
Width = 109
Caption = 'Variables to Analyze:'
ParentColor = False
end
object SelectedList: TListBox
Left = 229
Height = 181
Top = 371
Width = 162
ItemHeight = 0
TabOrder = 9
end
object CancelBtn: TButton
Left = 15
Height = 29
Top = 560
Width = 80
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 10
end
object ResetBtn: TButton
Left = 104
Height = 29
Top = 560
Width = 80
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 11
end
object ComputeBtn: TButton
Left = 224
Height = 29
Top = 560
Width = 80
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 12
end
object ReturnBtn: TButton
Left = 311
Height = 29
Top = 560
Width = 80
Caption = 'Return'
ModalResult = 1
TabOrder = 13
end
end

View File

@ -0,0 +1,160 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSensForm','FORMDATA',[
'TPF0'#9'TSensForm'#8'SensForm'#4'Left'#3' '#1#6'Height'#3'\'#2#3'Top'#3#161#0
+#5'Width'#3#169#1#7'Caption'#6#19'Sens Trend Analysis'#12'ClientHeight'#3'\'
+#2#11'ClientWidth'#3#169#1#6'OnShow'#7#13'ResetBtnClick'#10'LCLVersion'#6#6
+'0.9.30'#0#5'TMemo'#5'Memo1'#4'Left'#2#9#6'Height'#2'|'#3'Top'#2#9#5'Width'#3
+#145#1#13'Lines.Strings'#1#6'ISens method for the detection and estimation o'
+'f trents is used to analyze'#6'Jone or more variable observations collected'
+' at equally spaced intervals of'#6'Ktime. First, select one or more series'
+' variables to analyze. Next, if you'#6'Ehave entered more than one variabl'
+'e, indicate how the measures are to'#6'Gbe combined (mean or median) and if'
+' the values are to be standardized '#6'K(z scores with mean of 0 and stand'
+'ard deviation of 1.) Finally, select the'#6'Foptions desired and click the'
+' compute button to complete the analysis.'#0#8'TabOrder'#2#0#0#0#9'TGroupBo'
+'x'#9'GroupBox1'#4'Left'#2#10#6'Height'#2'Q'#3'Top'#3#143#0#5'Width'#3#193#0
+#7'Caption'#6#26'If more than one variable:'#12'ClientHeight'#2'?'#11'Client'
+'Width'#3#189#0#8'TabOrder'#2#1#0#9'TCheckBox'#14'StandardizeChk'#4'Left'#2#8
+#6'Height'#2#19#3'Top'#2#7#5'Width'#3#154#0#7'Caption'#6#24'Standardize the '
+'measures'#8'TabOrder'#2#0#0#0#9'TCheckBox'#11'AvgSlopeChk'#4'Left'#2#8#6'He'
+'ight'#2#19#3'Top'#2'%'#5'Width'#3#147#0#7'Caption'#6#23'Calculate Average S'
+'lope'#8'TabOrder'#2#1#0#0#0#9'TGroupBox'#9'GroupBox2'#4'Left'#3#217#0#6'Hei'
+'ght'#2'P'#3'Top'#3#142#0#5'Width'#3#191#0#7'Caption'#6#4'Plot'#12'ClientHei'
+'ght'#2'>'#11'ClientWidth'#3#187#0#8'TabOrder'#2#2#0#9'TCheckBox'#7'PlotChk'
+#4'Left'#2#6#6'Height'#2#19#3'Top'#2#8#5'Width'#2'Z'#7'Caption'#6#13'Each Va'
+'riable'#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'SlopesChk'#4'Left'#2#9#6'Height'
+#2#19#3'Top'#2''''#5'Width'#2'`'#7'Caption'#6#13'Ranked Slopes'#8'TabOrder'#2
+#1#0#0#0#9'TGroupBox'#9'GroupBox3'#4'Left'#2#16#6'Height'#2'n'#3'Top'#3#234#0
+#5'Width'#3#184#0#7'Caption'#6#5'Print'#12'ClientHeight'#2'\'#11'ClientWidth'
+#3#180#0#8'TabOrder'#2#3#0#9'TCheckBox'#10'PrtDataChk'#4'Left'#2#9#6'Height'
+#2#19#3'Top'#2#7#5'Width'#2','#7'Caption'#6#4'Data'#8'TabOrder'#2#0#0#0#9'TC'
+'heckBox'#12'PrtSlopesChk'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'%'#5'Width'#2
+'Z'#7'Caption'#6#13'Slopes Matrix'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'PrtRa'
+'nksChk'#4'Left'#2#10#6'Height'#2#19#3'Top'#2'>'#5'Width'#2'`'#7'Caption'#6
+#13'Ranked Slopes'#8'TabOrder'#2#2#0#0#0#6'TLabel'#6'Label1'#4'Left'#3#216#0
+#6'Height'#2#16#3'Top'#3#243#0#5'Width'#2'A'#7'Caption'#6#12'Alpha Level:'#11
+'ParentColor'#8#0#0#5'TEdit'#9'AlphaEdit'#4'Left'#3'*'#1#6'Height'#2#23#3'To'
+'p'#3#239#0#5'Width'#2'/'#8'TabOrder'#2#4#4'Text'#6#4'0.05'#0#0#6'TLabel'#6
+'Label2'#4'Left'#2#16#6'Height'#2#16#3'Top'#3'^'#1#5'Width'#2'f'#7'Caption'#6
+#20'Available Variables:'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Lef'
+'t'#2#16#6'Height'#3#180#0#3'Top'#3't'#1#5'Width'#3#159#0#10'ItemHeight'#2#0
+#11'MultiSelect'#9#8'TabOrder'#2#5#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#184#0#6
+'Height'#2''''#3'Top'#3't'#1#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0
+#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0
+#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
,#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#6#0
+#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#3#164#1#5'Wid'
+'th'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('
+#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0
+#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247
+'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['
+#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255
+'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'
+#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206
+#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'
+#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0
+'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163
+#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199
+#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0
+#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'
+#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'
+#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
,#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7
+'OnClick'#7#11'OutBtnClick'#8'TabOrder'#2#7#0#0#7'TBitBtn'#6'AllBtn'#4'Left'
+#3#184#0#6'Height'#2''''#3'Top'#3#228#1#5'Width'#2'&'#7'Caption'#6#3'ALL'#9
+'NumGlyphs'#2#0#7'OnClick'#7#11'AllBtnClick'#8'TabOrder'#2#8#0#0#6'TLabel'#6
+'Label3'#4'Left'#3#236#0#6'Height'#2#16#3'Top'#3'^'#1#5'Width'#2'm'#7'Captio'
+'n'#6#21'Variables to Analyze:'#11'ParentColor'#8#0#0#8'TListBox'#12'Selecte'
+'dList'#4'Left'#3#229#0#6'Height'#3#181#0#3'Top'#3's'#1#5'Width'#3#162#0#10
+'ItemHeight'#2#0#8'TabOrder'#2#9#0#0#7'TButton'#9'CancelBtn'#4'Left'#2#15#6
+'Height'#2#29#3'Top'#3'0'#2#5'Width'#2'P'#6'Cancel'#9#7'Caption'#6#6'Cancel'
+#11'ModalResult'#2#2#8'TabOrder'#2#10#0#0#7'TButton'#8'ResetBtn'#4'Left'#2'h'
+#6'Height'#2#29#3'Top'#3'0'#2#5'Width'#2'P'#7'Caption'#6#5'Reset'#7'OnClick'
+#7#13'ResetBtnClick'#8'TabOrder'#2#11#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3
+#224#0#6'Height'#2#29#3'Top'#3'0'#2#5'Width'#2'P'#7'Caption'#6#7'Compute'#7
+'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#12#0#0#7'TButton'#9'ReturnBtn'
+#4'Left'#3'7'#1#6'Height'#2#29#3'Top'#3'0'#2#5'Width'#2'P'#7'Caption'#6#6'Re'
+'turn'#11'ModalResult'#2#1#8'TabOrder'#2#13#0#0#0
]);

View File

@ -0,0 +1,578 @@
unit SensUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, functionsLib, OutPutUnit, DataProcs,
DictionaryUnit, contexthelpunit, Math, MatrixLib, GraphLib;
type
{ TSensForm }
TSensForm = class(TForm)
AllBtn: TBitBtn;
AlphaEdit: TEdit;
CancelBtn: TButton;
ResetBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
InBtn: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SelectedList: TListBox;
OutBtn: TBitBtn;
VarList: TListBox;
PrtRanksChk: TCheckBox;
PrtSlopesChk: TCheckBox;
PrtDataChk: TCheckBox;
GroupBox3: TGroupBox;
SlopesChk: TCheckBox;
PlotChk: TCheckBox;
GroupBox2: TGroupBox;
StandardizeChk: TCheckBox;
AvgSlopeChk: TCheckBox;
GroupBox1: TGroupBox;
Memo1: TMemo;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SensForm: TSensForm;
implementation
{ TSensForm }
procedure TSensForm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
AlphaEdit.Text := '0.05';
StandardizeChk.Checked := false;
PlotChk.Checked := false;
SlopesChk.Checked := false;
InBtn.Visible := true;
OutBtn.Visible := false;
AvgSlopeChk.Checked := false;
SelectedList.Clear;
VarList.Clear;
for i := 1 to NoVariables do VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSensForm.InBtnClick(Sender: TObject);
VAR index, i : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
SelectedList.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
OutBtn.Visible := true;
end;
procedure TSensForm.AllBtnClick(Sender: TObject);
VAR count, i : integer;
begin
count := VarList.Items.Count;
if count <= 0 then exit;
for i := 0 to VarList.Items.Count-1 do
SelectedList.Items.Add(VarList.Items.Strings[i]);
VarList.Clear;
OutBtn.Visible := true;
InBtn.Visible := false;
end;
procedure TSensForm.ComputeBtnClick(Sender: TObject);
VAR
NoVars, noselected, count, half, q, tp, low, hi, col : integer;
Values, Slopes, AvgSlopes : DblDyneMat;
RankedQ, Sorted : DblDyneVec;
RowLabels, ColLabels, RankLabels : StrDyneVec;
selected : IntDyneVec;
temp, MedianSlope, MannKendall, Z, C, M1, M2, Alpha, mean, stddev : double;
cellstring, outline : string;
i, j, k, no2do : integer;
Standardize, Plot, SlopePlot, AvgSlope : boolean;
begin
Standardize := false;
Plot := false;
SlopePlot := false;
AvgSlope := false;
if StandardizeChk.Checked then Standardize := true;
if PlotChk.Checked then Plot := true;
if SlopesChk.Checked then SlopePlot := true;
if AvgSlopeChk.Checked then AvgSlope := true;
Alpha := 1.0 - StrToFloat(AlphaEdit.Text);
noselected := SelectedList.Items.Count;
if noselected = 0 then
begin
ShowMessage('ERROR! First select variables to analyze.');
exit;
end;
SetLength(RowLabels,NoCases);
SetLength(ColLabels,NoCases);
SetLength(selected,noselected);
SetLength(Values,NoCases,noselected+1);
SetLength(Slopes,NoCases,NoCases);
SetLength(RankedQ,NoVars);
SetLength(Sorted,NoCases);
SetLength(AvgSlopes,NoCases,NoCases);
for i := 0 to NoCases-1 do
begin
RowLabels[i] := OS3MainFrm.DataGrid.Cells[0,i+1];
ColLabels[i] := RowLabels[i];
for j := 0 to NoCases-1 do Slopes[i,j] := 0.0;
end;
// get selected variables
for i := 1 to noselected do
begin
cellstring := SelectedList.Items.Strings[i-1];
for j := 1 to NoVariables do
if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then
selected[i-1] := j;
end;
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Sens Detection and Estimation of Trends');
outline := format('Number of data points = %d, Confidence Interval = %4.2f',
[NoCases,Alpha]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
//Get the data
if AvgSlope then for i := 0 to NoCases-1 do Values[i,noselected] := 0.0;
for j := 0 to noselected-1 do
begin
col := selected[j];
for i := 1 to NoCases do
begin
Values[i-1,j] := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i])));
if AvgSlope then Values[i-1,noselected] := Values[i-1,noselected] +
Values[i-1,j];
end;
end;
if PrtDataChk.Checked then
begin
outline:= 'CASE';
MAT_PRINT(Values,NoCases,noselected,outline,RowLabels,ColLabels,NoCases);
OutPutFrm.ShowModal;
end;
// standardize if more than one variable and standardization elected
if (noselected > 1) and (standardize = true) then
begin
for j := 0 to noselected-1 do
begin
mean := 0.0;
stddev := 0.0;
for i := 0 to NoCases-1 do
begin
mean := mean + Values[i,j];
stddev := stddev + (Values[i,j] * Values[i,j]);
end;
stddev := stddev - (mean * mean) / NoCases;
stddev := stddev / (NoCases - 1);
stddev := sqrt(stddev);
mean := mean / NoCases;
for i := 0 to NoCases-1 do
Values[i,j] := (Values[i,j] - mean)/ stddev;
col := selected[j];
outline := format('Variable = %s, mean = %8.3f, standard deviation = %8.3f',
[OS3MainFrm.DataGrid.Cells[col,0],mean,stddev]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
// average the values if elected
if AvgSlope then for i := 0 to NoCases - 1 do Values[i,noselected] :=
Values[i,noselected] / noselected;
// get interval slopes
no2do := noselected;
if AvgSlope then no2do := no2do + 1;
for j := 0 to no2do - 1 do
begin
if j < noselected then
begin
col := selected[j];
cellstring := OS3MainFrm.DataGrid.Cells[col,0];
end
else
begin
col := 0;
cellstring := 'Combined Scores';
end;
for i := 0 to NoCases-2 do
begin
for k := i + 1 to NoCases-1 do
Slopes[i,k] := (Values[k,j] - Values[i,j]) / (k-i);
end;
if PrtSlopesChk.Checked then
begin
outline := 'CASE';
MAT_PRINT(Slopes,NoCases,NoCases,outline,RowLabels,ColLabels,NoCases);
end;
// get ranked slopes and median estimator
count := 0;
for i := 0 to NoCases-2 do
begin
for k := i+1 to NoCases-1 do
begin
RankedQ[count] := Slopes[i,k];
count := count + 1;
end;
end;
//sort into ascending order
for i := 0 to count - 2 do
begin
for k := i + 1 to count-1 do
begin
if RankedQ[i] > RankedQ[k] then
begin
temp := RankedQ[i];
RankedQ[i] := RankedQ[k];
RankedQ[k] := temp;
end;
end;
end;
if PrtRanksChk.Checked then
begin
SetLength(RankLabels,count);
for k := 0 to count-1 do RankLabels[k] := IntToStr(k+1);
OutPutFrm.RichEdit.Lines.Add('Ranked Slopes');
for i := 0 to count-1 do
begin
outline := format('Label = %s, Ranked Q = %8.3f',
[RankLabels[i],RankedQ[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.ShowModal;
RankLabels := nil;
end;
// get median slope
half := count div 2;
if (2 * half) < count then MedianSlope := RankedQ[half]
else MedianSlope := (RankedQ[half-1] + RankedQ[half]) / 2.0;
// get Mann-Kendall statistic based on tied values
for i := 0 to NoCases-1 do Sorted[i] := Values[i,j];
for i := 0 to NoCases-2 do
begin
for k := i+1 to NoCases-1 do
begin
if Sorted[i] > Sorted[k] then
begin
temp := Sorted[i];
Sorted[i] := Sorted[k];
Sorted[k] := temp;
end;
end;
end;
MannKendall := 0.0;
q := 0;
i := -1;
while (i < NoCases-2) do
begin
i := i + 1;
tp := 1; // no. of ties for pth (i) value
for k := i + 1 to NoCases-1 do
begin
if Sorted[k] <> Sorted[i] then
begin
i := k-1;
break;
end
else tp := tp + 1;
end; // next k
if tp > 1 then
begin
q := q + 1;
MannKendall := MannKendall + (tp * (tp-1) * (2 * tp + 5));
end;
end; // end next i
MannKendall := (NoCases * (NoCases-1) * (2 * NoCases + 5) -
MannKendall) / 18.0;
Z := inversez(Alpha);
if MannKendall > 0 then
begin
C := Z * sqrt(MannKendall);
M1 := (count - C) / 2.0;
M2 := (count + C) / 2.0;
end
else begin
outline := format('Error: z = %8.3f, Mann-Kendall = %8.3f',
[Z,MannKendall]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
// show results
if j < noselected then
begin
outline := format('Results for %s',[cellstring]);
OutPutFrm.RichEdit.Lines.Add(outline);
end
else
OutPutFrm.RichEdit.Lines.Add('Results for Averaged Values');
if (noselected > 1) and (Standardize = true) then
begin
mean := 0.0;
stddev := 0.0;
for i := 0 to NoCases-1 do
begin
mean := mean + Values[i,j];
stddev := stddev + (Values[i,j] * Values[i,j]);
end;
stddev := stddev - (mean * mean) / NoCases;
stddev := stddev / (NoCases - 1);
stddev := sqrt(stddev);
mean := mean / NoCases;
outline := format('Mean = %8.3f, Standard Deviation = %8.3f',
[mean,stddev]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := format('Median Slope for %d values = %8.3f',
[count,MedianSlope]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Mann-Kendall Variance statistic = %8.3f (%d ties)',
[MannKendall,q]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Ranks of the lower and upper confidence = %8.3f, %8.3f',
[M1, M2+1]);
OutPutFrm.RichEdit.Lines.Add(outline);
low := round(M1 - 1.0);
if ((M1-1) - low) > 0.5 then low := round(M1-1);
hi := round(M2);
if (M2 - hi) > 0.5 then hi := round(M2);
if (low > 0) or (hi <= count) then
begin
outline := format('Corresponding lower and upper slopes = %8.3f, %8.3f',
[RankedQ[low],RankedQ[hi]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end
else begin
outline := format('ERROR! low rank = %d, hi rank = %d',
[low, hi]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
// plot slopes if elected
if Plot then
begin
SetLength(GraphFrm.Xpoints,1,NoCases+1);
SetLength(GraphFrm.Ypoints,1,NoCases+1);
GraphFrm.GraphType := 2;
GraphFrm.nosets := 1;
GraphFrm.nbars := NoCases;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlue;
GraphFrm.FloorColor := clGray;
if j < noselected then GraphFrm.Heading := OS3MainFrm.DataGrid.Cells[col,0]
else GraphFrm.Heading := 'Average Values';
GraphFrm.barwideprop := 1.0;
GraphFrm.AutoScale := true;
GraphFrm.ShowLeftWall := true;
GraphFrm.ShowRightWall := true;
GraphFrm.ShowBottomWall := true;
GraphFrm.YTitle := 'Measure';
GraphFrm.XTitle := 'Time';
for k := 0 to NoCases - 1 do
begin
GraphFrm.Ypoints[0,k] := Values[k,j];
GraphFrm.Xpoints[0,k] := k+1;
end;
GraphFrm.ShowModal;
GraphFrm.Ypoints := nil;
GraphFrm.Xpoints := nil;
end;
// plot ranked slopes if elected
if SlopePlot then
begin
SetLength(GraphFrm.Xpoints,1,count+1);
SetLength(GraphFrm.Ypoints,1,count+1);
GraphFrm.GraphType := 2;
GraphFrm.nosets := 1;
GraphFrm.nbars := count;
GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlue;
GraphFrm.FloorColor := clGray;
GraphFrm.Heading := 'Ranked Slopes';
GraphFrm.barwideprop := 1.0;
GraphFrm.AutoScale := true;
GraphFrm.ShowLeftWall := true;
GraphFrm.ShowRightWall := true;
GraphFrm.ShowBottomWall := true;
GraphFrm.YTitle := 'Slope';
GraphFrm.XTitle := 'Rank';
for k := 0 to count - 1 do
begin
GraphFrm.Ypoints[0,k] := RankedQ[k];
GraphFrm.Xpoints[0,k] := k+1;
end;
GraphFrm.ShowModal;
GraphFrm.Ypoints := nil;
GraphFrm.Xpoints := nil;
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
end; // next variable j
if AvgSlope then
begin
for i := 0 to NoCases-2 do
begin
for k := i + 1 to NoCases-1 do
begin
AvgSlopes[i,k] := AvgSlopes[i,k] + Slopes[i,k];
end;
end;
end;
// Average multiple measures
if AvgSlope then
begin
OutPutFrm.RichEdit.Lines.Add('Results for Averaged Slopes');
for i := 0 to NoCases-2 do
begin
for k := i + 1 to NoCases-1 do
AvgSlopes[i,k] := AvgSlopes[i,k] / noselected;
end;
// get ranked slopes and median estimator
count := 0;
for i := 0 to NoCases-2 do
begin
for j := i + 1 to NoCases-1 do
begin
RankedQ[count] := AvgSlopes[i,j];
count := count + 1;
end;
end;
for i := 0 to Count-2 do
begin
for j := i + 1 to count - 1 do
begin
if RankedQ[i] > RankedQ[j] then
begin
temp := RankedQ[i];
RankedQ[i] := RankedQ[j];
RankedQ[j] := temp;
end;
end;
end;
// get median slope
half := count div 2;
if (2 * half) < count then MedianSlope := RankedQ[half + 1]
else MedianSlope := (RankedQ[half] + RankedQ[half+1]) / 2.0;
// get Mann-Kendall statistic based on tied values
MannKendall := 0.0;
q := 0;
i := -1;
while (i < count-1) do
begin
i := i + 1;
tp := 1; // no. of ties for pth (i) value
for j := i + 1 to count-1 do
begin
if RankedQ[j] <> RankedQ[i] then
begin
i := j - 1;
break;
end
else tp := tp + 1;
end;
if tp > 1 then
begin
q := q + 1;
MannKendall := MannKendall + (tp * (tp-1) * (2 * tp + 5));
end;
end; // end do while
MannKendall := (NoCases * (NoCases-1) * (2 * NoCases + 5) - MannKendall) / 18.0;
Z := inversez(Alpha);
if MannKendall < 0.0 then
begin
outline := format('Error in calculating Mann-Kendall = %8.3f',
[MannKendall]);
ShowMessage(outline);
end;
if MannKendall > 0.0 then C := Z * sqrt(MannKendall)
else C := Z;
M1 := (count - C) / 2.0;
M2 := (count + C) / 2.0;
// Show results
outline := format('Median Slope for %d values = %8.3f for averaged measures',
[count,MedianSlope]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Mann-Kendall Variance statistic = %8.3f (%d ties observed)',
[MannKendall,q]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Ranks of the lower and upper confidence = (%8.3f, %8.3f)',
[M1, M2]);
OutPutFrm.RichEdit.Lines.Add(outline);
low := round(M1) - 1;
if ((M1-1) - low) > 0.5 then low := round(M1 - 1);
hi := round(M2);
if (M2 - hi) > 0.5 then hi := round(M2);
outline := format('Corresponding lower and upper slopes = (%8.3f, %8.3f)',
[RankedQ[low],RankedQ[hi]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end; // end if average slope
OutPutFrm.ShowModal;
// cleanup
AvgSlopes := nil;
Sorted := nil;
RankedQ := nil;
Slopes := nil;
Values := nil;
selected := nil;
ColLabels := nil;
RowLabels := nil;
end;
procedure TSensForm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := SelectedList.ItemIndex;
VarList.Items.Add(SelectedList.Items.Strings[index]);
SelectedList.Items.Delete(index);
InBtn.visible := true;
if SelectedList.Items.Count = 0 then OutBtn.Visible := false;
end;
initialization
{$I sensunit.lrs}
end.

View File

@ -0,0 +1,106 @@
object SigmaChartFrm: TSigmaChartFrm
Left = 197
Height = 206
Top = 123
Width = 439
Caption = 'Sigma Charting'
ClientHeight = 206
ClientWidth = 439
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 8
Height = 14
Top = 8
Width = 90
Caption = 'Selection Variables'
ParentColor = False
end
object Label2: TLabel
Left = 167
Height = 14
Top = 24
Width = 71
Caption = 'Group Variable'
ParentColor = False
end
object Label3: TLabel
Left = 170
Height = 14
Top = 80
Width = 107
Caption = 'Measurement Variable'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 169
Top = 24
Width = 147
ItemHeight = 0
OnClick = VarListClick
TabOrder = 0
end
object GroupEdit: TEdit
Left = 170
Height = 21
Top = 40
Width = 141
TabOrder = 1
Text = 'GroupEdit'
end
object MeasEdit: TEdit
Left = 170
Height = 21
Top = 96
Width = 138
TabOrder = 2
Text = 'MeasEdit'
end
object ResetBtn: TButton
Left = 337
Height = 31
Top = 48
Width = 82
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object CancelBtn: TButton
Left = 337
Height = 31
Top = 88
Width = 82
Caption = 'Cancel'
ModalResult = 2
TabOrder = 4
end
object ComputeBtn: TButton
Left = 337
Height = 31
Top = 128
Width = 82
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object ReturnBtn: TButton
Left = 337
Height = 31
Top = 168
Width = 82
Caption = 'Return'
ModalResult = 1
TabOrder = 6
end
object HelpBtn: TButton
Tag = 145
Left = 337
Height = 31
Top = 7
Width = 81
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
end

View File

@ -0,0 +1,28 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSigmaChartFrm','FORMDATA',[
'TPF0'#14'TSigmaChartFrm'#13'SigmaChartFrm'#4'Left'#3#197#0#6'Height'#3#206#0
+#3'Top'#2'{'#5'Width'#3#183#1#7'Caption'#6#14'Sigma Charting'#12'ClientHeigh'
+'t'#3#206#0#11'ClientWidth'#3#183#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#8#5'W'
+'idth'#2'Z'#7'Caption'#6#19'Selection Variables'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#6'Label2'#4'Left'#3#167#0#6'Height'#2#14#3'Top'#2#24#5'Width'#2'G'#7'C'
+'aption'#6#14'Group Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Le'
+'ft'#3#170#0#6'Height'#2#14#3'Top'#2'P'#5'Width'#2'k'#7'Caption'#6#20'Measur'
+'ement Variable'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6
+'Height'#3#169#0#3'Top'#2#24#5'Width'#3#147#0#10'ItemHeight'#2#0#7'OnClick'#7
+#12'VarListClick'#8'TabOrder'#2#0#0#0#5'TEdit'#9'GroupEdit'#4'Left'#3#170#0#6
+'Height'#2#21#3'Top'#2'('#5'Width'#3#141#0#8'TabOrder'#2#1#4'Text'#6#9'Group'
+'Edit'#0#0#5'TEdit'#8'MeasEdit'#4'Left'#3#170#0#6'Height'#2#21#3'Top'#2'`'#5
+'Width'#3#138#0#8'TabOrder'#2#2#4'Text'#6#8'MeasEdit'#0#0#7'TButton'#8'Reset'
+'Btn'#4'Left'#3'Q'#1#6'Height'#2#31#3'Top'#2'0'#5'Width'#2'R'#7'Caption'#6#5
+'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#9'Canc'
+'elBtn'#4'Left'#3'Q'#1#6'Height'#2#31#3'Top'#2'X'#5'Width'#2'R'#7'Caption'#6
+#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#10'ComputeBtn'
+#4'Left'#3'Q'#1#6'Height'#2#31#3'Top'#3#128#0#5'Width'#2'R'#7'Caption'#6#7'C'
+'ompute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'R'
+'eturnBtn'#4'Left'#3'Q'#1#6'Height'#2#31#3'Top'#3#168#0#5'Width'#2'R'#7'Capt'
+'ion'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#6#0#0#7'TButton'#7'HelpB'
+'tn'#3'Tag'#3#145#0#4'Left'#3'Q'#1#6'Height'#2#31#3'Top'#2#7#5'Width'#2'Q'#7
+'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,356 @@
unit SigmaChartUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, MainUnit, Globals, DataProcs, OutPutUnit, Buttons, FunctionsLib,
BlankFrmUnit, contexthelpunit;
type
{ TSigmaChartFrm }
TSigmaChartFrm = class(TForm)
HelpBtn: TButton;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
MeasEdit: TEdit;
GroupEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure VarListClick(Sender: TObject);
private
{ private declarations }
procedure PlotMeans(VAR means : DblDyneVec;
NoGrps : integer;
UCL, LCL, GrandMean : double;
TargetSpec, LowerSpec, UpperSpec : double;
Sender: TObject);
public
{ public declarations }
end;
var
SigmaChartFrm: TSigmaChartFrm;
implementation
{ TSigmaChartFrm }
procedure TSigmaChartFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
GroupEdit.Text := '';
MeasEdit.Text := '';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSigmaChartFrm.VarListClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
if GroupEdit.Text = '' then GroupEdit.Text := VarList.Items.Strings[index]
else MeasEdit.Text := VarList.Items.Strings[index];
end;
procedure TSigmaChartFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSigmaChartFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TSigmaChartFrm.ComputeBtnClick(Sender: TObject);
label cleanup;
var
i, j, GrpVar, MeasVar, mingrp, maxgrp, G, range, grpsize : integer;
oldgrpsize : integer;
X, UCL, LCL, Sigma, UpperSpec, LowerSpec, TargetSpec : double;
xmin, xmax, GrandMean, GrandSD, semean, D3Value, D4Value : double;
GrandSigma, C4, gamma, B : double;
means, stddev, sigmas : DblDyneVec;
count : IntDyneVec;
cellstring, outline : string;
sizeerror : boolean;
const D3 : array[1..24] of double =
(0,0,0,0,0,0.076,0.136,0.184,0.223,0.256,0.283,0.307,0.328,
0.347,0.363,0.378,0.391,0.403,0.415,0.425,0.434,0.443,
0.451,0.459);
const D4 : array[1..24] of double =
(3.267,2.574,2.282,2.114,2.004,1.924,1.864,1.816,1.777,
1.744,1.717,1.693,1.672,1.653,1.637,1.622,1.608,1.597,
1.585,1.575,1.566,1.557,1.548,1.541);
begin
GrpVar := 1;
MeasVar := 2;
Sigma := 3.0;
UpperSpec := 0.0;
LowerSpec := 0.0;
TargetSpec := 0.0;
grpsize := 0;
oldgrpsize := 0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = GroupEdit.Text then GrpVar := i;
if cellstring = MeasEdit.Text then MeasVar := i;
end;
mingrp := 10000;
maxgrp := -10000;
for i := 1 to NoCases do
begin
G := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i])));
if G < mingrp then mingrp := G;
if G > maxgrp then maxgrp := G;
end;
range := maxgrp - mingrp + 1;
SetLength(means,range);
SetLength(count,range);
SetLength(stddev,range);
for i := 0 to range-1 do
begin
count[i] := 0;
means[i] := 0.0;
stddev[i] := 0.0;
end;
semean := 0.0;
GrandMean := 0.0;
GrandSigma := 0.0;
sizeerror := false;
// calculate group ranges, grand mean, group sd's, semeans
for j := 1 to range do // groups
begin
xmin := 10000.0;
xmax := -10000.0;
for i := 1 to NoCases do
begin
G := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i])));
G := G - mingrp + 1;
if G = j then
begin
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar,i]));
if X > xmax then xmax := X;
if X < xmin then xmin := X;
means[G-1] := means[G-1] + X;
count[G-1] := count[G-1] + 1;
stddev[G-1] := stddev[G-1] + (X * X);
semean := semean + (X * X);
GrandMean := GrandMean + X;
end;
end; // next case
stddev[j-1] := stddev[j-1] - (means[j-1] * means[j-1] / count[j-1]);
stddev[j-1] := stddev[j-1] / (count[j-1] - 1);
stddev[j-1] := sqrt(stddev[j-1]);
means[j-1] := means[j-1] / count[j-1];
GrandSigma := GrandSigma + stddev[j-1];
grpsize := count[j-1];
if j = 1 then oldgrpsize := grpsize;
if oldgrpsize <> grpsize then sizeerror := true;
end;
if (grpsize < 2) or (grpsize > 25) or (sizeerror) then
begin
ShowMessage('ERROR! Group sizes error.');
goto cleanup;
end;
semean := semean - ((GrandMean * GrandMean) / NoCases);
semean := semean / (NoCases - 1);
semean := sqrt(semean);
GrandSD := semean;
semean := semean / sqrt(NoCases);
GrandMean := GrandMean / NoCases;
GrandSigma := GrandSigma / range;
D3Value := D3[grpsize-1];
D4Value := D4[grpsize-1];
C4 := sqrt(2.0 / (grpsize - 1));
gamma := exp(gammln(grpsize / 2.0));
C4 := C4 * gamma;
gamma := exp(gammln((grpsize-1) / 2.0));
C4 := C4 / gamma;
B := GrandSigma * sqrt(1.0 - (C4 * C4)) / C4;
UCL := GrandSigma + (3.0 * B);
LCL := GrandSigma - (3.0 * B);
if (LCL < 0.0) then LCL := 0.0;
// printed results
OutPutFrm.RichEdit.Lines.Add('X Bar Chart Results');
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Group Size Mean Std.Dev.');
OutPutFrm.RichEdit.Lines.Add('_____ ____ _________ ________');
for i := 0 to range-1 do
begin
outline := format(' %3d %3d %8.2f %8.2f',
[i+1,count[i],means[i], stddev[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := format('Grand Mean = %8.2f, Std.Dev. = %8.3f, Standard Error of Mean = %8.2f',
[GrandMean, GrandSD, semean]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Mean Sigma = %8.2f',[GrandSigma]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Lower Control Limit = %8.3f, Upper Control Limit = %8.3f',
[LCL, UCL]);
OutPutfrm.RichEdit.Lines.Add(outline);
OutPutFrm.ShowModal;
// show graph
PlotMeans(stddev,range,UCL,LCL,GrandSigma,TargetSpec,
LowerSpec, UpperSpec, self);
cleanup:
stddev := nil;
count := nil;
means := nil;
end;
procedure TSigmaChartFrm.PlotMeans(var means: DblDyneVec; NoGrps: integer; UCL,
LCL, GrandMean: double; TargetSpec, LowerSpec, UpperSpec: double;
Sender: TObject);
var
i, xpos, ypos, hleft, hright, vtop, vbottom, imagewide : integer;
vhi, hwide, offset, strhi : integer;
imagehi, maxval, minval, valincr, Yvalue : double;
Title : string;
begin
maxval := -10000.0;
minval := 10000.0;
for i := 0 to NoGrps-1 do
begin
if means[i] > maxval then maxval := means[i];
if means[i] < minval then minval := means[i];
end;
if UCL > maxval then maxval := UCL;
if LCL < minval then minval := LCL;
BlankFrm.Image1.Canvas.Clear;
BlankFrm.Show;
Title := 'SIGMA CHART FOR : ' + OS3MainFrm.FileNameEdit.Text;
BlankFrm.Caption := Title;
imagewide := BlankFrm.Width;
imagehi := BlankFrm.Height;
vtop := 20;
vbottom := round(imagehi) - 80;
vhi := vbottom - vtop;
hleft := 100;
hright := imagewide - 80;
hwide := hright - hleft;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
// Draw chart border
BlankFrm.Image1.Canvas.Rectangle(hleft,vtop-10,hleft+hwide,vtop+vhi+10);
// draw Grand Mean
ypos := round(vhi * ( (maxval - GrandMean) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'MEAN';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.Brush.Color := clLtGray;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
// draw horizontal axis
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom + 20);
BlankFrm.Image1.Canvas.LineTo(hright,vbottom + 20);
for i := 1 to NoGrps do
begin
ypos := vbottom + 10;
xpos := round((hwide / NoGrps)* i + hleft);
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := ypos + 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := format('%d',[i]);
offset := BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := xpos - offset;
ypos := ypos + strhi;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
xpos := 10;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,'GROUPS:');
end;
// Draw vertical axis
valincr := (maxval - minval) / 10.0;
for i := 1 to 11 do
begin
Title := format('%8.2f',[maxval - ((i-1)*valincr)]);
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := 10;
Yvalue := maxval - (valincr * (i-1));
ypos := round(vhi * ( (maxval - Yvalue) / (maxval - minval)));
ypos := ypos + vtop - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
// draw lines for means of the groups
ypos := round(vhi * ( (maxval - means[0]) / (maxval - minval)));
ypos := ypos + vtop;
xpos := round((hwide / NoGrps) + hleft);
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
for i := 2 to NoGrps do
begin
ypos := round(vhi * ( (maxval - means[i-1]) / (maxval - minval)));
ypos := ypos + vtop;
xpos := round((hwide / NoGrps)* i + hleft);
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
// Draw upper and lower confidence intervals
ypos := round(vhi * ( (maxval - UCL) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'UCL';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
ypos := round(vhi * ( (maxval - LCL) / (maxval - minval)));
ypos := ypos + vtop;
xpos := hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hright;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := 'LCL';
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
end;
initialization
{$I sigmachartunit.lrs}
end.

View File

@ -0,0 +1,274 @@
object SignTestFrm: TSignTestFrm
Left = 141
Height = 300
Top = 99
Width = 347
Caption = 'The Matched Pairs Sign Test'
ClientHeight = 300
ClientWidth = 347
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 2
Width = 90
Caption = 'Variables Available'
ParentColor = False
end
object Label2: TLabel
Left = 200
Height = 14
Top = 14
Width = 48
Caption = 'Variable 1'
ParentColor = False
end
object Label3: TLabel
Left = 201
Height = 14
Top = 114
Width = 48
Caption = 'Variable 2'
ParentColor = False
end
object VarList: TListBox
Left = 5
Height = 267
Top = 16
Width = 148
TabOrder = 0
end
object Var1In: TBitBtn
Left = 160
Height = 29
Top = 15
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Var1InClick
TabOrder = 1
end
object Var1Out: TBitBtn
Left = 160
Height = 29
Top = 48
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Var1OutClick
TabOrder = 2
end
object Var2In: TBitBtn
Left = 160
Height = 29
Top = 112
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Var2InClick
TabOrder = 3
end
object Var2Out: TBitBtn
Left = 160
Height = 29
Top = 144
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Var2OutClick
TabOrder = 4
end
object Var1Edit: TEdit
Left = 201
Height = 20
Top = 31
Width = 125
TabOrder = 5
Text = 'Var1Edit'
end
object Var2Edit: TEdit
Left = 201
Height = 20
Top = 128
Width = 125
TabOrder = 6
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 159
Height = 30
Top = 185
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 7
end
object CancelBtn: TButton
Left = 248
Height = 30
Top = 184
Width = 78
Caption = 'Cancel'
ModalResult = 2
TabOrder = 8
end
object ComputeBtn: TButton
Left = 160
Height = 30
Top = 248
Width = 78
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 9
end
object ReturnBtn: TButton
Left = 248
Height = 30
Top = 248
Width = 78
Caption = 'Return'
ModalResult = 1
TabOrder = 10
end
end

View File

@ -0,0 +1,232 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSignTestFrm','FORMDATA',[
'TPF0'#12'TSignTestFrm'#11'SignTestFrm'#4'Left'#3#141#0#6'Height'#3','#1#3'To'
+'p'#2'c'#5'Width'#3'['#1#7'Caption'#6#27'The Matched Pairs Sign Test'#12'Cli'
+'entHeight'#3','#1#11'ClientWidth'#3'['#1#6'OnShow'#7#8'FormShow'#10'LCLVers'
+'ion'#6#8'0.9.26.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2
+#2#5'Width'#2'Z'#7'Caption'#6#19'Variables Available'#11'ParentColor'#8#0#0#6
+'TLabel'#6'Label2'#4'Left'#3#200#0#6'Height'#2#14#3'Top'#2#14#5'Width'#2'0'#7
+'Caption'#6#10'Variable 1'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'
+#3#201#0#6'Height'#2#14#3'Top'#2'r'#5'Width'#2'0'#7'Caption'#6#10'Variable 2'
+#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#5#6'Height'#3#11#1#3
+'Top'#2#16#5'Width'#3#148#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#6'Var1In'#4'Left'
+#3#160#0#6'Height'#2#29#3'Top'#2#15#5'Width'#2'"'#10'Glyph.Data'#10':'#4#0#0
+'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0
+#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'
+#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'
+#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255
+#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'
+#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171
+#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204
+#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'
+#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255
+'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161
+'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'Var1InClick'#8'TabOrde'
+'r'#2#1#0#0#7'TBitBtn'#7'Var1Out'#4'Left'#3#160#0#6'Height'#2#29#3'Top'#2'0'
+#5'Width'#2'"'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0
+#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0
,#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'
+#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'
+#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255
+'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'
+#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195
+'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144
+#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255
+'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255
+#255#0'h'#199't'#201''#204#138#255#162#216#171#255#158#214#167#255#154#212
+#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133
+#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255
+#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135
+#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'
+#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyp'
+'hs'#2#0#7'OnClick'#7#12'Var1OutClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'Var2'
+'In'#4'Left'#3#160#0#6'Height'#2#29#3'Top'#2'p'#5'Width'#2'"'#10'Glyph.Data'
+#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0
+#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^'
+' '#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177
+'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255
+'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255
+#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255
+#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142
+#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'
+#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162
+#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255
+#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130
+#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199
+'t'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255
+'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'
+#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'Var2InClick'#8
+'TabOrder'#2#3#0#0#7'TBitBtn'#7'Var2Out'#4'Left'#3#160#0#6'Height'#2#29#3'To'
+'p'#3#144#0#5'Width'#2'"'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0
+#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'
+#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'
+#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161
+'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131
+#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/'
+'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'
+#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255
+#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132
+#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255
+#255#255#0'h'#199't'#201''#204#138#255#162#216#171#255#158#214#167#255#154
,#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255
+#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201
+#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num'
+'Glyphs'#2#0#7'OnClick'#7#12'Var2OutClick'#8'TabOrder'#2#4#0#0#5'TEdit'#8'Va'
+'r1Edit'#4'Left'#3#201#0#6'Height'#2#20#3'Top'#2#31#5'Width'#2'}'#8'TabOrder'
+#2#5#4'Text'#6#8'Var1Edit'#0#0#5'TEdit'#8'Var2Edit'#4'Left'#3#201#0#6'Height'
+#2#20#3'Top'#3#128#0#5'Width'#2'}'#8'TabOrder'#2#6#4'Text'#6#5'Edit1'#0#0#7
+'TButton'#8'ResetBtn'#4'Left'#3#159#0#6'Height'#2#30#3'Top'#3#185#0#5'Width'
+#2'N'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#7#0
+#0#7'TButton'#9'CancelBtn'#4'Left'#3#248#0#6'Height'#2#30#3'Top'#3#184#0#5'W'
+'idth'#2'N'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#8#0#0#7
+'TButton'#10'ComputeBtn'#4'Left'#3#160#0#6'Height'#2#30#3'Top'#3#248#0#5'Wid'
+'th'#2'N'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrde'
+'r'#2#9#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#248#0#6'Height'#2#30#3'Top'#3
+#248#0#5'Width'#2'N'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2
+#10#0#0#0
]);

View File

@ -0,0 +1,230 @@
unit SignTestUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, OutPutUnit, FunctionsLib,
Globals, DataProcs, Math;
type
{ TSignTestFrm }
TSignTestFrm = class(TForm)
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
Var1In: TBitBtn;
Var1Out: TBitBtn;
Var2In: TBitBtn;
Var2Out: TBitBtn;
Var1Edit: TEdit;
Var2Edit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure Var1InClick(Sender: TObject);
procedure Var1OutClick(Sender: TObject);
procedure Var2InClick(Sender: TObject);
procedure Var2OutClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SignTestFrm: TSignTestFrm;
implementation
{ TSignTestFrm }
procedure TSignTestFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
Var1Edit.Text := '';
Var2Edit.Text := '';
Var1In.Visible := true;
Var1Out.Visible := false;
Var2In.Visible := true;
Var2Out.Visible := false;
VarList.Items.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSignTestFrm.Var1InClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
Var1Edit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
Var1In.Visible := false;
Var1Out.Visible := true;
end;
procedure TSignTestFrm.Var1OutClick(Sender: TObject);
begin
VarList.Items.Add(Var1Edit.Text);
Var1Edit.Text := '';
Var1In.Visible := true;
Var1Out.Visible := false;
end;
procedure TSignTestFrm.Var2InClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
Var2Edit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
Var2In.Visible := false;
Var2Out.Visible := true;
end;
procedure TSignTestFrm.Var2OutClick(Sender: TObject);
begin
VarList.Items.Add(Var2Edit.Text);
Var2Edit.Text := '';
Var2In.Visible := true;
Var2Out.Visible := false;
end;
procedure TSignTestFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSignTestFrm.ComputeBtnClick(Sender: TObject);
var
i, k, col1, col2, X, N, A, b, Temp : integer;
ColNoSelected : IntDyneVec;
DifSigns : IntDyneVec;
p, Q, Probability, z, NoDiff, CorrectedA, x1, x2 : double;
SumProb : double;
cellstring, outline : string;
begin
SumProb := 0.0;
SetLength(DifSigns,NoCases);
SetLength(ColNoSelected,NoVariables);
k := 2;
// Get column numbers and labels of variables selected
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = Var1Edit.Text then ColNoSelected[0] := i;
if cellstring = Var2Edit.Text then ColNoSelected[1] := i;
end;
p := 0.5;
Q := 0.5;
// Get sign of difference between pairs '(-1 := - ; 0 := no difference; +1 := +
A := 0;
b := 0;
NoDiff := 0.0;
for i := 1 to NoCases do
begin
if (not GoodRecord(i,k,ColNoSelected)) then continue;
col1 := ColNoSelected[0];
col2 := ColNoSelected[1];
x1 := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col1,i]));
x2 := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col2,i]));
if (x1 > x2) then
begin
DifSigns[i-1] := 1;
A := A + 1;
end;
if (x1 < x2) then
begin
DifSigns[i-1] := -1;
b := b + 1;
end;
if (x1 = x2) then
begin
DifSigns[i-1] := 0;
NoDiff := NoDiff + 1.0;
end;
end;
// Show results
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Results for the Sign Test');
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Frequency of %3d out of %d observed + sign differences.',
[A, NoCases]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Frequency of %3d out of %d observed - sign differences.',
[b, NoCases]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Frequency of %3.0f out of %d observed no differences.',
[NoDiff, NoCases]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'The theoretical proportion expected for +''s or -''s is 0.5 ';
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'The test is for the probability of the +''s or -''s (which ever is fewer)';
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'as small or smaller than that observed given the expected proportion.';
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
// Swap A and B around if A > B
if (A > b) then
begin
Temp := A;
A := b;
b := Temp;
end;
N := A + b;
if (N > 25) then // Use normal distribution approximation
begin
CorrectedA := A;
if (A < (N * p)) then CorrectedA := A + 0.5;
if (A > (N * p)) then CorrectedA := A - 0.5;
z := (CorrectedA - N * p) / sqrt(N * p * Q);
outline := format('Z value for Normal Distribution approximation = %5.3f',
[z]);
OutPutFrm.RichEdit.Lines.Add(outline);
Probability := probz(z);
outline := format('Probability = %6.4f',[Probability]);
OutPutFrm.RichEdit.Lines.Add(outline);
end
else // Use binomial fomula
begin
X := 0;
while X <= A do
begin
Probability := combos(X, N) * Power(p,X) * Power(Q,(N - X));
outline := format('Binary Probability of %3d = %6.4f',[X, Probability]);
OutPutFrm.RichEdit.Lines.Add(outline);
SumProb := SumProb + Probability;
X := X + 1;
end;
outline := format('Binomial Probability of %5d or smaller out of %5d = %6.4f',
[A, N, SumProb]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
// Clean up heap
DifSigns := nil;
ColNoSelected := nil;
end;
initialization
{$I signtestunit.lrs}
end.

View File

@ -0,0 +1,167 @@
object SimpleChiSqrForm: TSimpleChiSqrForm
Left = 280
Height = 464
Top = 161
Width = 442
Caption = 'Simple ChiSquare for Categories'
ClientHeight = 464
ClientWidth = 442
OnShow = ResetBtnClick
LCLVersion = '0.9.30.4'
object Memo1: TMemo
Left = 9
Height = 55
Top = 1
Width = 423
Lines.Strings = (
'This procedure lets you enter the number of observed values and the number'
'of expected values for one or more categories. Enter the values as indicated '
'and when finished, press the compute button.'
)
TabOrder = 0
end
object Label1: TLabel
Left = 9
Height = 16
Top = 72
Width = 167
Caption = 'Enter the number of categories:'
ParentColor = False
end
object NcatsEdit: TEdit
Left = 177
Height = 23
Top = 64
Width = 58
OnClick = NcatsEditExit
OnExit = NcatsEditExit
TabOrder = 1
Text = '1'
end
object Label2: TLabel
Left = 9
Height = 16
Top = 98
Width = 80
Caption = 'Freq. Observed'
ParentColor = False
end
object Label3: TLabel
Left = 115
Height = 16
Top = 98
Width = 80
Caption = 'Freq. Expected:'
ParentColor = False
end
object Label4: TLabel
Left = 214
Height = 16
Top = 98
Width = 95
Caption = 'Computed Values'
ParentColor = False
end
object ObservedGrid: TStringGrid
Left = 10
Height = 260
Top = 121
Width = 68
AutoFillColumns = True
ColCount = 1
FixedCols = 0
FixedRows = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
RowCount = 2
TabOrder = 2
end
object ExpectedGrid: TStringGrid
Left = 113
Height = 259
Top = 121
Width = 71
ColCount = 1
FixedCols = 0
FixedRows = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
RowCount = 2
TabOrder = 3
end
object ChiSqrGrid: TStringGrid
Left = 217
Height = 258
Top = 121
Width = 75
ColCount = 1
FixedCols = 0
FixedRows = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
RowCount = 2
TabOrder = 4
end
object ComputeBtn: TButton
Left = 337
Height = 34
Top = 121
Width = 84
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object ResetBtn: TButton
Left = 337
Height = 34
Top = 176
Width = 84
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object ReturnBtn: TButton
Left = 337
Height = 34
Top = 232
Width = 84
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
object Label5: TLabel
Left = 7
Height = 16
Top = 411
Width = 99
Caption = 'Total ChiSquare = '
ParentColor = False
end
object TotChiSqrEdit: TEdit
Left = 106
Height = 23
Top = 405
Width = 97
TabOrder = 8
end
object Label6: TLabel
Left = 216
Height = 16
Top = 408
Width = 51
Caption = 'Prob. > ='
ParentColor = False
end
object ProbEdit: TEdit
Left = 274
Height = 23
Top = 402
Width = 113
TabOrder = 9
end
object Label7: TLabel
Left = 248
Height = 16
Top = 74
Width = 160
Caption = 'Click the mouse after entering'
ParentColor = False
end
end

View File

@ -0,0 +1,50 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSimpleChiSqrForm','FORMDATA',[
'TPF0'#17'TSimpleChiSqrForm'#16'SimpleChiSqrForm'#4'Left'#3#24#1#6'Height'#3
+#208#1#3'Top'#3#161#0#5'Width'#3#186#1#7'Caption'#6#31'Simple ChiSquare for '
+'Categories'#12'ClientHeight'#3#208#1#11'ClientWidth'#3#186#1#6'OnShow'#7#13
+'ResetBtnClick'#10'LCLVersion'#6#8'0.9.30.4'#0#5'TMemo'#5'Memo1'#4'Left'#2#9
+#6'Height'#2'7'#3'Top'#2#1#5'Width'#3#167#1#13'Lines.Strings'#1#6'JThis proc'
+'edure lets you enter the number of observed values and the number'#6'Nof ex'
+'pected values for one or more categories. Enter the values as indicated '#6
+',and when finished, press the compute button.'#0#8'TabOrder'#2#0#0#0#6'TLab'
+'el'#6'Label1'#4'Left'#2#9#6'Height'#2#16#3'Top'#2'H'#5'Width'#3#167#0#7'Cap'
+'tion'#6#31'Enter the number of categories:'#11'ParentColor'#8#0#0#5'TEdit'#9
+'NcatsEdit'#4'Left'#3#177#0#6'Height'#2#23#3'Top'#2'@'#5'Width'#2':'#7'OnCli'
+'ck'#7#13'NcatsEditExit'#6'OnExit'#7#13'NcatsEditExit'#8'TabOrder'#2#1#4'Tex'
+'t'#6#1'1'#0#0#6'TLabel'#6'Label2'#4'Left'#2#9#6'Height'#2#16#3'Top'#2'b'#5
+'Width'#2'P'#7'Caption'#6#14'Freq. Observed'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label3'#4'Left'#2's'#6'Height'#2#16#3'Top'#2'b'#5'Width'#2'P'#7'Caption'#6
+#15'Freq. Expected:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#214
+#0#6'Height'#2#16#3'Top'#2'b'#5'Width'#2'_'#7'Caption'#6#15'Computed Values'
+#11'ParentColor'#8#0#0#11'TStringGrid'#12'ObservedGrid'#4'Left'#2#10#6'Heigh'
+'t'#3#4#1#3'Top'#2'y'#5'Width'#2'D'#15'AutoFillColumns'#9#8'ColCount'#2#1#9
+'FixedCols'#2#0#9'FixedRows'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixe'
+'dHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#9'goEditing'#18
+'goAlwaysShowEditor'#14'goSmoothScroll'#0#8'RowCount'#2#2#8'TabOrder'#2#2#0#0
+#11'TStringGrid'#12'ExpectedGrid'#4'Left'#2'q'#6'Height'#3#3#1#3'Top'#2'y'#5
+'Width'#2'G'#8'ColCount'#2#1#9'FixedCols'#2#0#9'FixedRows'#2#0#7'Options'#11
+#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'go'
+'RangeSelect'#9'goEditing'#18'goAlwaysShowEditor'#14'goSmoothScroll'#0#8'Row'
+'Count'#2#2#8'TabOrder'#2#3#0#0#11'TStringGrid'#10'ChiSqrGrid'#4'Left'#3#217
+#0#6'Height'#3#2#1#3'Top'#2'y'#5'Width'#2'K'#8'ColCount'#2#1#9'FixedCols'#2#0
+#9'FixedRows'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'g'
+'oVertLine'#10'goHorzLine'#13'goRangeSelect'#9'goEditing'#18'goAlwaysShowEdi'
+'tor'#14'goSmoothScroll'#0#8'RowCount'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#10
+'ComputeBtn'#4'Left'#3'Q'#1#6'Height'#2'"'#3'Top'#2'y'#5'Width'#2'T'#7'Capti'
+'on'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#5#0#0#7'TBu'
+'tton'#8'ResetBtn'#4'Left'#3'Q'#1#6'Height'#2'"'#3'Top'#3#176#0#5'Width'#2'T'
+#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#6#0#0#7
+'TButton'#9'ReturnBtn'#4'Left'#3'Q'#1#6'Height'#2'"'#3'Top'#3#232#0#5'Width'
+#2'T'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#7#0#0#6'TLabe'
+'l'#6'Label5'#4'Left'#2#7#6'Height'#2#16#3'Top'#3#155#1#5'Width'#2'c'#7'Capt'
+'ion'#6#18'Total ChiSquare = '#11'ParentColor'#8#0#0#5'TEdit'#13'TotChiSqrEd'
+'it'#4'Left'#2'j'#6'Height'#2#23#3'Top'#3#149#1#5'Width'#2'a'#8'TabOrder'#2#8
+#0#0#6'TLabel'#6'Label6'#4'Left'#3#216#0#6'Height'#2#16#3'Top'#3#152#1#5'Wid'
+'th'#2'3'#7'Caption'#6#9'Prob. > ='#11'ParentColor'#8#0#0#5'TEdit'#8'ProbEdi'
+'t'#4'Left'#3#18#1#6'Height'#2#23#3'Top'#3#146#1#5'Width'#2'q'#8'TabOrder'#2
+#9#0#0#6'TLabel'#6'Label7'#4'Left'#3#248#0#6'Height'#2#16#3'Top'#2'J'#5'Widt'
+'h'#3#160#0#7'Caption'#6#30'Click the mouse after entering'#11'ParentColor'#8
+#0#0#0
]);

View File

@ -0,0 +1,115 @@
unit SimpleChiSqrUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Grids, MainUnit, Globals, FunctionsLib, OutPutUnit, DataProcs;
type
{ TSimpleChiSqrForm }
TSimpleChiSqrForm = class(TForm)
ComputeBtn: TButton;
Label7: TLabel;
ProbEdit: TEdit;
Label6: TLabel;
TotChiSqrEdit: TEdit;
Label5: TLabel;
ResetBtn: TButton;
ReturnBtn: TButton;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
NcatsEdit: TEdit;
Label1: TLabel;
Memo1: TMemo;
ObservedGrid: TStringGrid;
ExpectedGrid: TStringGrid;
ChiSqrGrid: TStringGrid;
procedure ComputeBtnClick(Sender: TObject);
procedure NcatsEditExit(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
NoCats : integer;
public
{ public declarations }
end;
var
SimpleChiSqrForm: TSimpleChiSqrForm;
implementation
{ TSimpleChiSqrForm }
procedure TSimpleChiSqrForm.NcatsEditExit(Sender: TObject);
begin
NoCats := StrToInt(NcatsEdit.Text);
ObservedGrid.RowCount := NoCats+1;
ExpectedGrid.RowCount := NoCats+1;
ChiSqrGrid.RowCount := NoCats+1;
end;
procedure TSimpleChiSqrForm.ComputeBtnClick(Sender: TObject);
var
TotalChiSqr : double;
ChiSqr, Obs, Exp, ChiProb, NObs, NExp : double;
i : integer;
outline : string;
begin
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Simple Chi-Square Analysis Results');
OutPutFrm.RichEdit.Lines.Add('Category ChiSquare');
TotalChiSqr := 0.0;
NObs := 0.0;
NExp := 0.0;
for i := 1 to NoCats do
begin
Obs := StrToFloat(ObservedGrid.Cells[0,i]);
NObs := NObs + 1;
Exp := StrToFloat(ExpectedGrid.Cells[0,i]);
NExp := NExp + 1;
chisqr := sqr(Obs - Exp) / Exp;
outline := format('%8.3f',[chisqr]);
ChiSqrGrid.Cells[0,i] := outline;
TotalChiSqr := TotalChiSqr + chisqr;
outline := format(' %2d %8.3f',[i,chisqr]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
TotChiSqrEdit.Text := FloatToStr(TotalChiSqr);
ChiProb := 1.0 - ChiSquaredProb(TotalChiSqr,NoCats);
ProbEdit.Text := FloatToStr(ChiProb);
outline := format('Number Observed = %8.3f',[NObs]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Number Expected = %8.3f',[NExp]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('ChiSquare = %8.3f with Probability of a larger value = %8.3f',
[TotalChiSqr,ChiProb]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
end;
procedure TSimpleChiSqrForm.ResetBtnClick(Sender: TObject);
begin
NoCats := 1;
ObservedGrid.RowCount := NoCats + 1;
ExpectedGrid.RowCount := NoCats + 1;
ChiSqrGrid.RowCount := NoCats + 1;
NCatsEdit.Text := '1';
ObservedGrid.Cells[0,0] := 'Observed';
ExpectedGrid.Cells[0,0] := 'Expected';
ChiSqrGrid.Cells[0,0] := 'ChiSquared';
end;
initialization
{$I simplechisqrunit.lrs}
end.

View File

@ -0,0 +1,267 @@
object SimultFrm: TSimultFrm
Left = 161
Height = 470
Top = 96
Width = 394
Caption = 'Simultaneous Multiple Regression'
ClientHeight = 470
ClientWidth = 394
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 5
Width = 90
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
Left = 215
Height = 14
Top = 9
Width = 119
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object VarList: TListBox
Left = 6
Height = 213
Top = 22
Width = 161
TabOrder = 0
end
object InBtn: TBitBtn
Left = 176
Height = 32
Top = 24
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 177
Height = 32
Top = 64
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object AllBtn: TBitBtn
Left = 177
Height = 32
Top = 112
Width = 32
Caption = 'ALL'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 3
end
object ListBox1: TListBox
Left = 216
Height = 212
Top = 24
Width = 168
TabOrder = 4
end
object GroupBox1: TGroupBox
Left = 6
Height = 217
Top = 239
Width = 212
Caption = 'Options'
ClientHeight = 199
ClientWidth = 208
TabOrder = 5
object MatInChkBox: TCheckBox
Left = 8
Height = 17
Top = 1
Width = 148
Caption = 'Get Data From a Matrix File'
TabOrder = 0
end
object MatSaveChkBox: TCheckBox
Left = 8
Height = 17
Top = 23
Width = 129
Caption = 'Save Correlation Matrix'
TabOrder = 1
end
object CPChkBox: TCheckBox
Left = 8
Height = 17
Top = 45
Width = 152
Caption = 'Show Cross-Products Matrix'
TabOrder = 2
end
object CovChkBox: TCheckBox
Left = 8
Height = 17
Top = 66
Width = 180
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 3
end
object CorrsChkBox: TCheckBox
Left = 8
Height = 17
Top = 91
Width = 156
Caption = 'Show Intercorrelations Matrix'
TabOrder = 4
end
object MeansChkBox: TCheckBox
Left = 8
Height = 17
Top = 112
Width = 82
Caption = 'Show Means'
TabOrder = 5
end
object VarChkBox: TCheckBox
Left = 8
Height = 17
Top = 133
Width = 97
Caption = 'Show Variances'
TabOrder = 6
end
object SDChkBox: TCheckBox
Left = 8
Height = 17
Top = 156
Width = 146
Caption = 'Show Standard Deviations'
TabOrder = 7
end
object InvMatChkBox: TCheckBox
Left = 8
Height = 17
Top = 179
Width = 116
Caption = 'Show Inverse Matrix'
TabOrder = 8
end
end
object ResetBtn: TButton
Left = 264
Height = 27
Top = 248
Width = 66
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object CancelBtn: TButton
Left = 264
Height = 27
Top = 304
Width = 66
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object ComputeBtn: TButton
Left = 264
Height = 27
Top = 368
Width = 66
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 8
end
object ReturnBtn: TButton
Left = 264
Height = 27
Top = 424
Width = 66
Caption = 'Return'
ModalResult = 1
TabOrder = 9
end
object OpenDialog1: TOpenDialog
left = 224
top = 249
end
object SaveDialog1: TSaveDialog
left = 225
top = 296
end
end

View File

@ -0,0 +1,148 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSimultFrm','FORMDATA',[
'TPF0'#10'TSimultFrm'#9'SimultFrm'#4'Left'#3#161#0#6'Height'#3#214#1#3'Top'#2
+'`'#5'Width'#3#138#1#7'Caption'#6' Simultaneous Multiple Regression'#12'Clie'
+'ntHeight'#3#214#1#11'ClientWidth'#3#138#1#6'OnShow'#7#8'FormShow'#10'LCLVer'
+'sion'#6#8'0.9.26.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'
+#2#5#5'Width'#2'Z'#7'Caption'#6#19'Available Variables'#11'ParentColor'#8#0#0
+#6'TLabel'#6'Label2'#4'Left'#3#215#0#6'Height'#2#14#3'Top'#2#9#5'Width'#2'w'
+#7'Caption'#6#24'Variables to be Analyzed'#11'ParentColor'#8#0#0#8'TListBox'
+#7'VarList'#4'Left'#2#6#6'Height'#3#213#0#3'Top'#2#22#5'Width'#3#161#0#8'Tab'
+'Order'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#176#0#6'Height'#2' '#3'Top'#2
+#24#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0
+#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0
+#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%'
+'i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'
+#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'
+#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255
+#160#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152
+#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193
+#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'
+#199't'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255
+#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139
+#255#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255
+#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'
+#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'
+#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'
+#247';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'
+#187'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7
+'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#1#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3
+#177#0#6'Height'#2' '#3'Top'#2'@'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'
+#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0
+#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207
+'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'
+#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255
+#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'
+#255#255#255#255#0#255#255#255#0'h'#199't'#201''#204#138#255#162#216#171#255
+#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149
+#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'
+#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205
+#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'
+#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'
+#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'
+#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199
+'t'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'OutBtnClick'#8'TabOrder'#2#2#0#0
+#7'TBitBtn'#6'AllBtn'#4'Left'#3#177#0#6'Height'#2' '#3'Top'#2'p'#5'Width'#2
+' '#7'Caption'#6#3'ALL'#9'NumGlyphs'#2#0#7'OnClick'#7#11'AllBtnClick'#8'TabO'
+'rder'#2#3#0#0#8'TListBox'#8'ListBox1'#4'Left'#3#216#0#6'Height'#3#212#0#3'T'
+'op'#2#24#5'Width'#3#168#0#8'TabOrder'#2#4#0#0#9'TGroupBox'#9'GroupBox1'#4'L'
+'eft'#2#6#6'Height'#3#217#0#3'Top'#3#239#0#5'Width'#3#212#0#7'Caption'#6#7'O'
+'ptions'#12'ClientHeight'#3#199#0#11'ClientWidth'#3#208#0#8'TabOrder'#2#5#0#9
+'TCheckBox'#11'MatInChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#1#5'Width'#3
+#148#0#7'Caption'#6#27'Get Data From a Matrix File'#8'TabOrder'#2#0#0#0#9'TC'
+'heckBox'#13'MatSaveChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#23#5'Width'#3
+#129#0#7'Caption'#6#23'Save Correlation Matrix'#8'TabOrder'#2#1#0#0#9'TCheck'
+'Box'#8'CPChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'-'#5'Width'#3#152#0#7
+'Caption'#6#26'Show Cross-Products Matrix'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9
+'CovChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'B'#5'Width'#3#180#0#7'Captio'
+'n'#6#31'Show Variance-Covariance Matrix'#8'TabOrder'#2#3#0#0#9'TCheckBox'#11
+'CorrsChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'['#5'Width'#3#156#0#7'Capt'
+'ion'#6#29'Show Intercorrelations Matrix'#8'TabOrder'#2#4#0#0#9'TCheckBox'#11
+'MeansChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'p'#5'Width'#2'R'#7'Caption'
,#6#10'Show Means'#8'TabOrder'#2#5#0#0#9'TCheckBox'#9'VarChkBox'#4'Left'#2#8#6
+'Height'#2#17#3'Top'#3#133#0#5'Width'#2'a'#7'Caption'#6#14'Show Variances'#8
+'TabOrder'#2#6#0#0#9'TCheckBox'#8'SDChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'
+#3#156#0#5'Width'#3#146#0#7'Caption'#6#24'Show Standard Deviations'#8'TabOrd'
+'er'#2#7#0#0#9'TCheckBox'#12'InvMatChkBox'#4'Left'#2#8#6'Height'#2#17#3'Top'
+#3#179#0#5'Width'#2't'#7'Caption'#6#19'Show Inverse Matrix'#8'TabOrder'#2#8#0
+#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#8#1#6'Height'#2#27#3'Top'#3#248#0#5'Wi'
+'dth'#2'B'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2
+#6#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#8#1#6'Height'#2#27#3'Top'#3'0'#1#5
+'Width'#2'B'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#7#0#0#7
+'TButton'#10'ComputeBtn'#4'Left'#3#8#1#6'Height'#2#27#3'Top'#3'p'#1#5'Width'
+#2'B'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2
+#8#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#8#1#6'Height'#2#27#3'Top'#3#168#1#5
+'Width'#2'B'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#9#0#0
+#11'TOpenDialog'#11'OpenDialog1'#4'left'#3#224#0#3'top'#3#249#0#0#0#11'TSave'
+'Dialog'#11'SaveDialog1'#4'left'#3#225#0#3'top'#3'('#1#0#0#0
]);

View File

@ -0,0 +1,360 @@
unit SimultRegUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, Globals, MainUnit, MatrixLib, OutPutUnit,
FunctionsLib, DataProcs;
type
{ TSimultFrm }
TSimultFrm = class(TForm)
OpenDialog1: TOpenDialog;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
MatInChkBox: TCheckBox;
MatSaveChkBox: TCheckBox;
CPChkBox: TCheckBox;
CovChkBox: TCheckBox;
CorrsChkBox: TCheckBox;
MeansChkBox: TCheckBox;
SaveDialog1: TSaveDialog;
VarChkBox: TCheckBox;
SDChkBox: TCheckBox;
InvMatChkBox: TCheckBox;
GroupBox1: TGroupBox;
InBtn: TBitBtn;
OutBtn: TBitBtn;
AllBtn: TBitBtn;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
VarList: TListBox;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SimultFrm: TSimultFrm;
implementation
{ TSimultFrm }
procedure TSimultFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
ListBox1.Clear;
for i := 1 to NoVariables do
begin
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
InBtn.Enabled := true;
OutBtn.Enabled := false;
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
end;
procedure TSimultFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TSimultFrm.AllBtnClick(Sender: TObject);
VAR count, index : integer;
begin
count := VarList.Items.Count;
for index := 0 to count-1 do
begin
ListBox1.Items.Add(VarList.Items.Strings[index]);
end;
VarList.Clear;
end;
procedure TSimultFrm.ComputeBtnClick(Sender: TObject);
Label CleanUp;
VAR
NoVars, i, j, NCases, errcode, mattype : integer;
StdErr, df1, df2, x, determinant : double;
errorcode : boolean;
filename : string;
cellstring, outline, valstring : string;
Corrs : DblDyneMat;
Means : DblDyneVec;
Variances : DblDyneVec;
StdDevs : DblDyneVec;
ColNoSelected : IntDyneVec;
title : string;
RowLabels : StrDyneVec;
ColLabels : StrDyneVec;
InverseMat : DblDyneMat;
R2s : DblDyneVec;
W : DblDyneVec;
ProdMat : DblDyneMat;
FProbs : DblDyneVec;
CorrMat : DblDyneMat;
begin
SetLength(Corrs,NoVariables+1,NoVariables+1);
SetLength(Means,NoVariables);
SetLength(Variances,NoVariables);
SetLength(StdDevs,NoVariables);
SetLength(RowLabels,NoVariables);
SetLength(ColLabels,NoVariables);
SetLength(InverseMat,NoVariables,NoVariables);
SetLength(R2s,NoVariables);
SetLength(W,NoVariables);
SetLength(ProdMat,NoVariables+1,NoVariables+1);
SetLength(Fprobs,NoVariables);
SetLength(CorrMat,NoVariables+1,NoVariables+1);
SetLength(ColNoSelected,NoVariables);
OutPutFrm.RichEdit.Clear;
// OutPutFrm.RichEdit.ParaGraph.Alignment := taLeftJustify;
OutPutFrm.RichEdit.Lines.Add('Simultaneous Multiple Regression by Bill Miller');
errcode := 0;
if MatInChkBox.Checked = true then
begin
OpenDialog1.Filter := 'FreeStat matrix files (*.MAT)|*.MAT|All files (*.*)|*.*';
OpenDialog1.FilterIndex := 1;
if OpenDialog1.Execute then
begin
filename := OpenDialog1.FileName;
MATREAD(Corrs,NoVars,NoVars,Means,StdDevs,NCases,RowLabels,ColLabels,filename);
for i := 1 to NoVars do Variances[i-1] := sqr(StdDevs[i-1]);
ShowMessage('NOTICE! Last variable in matrix is the dependent variable');
end;
end;
if MatInChkBox.Checked = false then
begin
{ get variable columns }
NoVars := ListBox1.Items.Count;
if NoVars < 1 then
begin
ShowMessage('ERROR! No variables selected.');
goto CleanUp;
end;
for i := 1 to NoVars do
begin
cellstring := ListBox1.Items.Strings[i-1];
for j := 1 to NoVariables do
begin
if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then
begin
ColNoSelected[i-1] := j;
RowLabels[i-1] := cellstring;
ColLabels[i-1] := cellstring;
end;
end;
end;
end;
if CPChkBox.Checked = true then
begin
title := 'Cross-Products Matrix';
GridXProd(NoVars,ColNoSelected,Corrs,errorcode,NCases);
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
if CovChkBox.Checked = true then
begin
title := 'Variance-Covariance Matrix';
GridCovar(NoVars,ColNoSelected,Corrs,Means,Variances,
StdDevs,errorcode,NCases);
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
Correlations(NoVars,ColNoSelected,Corrs,Means,Variances,
StdDevs,errorcode,NCases);
if CorrsChkBox.Checked = true then
for i := 1 to NoVars do
for j := 1 to NoVars do InverseMat[i-1,j-1] := Corrs[i-1,j-1];
begin
title := 'Product-Moment Correlations Matrix';
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
if MatSaveChkBox.Checked = true then
begin
SaveDialog1.Filter := 'OpenStat matrix files (*.MAT)|*.MAT|All files (*.*)|*.*';
SaveDialog1.FilterIndex := 1;
if SaveDialog1.Execute then
begin
filename := SaveDialog1.FileName;
MATSAVE(Corrs,NoVars,NoVars,Means,StdDevs,NCases,RowLabels,ColLabels,filename);
end;
end;
title := 'Means';
if MeansChkBox.Checked = true then
DynVectorPrint(Means,NoVars,title,ColLabels,NCases);
title := 'Variances';
if VarChkBox.Checked = true then
DynVectorPrint(Variances,NoVars,title,ColLabels,NCases);
title := 'Standard Deviations';
if SDChkBox.Checked = true then
DynVectorPrint(StdDevs,NoVars,title,ColLabels,NCases);
if errcode > 0 then
begin
OutPutFrm.RichEdit.Lines.Add('One or more correlations could not be computed due to zero variance of a variable.');
end;
if errcode > 0 then
begin
ShowMessage('ERROR! A selected variable has no variability-run aborted.');
goto CleanUp;
end;
determinant := 0.0;
for i := 1 to NoVars do
for j := 1 to NoVars do
CorrMat[i-1,j-1] := Corrs[i-1,j-1];
Determ(CorrMat,NoVars,NoVars,determinant,errorcode);
if (determinant < 0.000001) then
begin
ShowMessage('ERROR! Matrix is singular!');
goto cleanup;
end;
outline := format('Determinant of correlation matrix = %8.4f',[determinant]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
SVDinverse(InverseMat,NoVars);
title := 'Inverse of correlation matrix';
if (InvMatChkBox.Checked = true) then
MAT_PRINT(InverseMat,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
OutPutFrm.RichEdit.Lines.Add('Multiple Correlation Coefficients for Each Variable');
OutPutFrm.RichEdit.Lines.Add('');
outline := format('%10s%8s%10s%10s%12s%5s%5s',['Variable','R','R2','F','Prob.>F','DF1','DF2']);
OutPutFrm.RichEdit.Lines.Add(outline);
df1 := NoVars - 1.0;
df2 := NCases - NoVars;
for i := 1 to NoVars do
begin // R squared values
R2s[i-1] := 1.0 - (1.0 / InverseMat[i-1,i-1]);
W[i-1] := (R2s[i-1] / df1) / ((1.0-R2s[i-1]) / df2);
FProbs[i-1] := probf(W[i-1],df1,df2);
valstring := format('%10s',[ColLabels[i-1]]);
outline := format('%10s%10.3f%10.3f%10.3f%10.3f%5.0f%5.0f',
[valstring,sqrt(R2s[i-1]),R2s[i-1],W[i-1],FProbs[i-1],df1,df2]);
OutPutFrm.RichEdit.Lines.Add(outline);
for j := 1 to NoVars do
begin // betas
ProdMat[i-1,j-1] := -InverseMat[i-1,j-1] / InverseMat[j-1,j-1];
end;
end;
title := 'Betas in Columns';
MAT_PRINT(ProdMat,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
OutPutFrm.RichEdit.Lines.Add('Standard Errors of Prediction');
OutPutFrm.RichEdit.Lines.Add('Variable Std.Error');
for i := 1 to NoVars do
begin
StdErr := (NCases-1) * Variances[i-1] * (1.0 / InverseMat[i-1,i-1]);
StdErr := sqrt(StdErr / (NCases - NoVars));
valstring := format('%10s',[ColLabels[i-1]]);
outline := format('%10s%10.3f',[valstring,StdErr]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
for i := 1 to NoVars do
for j := 1 to NoVars do
if (i <> j) then ProdMat[i-1,j-1] := ProdMat[i-1,j-1] * (StdDevs[j-1]/StdDevs[i-1]);
title := 'Raw Regression Coefficients';
MAT_PRINT(ProdMat,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
OutPutFrm.RichEdit.Lines.Add('Variable Constant');
for i := 1 to NoVars do
begin
x := 0.0;
for j := 1 to NoVars do
begin
if (i <> j) then x := x + (ProdMat[j-1,i-1] * Means[j-1]);
end;
x := Means[i-1] - x;
valstring := format('%10s',[ColLabels[i-1]]);
outline := format('%10s%10.3f',[valstring,x]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
// Get partial correlation matrix
for i := 1 to NoVars do
begin
for j := 1 to NoVars do
begin
ProdMat[i-1,j-1] := -(1.0 / sqrt(InverseMat[i-1,i-1])) *
InverseMat[i-1,j-1] * (1.0 / sqrt(InverseMat[j-1,j-1]));
end;
end;
title := 'Partial Correlations';
MAT_PRINT(ProdMat,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
OutPutFrm.ShowModal;
CleanUp:
ColNoSelected := nil;
CorrMat := nil;
Fprobs := nil;
ProdMat := nil;
W := nil;
R2s := nil;
InverseMat := nil;
ColLabels := nil;
RowLabels := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
corrs := nil;
end;
procedure TSimultFrm.InBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
ListBox1.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
OutBtn.Enabled := true;
end;
procedure TSimultFrm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ListBox1.ItemIndex;
VarList.Items.Add(ListBox1.Items.Strings[index]);
ListBox1.Items.Delete(index);
InBtn.Enabled := true;
end;
initialization
{$I simultregunit.lrs}
end.

View File

@ -0,0 +1,217 @@
object SingleLinkFrm: TSingleLinkFrm
Left = 192
Height = 354
Top = 103
Width = 443
Caption = 'Single Linkage Cluster Analysis'
ClientHeight = 354
ClientWidth = 443
OnShow = FormShow
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 7
Height = 16
Top = 7
Width = 99
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
Left = 272
Height = 16
Top = 24
Width = 154
Caption = 'Variable Selected for Analysis'
ParentColor = False
end
object ListBox1: TListBox
Left = 6
Height = 269
Top = 25
Width = 201
ItemHeight = 0
TabOrder = 0
end
object VarInBtn: TBitBtn
Left = 217
Height = 34
Top = 24
Width = 41
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarInBtnClick
TabOrder = 1
end
object VarOutBtn: TBitBtn
Left = 217
Height = 34
Top = 72
Width = 41
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarOutBtnClick
TabOrder = 2
end
object VarSelEdit: TEdit
Left = 270
Height = 23
Top = 48
Width = 159
TabOrder = 3
Text = 'VarSelEdit'
end
object GroupBox1: TGroupBox
Left = 216
Height = 174
Top = 122
Width = 216
Caption = 'Analysis Options:'
ClientHeight = 156
ClientWidth = 212
TabOrder = 4
object StdChkBox: TCheckBox
Left = 7
Height = 19
Top = 7
Width = 126
Caption = 'Standardize Variable'
TabOrder = 0
end
object RepChkBox: TCheckBox
Left = 24
Height = 19
Top = 33
Width = 123
Caption = 'Replace Grid Values'
TabOrder = 1
end
object DescChkBox: TCheckBox
Left = 9
Height = 19
Top = 62
Width = 150
Caption = 'Show Each Combination'
TabOrder = 2
end
object PlotChkBox: TCheckBox
Left = 9
Height = 19
Top = 94
Width = 125
Caption = 'Groups Vs Error Plot'
TabOrder = 3
end
object DendoChk: TCheckBox
Left = 9
Height = 19
Top = 125
Width = 107
Caption = 'Dendogram Plot'
TabOrder = 4
end
end
object ResetBtn: TButton
Left = 8
Height = 34
Top = 305
Width = 77
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object CancelBtn: TButton
Left = 112
Height = 34
Top = 305
Width = 77
Caption = 'Cancel'
ModalResult = 2
TabOrder = 6
end
object ComputeBtn: TButton
Left = 248
Height = 34
Top = 305
Width = 77
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 7
end
object ReturnBtn: TButton
Left = 352
Height = 34
Top = 305
Width = 77
Caption = 'Return'
ModalResult = 1
TabOrder = 8
end
end

View File

@ -0,0 +1,137 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSingleLinkFrm','FORMDATA',[
'TPF0'#14'TSingleLinkFrm'#13'SingleLinkFrm'#4'Left'#3#192#0#6'Height'#3'b'#1#3
+'Top'#2'g'#5'Width'#3#187#1#7'Caption'#6#31'Single Linkage Cluster Analysis'
+#12'ClientHeight'#3'b'#1#11'ClientWidth'#3#187#1#6'OnShow'#7#8'FormShow'#10
+'LCLVersion'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#16#3
+'Top'#2#7#5'Width'#2'c'#7'Caption'#6#19'Available Variables'#11'ParentColor'
+#8#0#0#6'TLabel'#6'Label2'#4'Left'#3#16#1#6'Height'#2#16#3'Top'#2#24#5'Width'
+#3#154#0#7'Caption'#6#30'Variable Selected for Analysis'#11'ParentColor'#8#0
+#0#8'TListBox'#8'ListBox1'#4'Left'#2#6#6'Height'#3#13#1#3'Top'#2#25#5'Width'
+#3#201#0#10'ItemHeight'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#8'VarInBtn'#4'Lef'
+'t'#3#217#0#6'Height'#2'"'#3'Top'#2#24#5'Width'#2')'#10'Glyph.Data'#10':'#4#0
+#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0
+#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'
+#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'
+#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255
+#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'
+#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171
+#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204
+#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'
+#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255
+'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161
+'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#7'OnClick'#7#13'VarInBtnClick'#8'TabOrder'#2#1#0#0#7'TB'
+'itBtn'#9'VarOutBtn'#4'Left'#3#217#0#6'Height'#2'"'#3'Top'#2'H'#5'Width'#2')'
+#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16
+#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#14'VarOutBtnClick'#8
+'TabOrder'#2#2#0#0#5'TEdit'#10'VarSelEdit'#4'Left'#3#14#1#6'Height'#2#23#3'T'
+'op'#2'0'#5'Width'#3#159#0#8'TabOrder'#2#3#4'Text'#6#10'VarSelEdit'#0#0#9'TG'
+'roupBox'#9'GroupBox1'#4'Left'#3#216#0#6'Height'#3#174#0#3'Top'#2'z'#5'Width'
+#3#216#0#7'Caption'#6#17'Analysis Options:'#12'ClientHeight'#3#156#0#11'Clie'
+'ntWidth'#3#212#0#8'TabOrder'#2#4#0#9'TCheckBox'#9'StdChkBox'#4'Left'#2#7#6
+'Height'#2#19#3'Top'#2#7#5'Width'#2'~'#7'Caption'#6#20'Standardize Variable'
+#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'RepChkBox'#4'Left'#2#24#6'Height'#2#19#3
+'Top'#2'!'#5'Width'#2'{'#7'Caption'#6#19'Replace Grid Values'#8'TabOrder'#2#1
+#0#0#9'TCheckBox'#10'DescChkBox'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'>'#5'Wi'
+'dth'#3#150#0#7'Caption'#6#21'Show Each Combination'#8'TabOrder'#2#2#0#0#9'T'
+'CheckBox'#10'PlotChkBox'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'^'#5'Width'#2
+'}'#7'Caption'#6#20'Groups Vs Error Plot'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8
+'DendoChk'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'}'#5'Width'#2'k'#7'Caption'#6
+#14'Dendogram Plot'#8'TabOrder'#2#4#0#0#0#7'TButton'#8'ResetBtn'#4'Left'#2#8
+#6'Height'#2'"'#3'Top'#3'1'#1#5'Width'#2'M'#7'Caption'#6#5'Reset'#7'OnClick'
+#7#13'ResetBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'p'
+#6'Height'#2'"'#3'Top'#3'1'#1#5'Width'#2'M'#7'Caption'#6#6'Cancel'#11'ModalR'
,'esult'#2#2#8'TabOrder'#2#6#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#248#0#6
+'Height'#2'"'#3'Top'#3'1'#1#5'Width'#2'M'#7'Caption'#6#7'Compute'#7'OnClick'
+#7#15'ComputeBtnClick'#8'TabOrder'#2#7#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3
+'`'#1#6'Height'#2'"'#3'Top'#3'1'#1#5'Width'#2'M'#7'Caption'#6#6'Return'#11'M'
+'odalResult'#2#1#8'TabOrder'#2#8#0#0#0
]);

View File

@ -0,0 +1,643 @@
unit SingleLinkUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, functionslib, Globals, dataprocs,
outputunit, strutils;
type
{ TSingleLinkFrm }
TSingleLinkFrm = class(TForm)
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
StdChkBox: TCheckBox;
RepChkBox: TCheckBox;
DescChkBox: TCheckBox;
PlotChkBox: TCheckBox;
DendoChk: TCheckBox;
GroupBox1: TGroupBox;
VarSelEdit: TEdit;
Label2: TLabel;
VarInBtn: TBitBtn;
VarOutBtn: TBitBtn;
Label1: TLabel;
ListBox1: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure VarInBtnClick(Sender: TObject);
procedure VarOutBtnClick(Sender: TObject);
private
{ private declarations }
procedure TreePlot(VAR Clusters : IntDyneMat;
VAR Lst : IntDyneVec;
NoPoints : integer);
procedure scatplot(var x : DblDyneVec;
var y : DblDyneVec;
nocases : integer;
titlestr : string;
x_axis, y_axis : string;
x_min, x_max, y_min, y_max : double;
VAR VarLabels : StrDyneVec);
public
{ public declarations }
end;
var
SingleLinkFrm: TSingleLinkFrm;
implementation
{ TSingleLinkFrm }
procedure TSingleLinkFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
cellstring : string;
begin
ListBox1.Clear;
VarSelEdit.Text := '';
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
ListBox1.Items.Add(cellstring);
end;
RepChkBox.Checked := false;
StdChkBox.Checked := false;
VarOutBtn.Enabled := false;
DescChkBox.Checked := false;
PlotChkBox.Checked := false;
end;
procedure TSingleLinkFrm.VarInBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ListBox1.ItemIndex;
VarSelEdit.Text := ListBox1.Items.Strings[index];
VarOutBtn.Enabled := true;
end;
procedure TSingleLinkFrm.VarOutBtnClick(Sender: TObject);
begin
ListBox1.Items.Add(VarSelEdit.Text);
VarSelEdit.Text := '';
end;
procedure TSingleLinkFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSingleLinkFrm.ComputeBtnClick(Sender: TObject);
VAR
NoInGrp : IntDyneVec; // no. of subjects in a grouping
i, j, NoGroups, ID, ID1, ID2, col, startat, endat : integer;
ColSelected : integer;
NoScores : integer;
varlabel : string;
// outline : array[1..501] of char;
// astring : array[0..5] of char;
outline : string;
astring : string;
Scores : DblDyneVec; // subject scores
Distance : DblDyneMat; // distance between objects
SubjectIDs : IntDyneVec; // subject ids - sorted with Distance
X1, X2 : double; // grid values of two subjects
Groups : IntDyneMat; // subjects in each group
GrpErrors : DblDyneVec;
Smallest, Mean, Variance, StdDev : double;
clusters : IntDyneMat;
Lst : IntDyneVec;
result : integer;
done : boolean;
average : double;
XAxis, YAxis : DblDyneVec;
MaxError : double;
GrpLabels : StrDyneVec;
ptr : Pointer;
label labels1, labels2;
begin
NoScores := NoCases;
Mean := 0.0;
Variance := 0.0;
varlabel := VarSelEdit.Text;
//Get selected variable
ColSelected := 0;
for j := 1 to NoVariables do
if (VarSelEdit.Text = OS3MainFrm.DataGrid.Cells[j,0]) then ColSelected := j;
if (ColSelected = 0) then
begin
ShowMessage('ERROR! No variable selected to analyze.');
exit;
end;
// Allocate memory
SetLength(Distance,NoCases+1,NoCases+1);
SetLength(SubjectIDs,NoCases+1);
SetLength(NoInGrp,NoCases+1);
SetLength(Groups,NoCases+1,NoCases+1);
SetLength(Scores,NoCases+1);
SetLength(GrpErrors,NoCases+1);
SetLength(clusters,NoCases+1,3);
SetLength(Lst,NoCases+1);
// initialize arrays
for i := 0 to NoCases-1 do
begin
NoInGrp[i] := 1;
SubjectIDs[i] := i+1;
for j := 0 to NoCases-1 do
begin
Groups[i,j] := 0;
Distance[i,j] := 0.0;
end;
for j := 0 to 2 do clusters[i,j] := 0;
end;
NoGroups := 0;
// Get data into the distance matrix
for i := 0 to NoCases - 1 do
begin
col := ColSelected;
Scores[i] := StrToFloat(OS3MainFrm.DataGrid.Cells[col,i+1]);
Mean := Mean + Scores[i];
Variance := Variance + (Scores[i] * Scores[i]);
end;
Variance := Variance - ((Mean * Mean) / NoCases);
Variance := Variance / (NoCases - 1);
StdDev := sqrt(Variance);
Mean := Mean / NoCases;
// sort the scores and ids in distance and subjed ids
for i := 0 to NoCases - 2 do
begin
for j := i+1 to NoCases - 1 do
begin
if (Scores[i] > Scores[j]) then // swap
begin
X1 := Scores[i];
Scores[i] := Scores[j];
Scores[j] := X1;
ID := SubjectIDs[i];
SubjectIDs[i] := SubjectIDs[j];
SubjectIDs[j] := ID;
end;
end;
end;
for i := 0 to NoCases - 1 do Lst[i+1] := SubjectIDs[i];
// Show results
OutPutFrm.RichEdit.Lines.Add('Single Linkage Clustering by Bill Miller');
outline := format('FILE: %s',[OS3MainFrm.FileNameEdit.Text]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Variable := %s',[varlabel]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Number of cases := %d',[NoCases]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Mean := %8.3f, Variance := %8.3f, Std.Dev. := %8.3f',[Mean, Variance, StdDev]);
OutPutFrm.RichEdit.Lines.Add(outline);
// Standardize the distance scores if elected
if (StdChkBox.Checked) then
begin
for i := 0 to NoCases - 1 do Scores[i] := (Scores[i] - Mean) / StdDev;
if (RepChkBox.Checked) then // replace original values in DataGrid with z scores if elected
begin
for i := 0 to NoCases - 1 do
begin
col := ColSelected;
outline := format('%6.4f',[Scores[i]]);
OS3MainFrm.DataGrid.Cells[col,i+1] := outline;
end;
end;
end;
OutPutFrm.RichEdit.Lines.Add('');
if (DescChkBox.Checked) then
begin
done := false;
startat := 0;
endat := NoScores;
if (endat > 20) then endat := 20;
// ptr := outline;
while (not done) do
begin
outline := 'GROUP ID';
for i := startat to endat - 1 do
begin
astring := format('%4d',[SubjectIDs[i]]);
outline := outline + astring;
// strcat(@outline,@astring);
end;
OutPutFrm.RichEdit.Lines.Add(outline);
startat := endat;
if (startat >= NoScores) then done := true;
endat := startat + 20;
if (endat > NoScores) then endat := NoScores;
end;
end;
// calculate Distances and smallest Distance
labels1:
Smallest := abs(Scores[0] - Scores[1]); // initial values
for i := 0 to NoScores - 2 do
begin
for j := i+1 to NoScores - 1 do
begin
Distance[i,j] := abs(Scores[i] - Scores[j]);
Distance[j,i] := Distance[i,j];
if (Distance[i,j] <= Smallest) then
begin
Smallest := Distance[i,j];
ID1 := i;
ID2 := j;
end;
end;
end;
if (NoGroups < NoCases-1) then
begin
if (DescChkBox.Checked) then
begin
outline := format(' Group %d is combined with Group %d',
[SubjectIDs[ID1],SubjectIDs[ID2]]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
end;
end;
// eliminate second score and replace first with average
NoInGrp[ID1] := NoInGrp[ID1] + 1;
NoInGrp[ID2] := NoInGrp[ID2] - 1;
clusters[NoGroups+1,1] := SubjectIDs[ID1];
clusters[NoGroups+1,2] := SubjectIDs[ID2];
// record results for this grouping
labels2:
Groups[NoGroups,ID1] := 1; // set flags for those objects grouped
Groups[NoGroups,ID2] := 1;
if (NoGroups < NoCases-1) then // eliminate second score and replace first with average
begin
average := abs(Scores[ID1] + Scores[ID2]) / 2.0;
Scores[ID1] := average;
for i := ID2 to NoScores - 2 do
begin
Scores[i] := Scores[i+1];
SubjectIDs[i] := SubjectIDs[i+1];
end;
NoScores := NoScores - 1;
for i := 0 to NoScores - 1 do Groups[NoGroups,SubjectIDs[i]] := 1;
if (DescChkBox.Checked) then
begin
done := false;
startat := 0;
endat := NoScores;
if (endat > 20) then endat := 20;
while (not done) do
begin
outline := 'GROUP ID';
for i := startat to endat - 1 do
begin
astring := format('%4d',[SubjectIDs[i]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
startat := endat;
if (startat >= NoScores) then done := true;
endat := startat + 20;
if (endat > NoScores) then endat := NoScores;
end;
end;
// get errors
GrpErrors[NoGroups] := GrpErrors[NoGroups] + Distance[ID1,ID2];
NoGroups := NoGroups + 1;
goto labels1;
end;
// show errors
if (DescChkBox.Checked) then
begin
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('GROUPING STEP ERROR');
for i := 0 to NoGroups - 1 do
begin
outline := format(' %3d %10.3f',[i+1,GrpErrors[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
if (PlotChkBox.Checked) then
begin
MaxError := GrpErrors[NoGroups-1];
SetLength(XAxis,NoCases);
SetLength(YAxis,NoCases);
SetLength(GrpLabels,NoGroups+1);
for i := 0 to NoGroups - 1 do
begin
XAxis[i] := NoGroups - i;
YAxis[i] := GrpErrors[i];
GrpLabels[i] := IntToStr(i + 1);
end;
scatplot(XAxis, YAxis, NoGroups, 'Plot of Error vs No. of Groups',
'No. of Groups', 'Size of Error', 2.0, NoCases, 0.0, MaxError,GrpLabels);
GrpLabels := nil;
YAxis := nil;
XAxis := nil;
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
if (DendoChk.Checked) then
begin
OutPutFrm.RichEdit.Clear;
TreePlot(clusters,Lst,NoGroups+1);
OutPutFrm.ShowModal;
end;
OutPutFrm.RichEdit.Clear;
//clean up the memory
Lst := nil;
clusters := nil;
GrpErrors := nil;
Scores := nil;
Groups := nil;
NoInGrp := nil;
SubjectIDs := nil;
Distance := nil;
end;
procedure TSingleLinkFrm.TreePlot(VAR Clusters : IntDyneMat;
VAR Lst : IntDyneVec;
NoPoints : integer);
VAR
outline : array[0..501] of char;
aline : array[0..82] of char;
valstr : string;
tempstr : string;
plotline : string;
star : char;
blank : char;
endit : char;
col1, col2, colpos1, colpos2 : integer;
noparts, startcol, endcol : integer;
Results : StrDyneVec;
ColPos : IntDyneVec;
i, j, k, L, linecount, newcol, howlong, count, strlong : integer;
done : boolean;
begin
linecount := 1;
star := '*';
blank := ' ';
SetLength(ColPos,NoPoints+2);
SetLength(Results,NoPoints*2+3);
OutPutFrm.RichEdit.Lines.Add('');
done := false;
// store initial column positions of vertical linkages
for i := 1 to NoPoints do ColPos[Lst[i]] := 4 + (i * 5);
// create column heading indented 10 spaces
tempstr := 'UNIT ';
for i := 1 to NoPoints do
begin
valstr := format('%5d',[Lst[i]]);
tempstr := tempstr + valstr;
end;
Results[linecount] := tempstr;
linecount := linecount + 1;
// create beginning of vertical linkages
plotline := 'STEP ';
for i := 1 to NoPoints do plotline := plotline + ' *';
Results[linecount] := plotline;
linecount := linecount + 1;
// start dendoplot
for i := 1 to NoPoints - 1 do
begin
outline := '';
valstr := format('%5d',[i]); // put step no. first
outline := valstr;
// clear remainder of outline
for j := 5 to (5 + NoPoints * 5) do outline[j] := ' ';
outline[6 + NoPoints * 5] := #0;
col1 := Clusters[i,1];
col2 := Clusters[i,2];
// find column positions for each variable
colpos1 := ColPos[col1];
colpos2 := ColPos[col2];
for k := colpos1 to colpos2 do outline[k] := star;
// change column positions 1/2 way between the matched ones
newcol := colpos1 + ((colpos2 - colpos1) div 2);
for k := 1 to NoPoints do
if ((ColPos[k] = colpos1) or (ColPos[k] = colpos2)) then ColPos[k] := newcol;
for k := 1 to NoPoints do
begin
L := ColPos[k];
if ((L <> colpos1) and (L <> colpos2)) then outline[L] := star;
end;
Results[linecount] := outline;
linecount := linecount + 1;
// add a line of connectors to next grouping
outline := ' ';
for j := 5 to (5 + NoPoints * 5) do outline[j] := blank;
for j := 1 to NoPoints do
begin
colpos1 := ColPos[j];
outline[colpos1] := star;
end;
Results[linecount] := outline;
linecount := linecount + 1;
end;
// output the Results in parts
// determine number of pages needed for whole plot
noparts := 0;
howlong := Length(Results[1]);
noparts := round(howlong / 80.0);
if (noparts <= 0) then noparts := 1;
if (noparts = 1) then // simply print the list
begin
for i := 0 to linecount - 1 do
begin
OutPutFrm.RichEdit.Lines.Add(Results[i]);
end;
end
else // break lines into strings of 15 units
begin
startcol := 0;
endcol := 80;
for i := 1 to noparts do
begin
outline := format('PART %d OUTPUT',[i]);
OutPutFrm.RichEdit.Lines.Add(outline);
for j := 0 to 80 do aline[j] := blank;
for j := 0 to linecount - 1 do
begin
count := 0;
outline := Results[j];
for k := startcol to endcol do
begin
aline[count] := outline[k];
count := count + 1;
end;
aline[count+1] := #0;
OutPutFrm.RichEdit.Lines.Add(aline);
end;
OutPutFrm.RichEdit.Lines.Add('');
startcol := endcol + 1;
endcol := endcol + 80;
if (endcol > howlong) then endcol := howlong;
end;
end;
Results := nil;
ColPos := nil;
end;
procedure TSingleLinkFrm.scatplot(var x : DblDyneVec;
var y : DblDyneVec;
nocases : integer;
titlestr : string;
x_axis, y_axis : string;
x_min, x_max, y_min, y_max : double;
VAR VarLabels : StrDyneVec);
var
i, j, k, l, row, xslot : integer;
xdelta, ypred, xtemp, maxx, maxy, minx, miny, stepx, stepy : double;
incrementx, incrementy, rangex, rangey, swap : double;
plotstring : array[0..51,0..61] of char;
ymed, xmed : double;
aheight : integer;
overlap : boolean;
valuestring : string[2];
howlong : integer;
outline : string;
Labels : StrDyneVec;
begin
SetLength(Labels,nocases);
for i := 1 to nocases do Labels[i-1] := VarLabels[i-1];
aheight := 40;
rangex := x_max - x_min ;
incrementx := rangex / 15.0;
xdelta := rangex / 60;
xmed := rangex / 2;
rangey := y_max - y_min;
incrementy := rangey / aheight;
ymed := rangey / 2;
{ sort in descending order }
for i := 1 to (nocases - 1) do
begin
for j := (i + 1) to nocases do
begin
if y[i-1] < y[j-1] then
begin
swap := y[i-1];
y[i-1] := y[j-1];
y[j-1] := swap;
swap := x[i-1];
x[i-1] := x[j-1];
x[j-1] := swap;
outline := Labels[i-1];
Labels[i-1] := Labels[j-1];
Labels[j-1] := outline;
end;
end;
end;
outline := ' SCATTERPLOT - ' + titlestr;
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add(y_axis);
maxy := y_max;
for i := 1 to 60 do
for j := 1 to aheight+1 do plotstring[j,i] := ' ';
{ Set up the plot strings with the data }
row := 0;
while maxy > y_min do
begin
row := row + 1;
plotstring[row,30] := '|';
if (row = (aheight / 2)) then
begin
for i := 1 to 60 do plotstring[row,i] := '-';
end;
for i := 1 to nocases do
begin
if ((maxy >= y[i-1]) and (y[i-1] > (maxy - incrementy))) then
begin
xslot := round(((x[i-1] - x_min) / rangex) * 60);
if xslot < 1 then xslot := 1;
if xslot > 60 then xslot := 60;
overlap := false;
str(i:2,valuestring);
howlong := 1;
if (valuestring[1] <> ' ') then howlong := 2;
for l := xslot to (xslot + howlong - 1) do
if (plotstring[row,l] = '*') then overlap := true;
if (overlap) then plotstring[row,xslot] := '*'
else
begin
if (howlong < 2) then
plotstring[row,xslot] := valuestring[2]
else for l := 1 to 2 do
plotstring[row,xslot + l - 1] := valuestring[l];
end;
end;
end;
maxy := maxy - incrementy;
end;
{ print the plot }
for i := 1 to row do
begin
outline := ' |';
for j := 1 to 60 do outline := outline + format('%1s',[plotstring[i,j]]);
outline := outline + format('|-%6.2f-%6.2f',
[(y_max - i * incrementy),(y_max - i * incrementy + incrementy)]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := '';
for i := 1 to 63 do outline := outline + '-';
OutPutFrm.RichEdit.Lines.Add(outline);
outline := '';
for i := 1 to 16 do outline := outline + ' | ';
outline := outline + x_axis;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := '';
for i := 1 to 16 do outline := outline + format('%4.1f',[(x_min + i * incrementx - incrementx)]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Labels:');
for i := 1 to nocases do
begin
outline := format('%2d = %s',[i,Labels[i-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
Labels := nil;
end; { of scatplot procedure }
initialization
{$I singlelinkunit.lrs}
end.

View File

@ -0,0 +1,112 @@
object SLDepFrm: TSLDepFrm
Left = 176
Height = 171
Top = 108
Width = 386
Caption = 'Straight Line Depreciation'
ClientHeight = 171
ClientWidth = 386
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 10
Height = 14
Top = 16
Width = 52
Caption = 'Initial Cost'
ParentColor = False
end
object Label2: TLabel
Left = 10
Height = 14
Top = 80
Width = 139
Caption = 'Salvage Value at End of Life:'
ParentColor = False
end
object Label3: TLabel
Left = 10
Height = 14
Top = 48
Width = 154
Caption = 'No. of Periods of Life Expected:'
ParentColor = False
end
object Label4: TLabel
Left = 10
Height = 14
Top = 112
Width = 152
Caption = 'Depreciation Allowed (Answer):'
ParentColor = False
end
object CostEdit: TEdit
Left = 171
Height = 21
Top = 9
Width = 88
TabOrder = 0
Text = 'CostEdit'
end
object SalvageEdit: TEdit
Left = 171
Height = 21
Top = 73
Width = 88
TabOrder = 1
Text = 'Edit1'
end
object PeriodsEdit: TEdit
Left = 171
Height = 21
Top = 41
Width = 88
TabOrder = 2
Text = 'Edit1'
end
object DepreciationEdit: TEdit
Left = 171
Height = 21
Top = 105
Width = 88
TabOrder = 3
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 289
Height = 32
Top = 48
Width = 84
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 4
end
object ComputeBtn: TButton
Left = 288
Height = 32
Top = 88
Width = 84
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object ReturnBtn: TButton
Left = 288
Height = 32
Top = 128
Width = 84
Caption = 'Return'
ModalResult = 1
TabOrder = 6
end
object HelpBtn: TButton
Tag = 146
Left = 288
Height = 31
Top = 9
Width = 85
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
end

View File

@ -0,0 +1,30 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSLDepFrm','FORMDATA',[
'TPF0'#9'TSLDepFrm'#8'SLDepFrm'#4'Left'#3#176#0#6'Height'#3#171#0#3'Top'#2'l'
+#5'Width'#3#130#1#7'Caption'#6#26'Straight Line Depreciation'#12'ClientHeigh'
+'t'#3#171#0#11'ClientWidth'#3#130#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#10#6'Height'#2#14#3'Top'#2#16#5
+'Width'#2'4'#7'Caption'#6#12'Initial Cost'#11'ParentColor'#8#0#0#6'TLabel'#6
+'Label2'#4'Left'#2#10#6'Height'#2#14#3'Top'#2'P'#5'Width'#3#139#0#7'Caption'
+#6#29'Salvage Value at End of Life:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label'
+'3'#4'Left'#2#10#6'Height'#2#14#3'Top'#2'0'#5'Width'#3#154#0#7'Caption'#6' N'
+'o. of Periods of Life Expected:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4
+'Left'#2#10#6'Height'#2#14#3'Top'#2'p'#5'Width'#3#152#0#7'Caption'#6#30'Depr'
+'eciation Allowed (Answer):'#11'ParentColor'#8#0#0#5'TEdit'#8'CostEdit'#4'Le'
+'ft'#3#171#0#6'Height'#2#21#3'Top'#2#9#5'Width'#2'X'#8'TabOrder'#2#0#4'Text'
+#6#8'CostEdit'#0#0#5'TEdit'#11'SalvageEdit'#4'Left'#3#171#0#6'Height'#2#21#3
+'Top'#2'I'#5'Width'#2'X'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0#0#5'TEdit'#11
+'PeriodsEdit'#4'Left'#3#171#0#6'Height'#2#21#3'Top'#2')'#5'Width'#2'X'#8'Tab'
+'Order'#2#2#4'Text'#6#5'Edit1'#0#0#5'TEdit'#16'DepreciationEdit'#4'Left'#3
+#171#0#6'Height'#2#21#3'Top'#2'i'#5'Width'#2'X'#8'TabOrder'#2#3#4'Text'#6#5
+'Edit1'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3'!'#1#6'Height'#2' '#3'Top'#2'0'
+#5'Width'#2'T'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrd'
+'er'#2#4#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3' '#1#6'Height'#2' '#3'Top'#2
+'X'#5'Width'#2'T'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8
+'TabOrder'#2#5#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3' '#1#6'Height'#2' '#3'T'
+'op'#3#128#0#5'Width'#2'T'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabO'
+'rder'#2#6#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#146#0#4'Left'#3' '#1#6'Height'
+#2#31#3'Top'#2#9#5'Width'#2'U'#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnC'
+'lick'#8'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,90 @@
unit SLDUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, contexthelpunit;
type
{ TSLDepFrm }
TSLDepFrm = class(TForm)
HelpBtn: TButton;
ResetBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
CostEdit: TEdit;
SalvageEdit: TEdit;
PeriodsEdit: TEdit;
DepreciationEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
function SLNDepreciation(Cost, Salvage: Extended; Life: Integer): Extended;
private
{ private declarations }
public
{ public declarations }
end;
var
SLDepFrm: TSLDepFrm;
implementation
{ TSLDepFrm }
procedure TSLDepFrm.ResetBtnClick(Sender: TObject);
begin
CostEdit.Text := '';
SalvageEdit.Text := '';
PeriodsEdit.Text := '';
DepreciationEdit.Text := '';
end;
procedure TSLDepFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSLDepFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TSLDepFrm.ComputeBtnClick(Sender: TObject);
VAR
Cost, Depr, Salvage : Extended;
Life : integer;
begin
// Obtain results
Cost := StrToFloat(CostEdit.Text);
Salvage := StrToFloat(SalvageEdit.Text);
Life := StrToInt(PeriodsEdit.Text);
Depr := SLNDepreciation(Cost, Salvage, Life);
DepreciationEdit.Text := FloatToStr(Depr);
end;
function TSLDepFrm.SLNDepreciation(Cost, Salvage: Extended; Life: Integer): Extended;
{ Spreads depreciation linearly over life. }
begin
if Life < 1 then ShowMessage('ERROR in SLNDepreciation - Life < 1');
Result := (Cost - Salvage) / Life
end;
initialization
{$I sldunit.lrs}
end.

View File

@ -0,0 +1,200 @@
object DataSmoothingForm: TDataSmoothingForm
Left = 236
Height = 301
Top = 161
Width = 583
Caption = 'Smooth Data'
ClientHeight = 301
ClientWidth = 583
OnShow = ResetBtnClick
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 9
Height = 16
Top = 11
Width = 51
Caption = 'Variables:'
ParentColor = False
end
object VarList: TListBox
Left = 9
Height = 254
Top = 29
Width = 153
ItemHeight = 0
TabOrder = 0
end
object VarInBtn: TBitBtn
Left = 168
Height = 38
Top = 42
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarInBtnClick
TabOrder = 1
end
object VarOutBtn: TBitBtn
Left = 168
Height = 38
Top = 96
Width = 38
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarOutBtnClick
TabOrder = 2
end
object Label2: TLabel
Left = 169
Height = 16
Top = 18
Width = 48
Caption = 'Selected:'
ParentColor = False
end
object SelectedEdit: TEdit
Left = 217
Height = 23
Top = 72
Width = 128
TabOrder = 3
Text = 'SelectedEdit'
end
object CancelBtn: TButton
Left = 169
Height = 38
Top = 238
Width = 79
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 4
end
object ResetBtn: TButton
Left = 266
Height = 38
Top = 238
Width = 79
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object ComputeBtn: TButton
Left = 376
Height = 38
Top = 238
Width = 79
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 6
end
object ReturnBtn: TButton
Left = 472
Height = 38
Top = 238
Width = 79
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
object RepeatChk: TCheckBox
Left = 208
Height = 19
Top = 177
Width = 189
Caption = 'Repeat Smoothing No. Times = '
TabOrder = 8
end
object RepeatEdit: TEdit
Left = 400
Height = 23
Top = 171
Width = 32
TabOrder = 9
Text = '1'
end
object Memo1: TMemo
Left = 360
Height = 117
Top = 11
Width = 201
Lines.Strings = (
'This procedure smooths data by'
'averaging every three data points'
'starting with the first three to the'
'last three. The data smoothing'
'can be repeated multiple times.'
'The first and last data points are'
'unchanged.'
)
TabOrder = 10
end
end

View File

@ -0,0 +1,134 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TDataSmoothingForm','FORMDATA',[
'TPF0'#18'TDataSmoothingForm'#17'DataSmoothingForm'#4'Left'#3#236#0#6'Height'
+#3'-'#1#3'Top'#3#161#0#5'Width'#3'G'#2#7'Caption'#6#11'Smooth Data'#12'Clien'
+'tHeight'#3'-'#1#11'ClientWidth'#3'G'#2#6'OnShow'#7#13'ResetBtnClick'#10'LCL'
+'Version'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2#16#3'Top'
+#2#11#5'Width'#2'3'#7'Caption'#6#10'Variables:'#11'ParentColor'#8#0#0#8'TLis'
+'tBox'#7'VarList'#4'Left'#2#9#6'Height'#3#254#0#3'Top'#2#29#5'Width'#3#153#0
+#10'ItemHeight'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#8'VarInBtn'#4'Left'#3#168
+#0#6'Height'#2'&'#3'Top'#2'*'#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0
+#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0
+#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#7'OnClick'#7#13'VarInBtnClick'#8'TabOrder'#2#1#0#0#7'TBitBtn'
+#9'VarOutBtn'#4'Left'#3#168#0#6'Height'#2'&'#3'Top'#2'`'#5'Width'#2'&'#10'Gl'
+'yph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0
+#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'
+#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'
+#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134
+#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203
+#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190
+'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201#127
+#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255
+#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135
+#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255
+#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177
+'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255
+'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#14'VarOutBtnClick'#8
+'TabOrder'#2#2#0#0#6'TLabel'#6'Label2'#4'Left'#3#169#0#6'Height'#2#16#3'Top'
+#2#18#5'Width'#2'0'#7'Caption'#6#9'Selected:'#11'ParentColor'#8#0#0#5'TEdit'
+#12'SelectedEdit'#4'Left'#3#217#0#6'Height'#2#23#3'Top'#2'H'#5'Width'#3#128#0
+#8'TabOrder'#2#3#4'Text'#6#12'SelectedEdit'#0#0#7'TButton'#9'CancelBtn'#4'Le'
+'ft'#3#169#0#6'Height'#2'&'#3'Top'#3#238#0#5'Width'#2'O'#6'Cancel'#9#7'Capti'
+'on'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#8'ResetB'
+'tn'#4'Left'#3#10#1#6'Height'#2'&'#3'Top'#3#238#0#5'Width'#2'O'#7'Caption'#6
+#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#10'C'
+'omputeBtn'#4'Left'#3'x'#1#6'Height'#2'&'#3'Top'#3#238#0#5'Width'#2'O'#7'Cap'
+'tion'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#6#0#0#7'T'
+'Button'#9'ReturnBtn'#4'Left'#3#216#1#6'Height'#2'&'#3'Top'#3#238#0#5'Width'
+#2'O'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#7#0#0#9'TChec'
+'kBox'#9'RepeatChk'#4'Left'#3#208#0#6'Height'#2#19#3'Top'#3#177#0#5'Width'#3
+#189#0#7'Caption'#6#29'Repeat Smoothing No. Times = '#8'TabOrder'#2#8#0#0#5
+'TEdit'#10'RepeatEdit'#4'Left'#3#144#1#6'Height'#2#23#3'Top'#3#171#0#5'Width'
+#2' '#8'TabOrder'#2#9#4'Text'#6#1'1'#0#0#5'TMemo'#5'Memo1'#4'Left'#3'h'#1#6
+'Height'#2'u'#3'Top'#2#11#5'Width'#3#201#0#13'Lines.Strings'#1#6#30'This pro'
+'cedure smooths data by'#6'!averaging every three data points'#6'$starting w'
+'ith the first three to the'#6#31'last three. The data smoothing'#6#31'can '
,'be repeated multiple times.'#6'"The first and last data points are'#6#10'un'
+'changed.'#0#8'TabOrder'#2#10#0#0#0
]);

View File

@ -0,0 +1,130 @@
unit SmoothDataUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, FunctionsLib, OutPutUnit,
DataProcs, DictionaryUnit, Math;
type
{ TDataSmoothingForm }
TDataSmoothingForm = class(TForm)
CancelBtn: TButton;
Memo1: TMemo;
RepeatEdit: TEdit;
RepeatChk: TCheckBox;
ResetBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
SelectedEdit: TEdit;
Label2: TLabel;
VarInBtn: TBitBtn;
VarOutBtn: TBitBtn;
Label1: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure VarInBtnClick(Sender: TObject);
procedure VarOutBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
DataSmoothingForm: TDataSmoothingForm;
implementation
{ TDataSmoothingForm }
procedure TDataSmoothingForm.ResetBtnClick(Sender: TObject);
var i : integer;
begin
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
RepeatEdit.Text := '1';
SelectedEdit.Text := '';
VarInBtn.Visible := true;
VarOutBtn.Visible := false;
end;
procedure TDataSmoothingForm.ComputeBtnClick(Sender: TObject);
VAR
DataPts, OutPts : DblDyneVec;
avalue, dblvalue, avg : double;
result, N, Reps, intvalue, i, j, VarCol : integer;
VarLabel, strvalue : string;
begin
N := NoCases;
SetLength(DataPts,N);
SetLength(OutPts,N);
Reps := StrToInt(RepeatEdit.Text);
Varlabel := SelectedEdit.Text;
for i := 1 to NoVariables do
if VarLabel = OS3MainFrm.DataGrid.Cells[i,0] then VarCol := i;
for i := 0 to N - 1 do
begin
avalue := StrToFloat(OS3MainFrm.DataGrid.Cells[VarCol,i+1]);
DataPts[i] := avalue;
end;
// repeat smoothing for number of times elected
OutPts[0] := DataPts[0];
OutPts[N-1] := DataPts[N-1];
for j := 1 to Reps do
begin
for i := 1 to N - 2 do
begin
avg := (DataPts[i-1] + DataPts[i] + DataPts[i+1]) / 3.0;
OutPts[i] := avg;
end;
if j < reps then
for i := 0 to N - 1 do DataPts[i] := OutPts[i];
end;
// create a new variable and copy smoothed data into it
strvalue := 'Smoothed' + VarLabel;
DictionaryFrm.NewVar(NoVariables+1);
DictionaryFrm.DictGrid.Cells[1,NoVariables] := strvalue;
OS3MainFrm.DataGrid.Cells[NoVariables,0] := strvalue;
for i := 0 to N - 1 do
begin
strvalue := format('%9.3f',[OutPts[i]]);
OS3MainFrm.DataGrid.Cells[NoVariables,i+1] := strvalue;
end;
// clean up
OutPts := nil;
DataPts := nil;
end;
procedure TDataSmoothingForm.VarInBtnClick(Sender: TObject);
var index : integer;
begin
index := VarList.ItemIndex;
SelectedEdit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
VarInBtn.Visible := false;
VarOutBtn.Visible := true;
end;
procedure TDataSmoothingForm.VarOutBtnClick(Sender: TObject);
begin
VarList.Items.Add(SelectedEdit.Text);
SelectedEdit.Text := '';
VarInBtn.Visible := true;
VarOutBtn.Visible := false;
end;
initialization
{$I smoothdataunit.lrs}
end.

View File

@ -0,0 +1,182 @@
object SortCasesFrm: TSortCasesFrm
Left = 197
Height = 300
Top = 104
Width = 400
Caption = 'Sort Cases'
ClientHeight = 300
ClientWidth = 400
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 10
Height = 14
Top = 7
Width = 44
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
Left = 240
Height = 14
Top = 7
Width = 42
Caption = 'Sort On:'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 263
Top = 24
Width = 167
ItemHeight = 0
TabOrder = 0
end
object SortVarEdit: TEdit
Left = 240
Height = 21
Top = 24
Width = 138
TabOrder = 1
Text = 'SortVarEdit'
end
object OrderGroup: TRadioGroup
Left = 241
Height = 62
Top = 56
Width = 136
AutoFill = True
Caption = 'Direction:'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 44
ClientWidth = 132
ItemIndex = 0
Items.Strings = (
'Ascending'
'Descending'
)
TabOrder = 2
end
object CancelBtn: TButton
Left = 273
Height = 31
Top = 137
Width = 100
Caption = 'Cancel'
ModalResult = 2
TabOrder = 3
end
object ComputeBtn: TButton
Left = 273
Height = 31
Top = 192
Width = 100
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 4
end
object ReturnBtn: TButton
Left = 273
Height = 31
Top = 248
Width = 100
Caption = 'Return'
ModalResult = 1
TabOrder = 5
end
object VarInBtn: TBitBtn
Left = 192
Height = 33
Top = 24
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarInBtnClick
TabOrder = 6
end
object VarOutBtn: TBitBtn
Left = 192
Height = 33
Top = 64
Width = 34
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = VarOutBtnClick
TabOrder = 7
end
end

View File

@ -0,0 +1,130 @@
LazarusResources.Add('TSortCasesFrm','FORMDATA',[
'TPF0'#13'TSortCasesFrm'#12'SortCasesFrm'#4'Left'#3#197#0#6'Height'#3','#1#3
+'Top'#2'h'#5'Width'#3#144#1#7'Caption'#6#10'Sort Cases'#12'ClientHeight'#3','
+#1#11'ClientWidth'#3#144#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9.28'
+'.2'#0#6'TLabel'#6'Label1'#4'Left'#2#10#6'Height'#2#14#3'Top'#2#7#5'Width'#2
+','#7'Caption'#6#9'Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Le'
+'ft'#3#240#0#6'Height'#2#14#3'Top'#2#7#5'Width'#2'*'#7'Caption'#6#8'Sort On:'
+#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6'Height'#3#7#1#3
+'Top'#2#24#5'Width'#3#167#0#10'ItemHeight'#2#0#8'TabOrder'#2#0#0#0#5'TEdit'
+#11'SortVarEdit'#4'Left'#3#240#0#6'Height'#2#21#3'Top'#2#24#5'Width'#3#138#0
+#8'TabOrder'#2#1#4'Text'#6#11'SortVarEdit'#0#0#11'TRadioGroup'#10'OrderGroup'
+#4'Left'#3#241#0#6'Height'#2'>'#3'Top'#2'8'#5'Width'#3#136#0#8'AutoFill'#9#7
+'Caption'#6#10'Direction:'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizi'
+'ng.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogeno'
+'usChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResiz'
+'e'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.Shr'
+'inkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRigh'
+'tThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2','
+#11'ClientWidth'#3#132#0#9'ItemIndex'#2#0#13'Items.Strings'#1#6#9'Ascending'
+#6#10'Descending'#0#8'TabOrder'#2#2#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#17
+#1#6'Height'#2#31#3'Top'#3#137#0#5'Width'#2'd'#7'Caption'#6#6'Cancel'#11'Mod'
+'alResult'#2#2#8'TabOrder'#2#3#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#17#1#6
+'Height'#2#31#3'Top'#3#192#0#5'Width'#2'd'#7'Caption'#6#7'Compute'#7'OnClick'
+#7#15'ComputeBtnClick'#8'TabOrder'#2#4#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3
+#17#1#6'Height'#2#31#3'Top'#3#248#0#5'Width'#2'd'#7'Caption'#6#6'Return'#11
+'ModalResult'#2#1#8'TabOrder'#2#5#0#0#7'TBitBtn'#8'VarInBtn'#4'Left'#3#192#0
+#6'Height'#2'!'#3'Top'#2#24#5'Width'#2'"'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0
+'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4
+#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#7'OnClick'#7#13'VarInBtnClick'#8'TabOrder'#2#6#0#0#7'TBitBtn'
+#9'VarOutBtn'#4'Left'#3#192#0#6'Height'#2'!'#3'Top'#2'@'#5'Width'#2'"'#10'Gl'
+'yph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0
+#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'
+#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'
+#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134
+#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203
+#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190
+'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201#127
+#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255
+#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135
+#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255
+#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177
+'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255
+'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#7'OnClick'#7#14'VarOutBtnClick'#8
+'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,173 @@
unit SortCasesUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, MainUnit, OutPutUnit, FunctionsLib, Globals,
DataProcs, DictionaryUnit;
type
{ TSortCasesFrm }
TSortCasesFrm = class(TForm)
VarInBtn: TBitBtn;
VarOutBtn: TBitBtn;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
OrderGroup: TRadioGroup;
SortVarEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure VarInBtnClick(Sender: TObject);
procedure VarOutBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SortCasesFrm: TSortCasesFrm;
implementation
{ TSortCasesFrm }
procedure TSortCasesFrm.FormShow(Sender: TObject);
VAR i : integer;
begin
SortVarEdit.Text := '';
VarOutBtn.Visible := false;
VarInBtn.Visible := true;
VarList.Items.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSortCasesFrm.ComputeBtnClick(Sender: TObject);
label strvals, lastplace;
var
temp : string;
i, j, k : integer;
selcol : integer;
begin
selcol := 0;
for i := 1 to NoVariables do
if OS3MainFrm.DataGrid.Cells[i,0] = SortVarEdit.Text then selcol := i;
if DictionaryFrm.DictGrid.Cells[4,selcol] = 'S' then goto strvals;
if selcol > 0 then
begin
if OrderGroup.ItemIndex = 0 then // sort ascending
begin
for i := 1 to NoCases-1 do
begin
for j := i+1 to NoCases do
begin
if StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selcol,i])) > StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selcol,j])) then
begin
for k := 1 to NoVariables do
begin
temp := OS3MainFrm.DataGrid.Cells[k,i];
OS3MainFrm.DataGrid.Cells[k,i] := OS3MainFrm.DataGrid.Cells[k,j];
OS3MainFrm.DataGrid.Cells[k,j] := temp;
end;
end;
end; // next j
end; // next i
end // if ascending sort
else begin // descending sort
for i := 1 to NoCases-1 do
begin
for j := i+1 to NoCases do
begin
if StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selcol,i]))
< StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selcol,j])) then
begin
for k := 1 to NoVariables do
begin
temp := OS3MainFrm.DataGrid.Cells[k,i];
OS3MainFrm.DataGrid.Cells[k,i] := OS3MainFrm.DataGrid.Cells[k,j];
OS3MainFrm.DataGrid.Cells[k,j] := temp;
end;
end;
end; // next j
end; // next i
end; // if descending sort
end; // if selcol > 0
goto lastplace;
strvals:
if selcol > 0 then
begin
if OrderGroup.ItemIndex = 0 then // sort ascending
begin
for i := 1 to NoCases-1 do
begin
for j := i+1 to NoCases do
begin
if Trim(OS3MainFrm.DataGrid.Cells[selcol,i]) > Trim(OS3MainFrm.DataGrid.Cells[selcol,j]) then
begin
for k := 1 to NoVariables do
begin
temp := OS3MainFrm.DataGrid.Cells[k,i];
OS3MainFrm.DataGrid.Cells[k,i] := OS3MainFrm.DataGrid.Cells[k,j];
OS3MainFrm.DataGrid.Cells[k,j] := temp;
end;
end;
end; // next j
end; // next i
end // if ascending sort
else begin // descending sort
for i := 1 to NoCases-1 do
begin
for j := i+1 to NoCases do
begin
if Trim(OS3MainFrm.DataGrid.Cells[selcol,i])
< Trim(OS3MainFrm.DataGrid.Cells[selcol,j]) then
begin
for k := 1 to NoVariables do
begin
temp := OS3MainFrm.DataGrid.Cells[k,i];
OS3MainFrm.DataGrid.Cells[k,i] := OS3MainFrm.DataGrid.Cells[k,j];
OS3MainFrm.DataGrid.Cells[k,j] := temp;
end;
end;
end; // next j
end; // next i
end; // if descending sort
end; // if selcol > 0
lastplace:
end;
procedure TSortCasesFrm.VarInBtnClick(Sender: TObject);
VAR i : integer;
begin
i := VarList.ItemIndex;
if i < 0 then exit;
SortVarEdit.Text := VarList.Items.Strings[i];
VarList.Items.Delete(i);
VarInBtn.Visible := false;
VarOutBtn.Visible := true;
end;
procedure TSortCasesFrm.VarOutBtnClick(Sender: TObject);
begin
if SortVarEdit.Text = '' then exit;
VarList.Items.Add(SortVarEdit.Text);
SortVarEdit.Text := '';
VarOutBtn.Visible := false;
VarInBtn.Visible := true;
end;
initialization
{$I sortcasesunit.lrs}
end.

View File

@ -0,0 +1,105 @@
object SpBrFrm: TSpBrFrm
Left = 126
Height = 185
Top = 102
Width = 244
Caption = 'Spearman-Brown Prophecy Formula'
ClientHeight = 185
ClientWidth = 244
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 16
Width = 113
Caption = 'Original Test Reliability:'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 14
Top = 48
Width = 139
Caption = 'Multiplier K for the new Test:'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 14
Top = 80
Width = 118
Caption = 'New Reliability Estimate:'
ParentColor = False
end
object OldRelEdit: TEdit
Left = 156
Height = 21
Top = 8
Width = 53
TabOrder = 0
Text = 'OldRelEdit'
end
object MultKEdit: TEdit
Left = 156
Height = 21
Top = 40
Width = 53
TabOrder = 1
Text = 'Edit1'
end
object NewRelEdit: TEdit
Left = 156
Height = 21
Top = 72
Width = 53
TabOrder = 2
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 7
Height = 29
Top = 104
Width = 61
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object CancelBtn: TButton
Left = 80
Height = 29
Top = 104
Width = 61
Caption = 'Cancel'
ModalResult = 2
TabOrder = 4
end
object ComputeBtn: TButton
Left = 156
Height = 29
Top = 104
Width = 61
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object ReturnBtn: TButton
Left = 80
Height = 29
Top = 144
Width = 61
Caption = 'Return'
ModalResult = 1
TabOrder = 6
end
object HelpBtn: TButton
Tag = 147
Left = 8
Height = 31
Top = 144
Width = 61
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
end

View File

@ -0,0 +1,28 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSpBrFrm','FORMDATA',[
'TPF0'#8'TSpBrFrm'#7'SpBrFrm'#4'Left'#2'~'#6'Height'#3#185#0#3'Top'#2'f'#5'Wi'
+'dth'#3#244#0#7'Caption'#6#31'Spearman-Brown Prophecy Formula'#12'ClientHeig'
+'ht'#3#185#0#11'ClientWidth'#3#244#0#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#16#5
+'Width'#2'q'#7'Caption'#6#26'Original Test Reliability:'#11'ParentColor'#8#0
+#0#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'0'#5'Width'#3#139
+#0#7'Caption'#6#30'Multiplier K for the new Test:'#11'ParentColor'#8#0#0#6'T'
+'Label'#6'Label3'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'P'#5'Width'#2'v'#7'Cap'
+'tion'#6#25'New Reliability Estimate:'#11'ParentColor'#8#0#0#5'TEdit'#10'Old'
+'RelEdit'#4'Left'#3#156#0#6'Height'#2#21#3'Top'#2#8#5'Width'#2'5'#8'TabOrder'
+#2#0#4'Text'#6#10'OldRelEdit'#0#0#5'TEdit'#9'MultKEdit'#4'Left'#3#156#0#6'He'
+'ight'#2#21#3'Top'#2'('#5'Width'#2'5'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0#0
+#5'TEdit'#10'NewRelEdit'#4'Left'#3#156#0#6'Height'#2#21#3'Top'#2'H'#5'Width'
+#2'5'#8'TabOrder'#2#2#4'Text'#6#5'Edit1'#0#0#7'TButton'#8'ResetBtn'#4'Left'#2
+#7#6'Height'#2#29#3'Top'#2'h'#5'Width'#2'='#7'Caption'#6#5'Reset'#7'OnClick'
+#7#13'ResetBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'P'
+#6'Height'#2#29#3'Top'#2'h'#5'Width'#2'='#7'Caption'#6#6'Cancel'#11'ModalRes'
+'ult'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#156#0#6'He'
+'ight'#2#29#3'Top'#2'h'#5'Width'#2'='#7'Caption'#6#7'Compute'#7'OnClick'#7#15
+'ComputeBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'ReturnBtn'#4'Left'#2'P'#6
+'Height'#2#29#3'Top'#3#144#0#5'Width'#2'='#7'Caption'#6#6'Return'#11'ModalRe'
+'sult'#2#1#8'TabOrder'#2#6#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#147#0#4'Left'#2
+#8#6'Height'#2#31#3'Top'#3#144#0#5'Width'#2'='#7'Caption'#6#4'Help'#7'OnClic'
+'k'#7#12'HelpBtnClick'#8'TabOrder'#2#7#0#0#0
]);

View File

@ -0,0 +1,75 @@
unit SpBrUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, contexthelpunit;
type
{ TSpBrFrm }
TSpBrFrm = class(TForm)
HelpBtn: TButton;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
OldRelEdit: TEdit;
MultKEdit: TEdit;
NewRelEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SpBrFrm: TSpBrFrm;
implementation
{ TSpBrFrm }
procedure TSpBrFrm.ResetBtnClick(Sender: TObject);
begin
OldRelEdit.Text := '';
NewRelEdit.Text := '';
MultKEdit.Text := '';
end;
procedure TSpBrFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSpBrFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TSpBrFrm.ComputeBtnClick(Sender: TObject);
var
oldrel, newrel, Factor : double;
begin
oldrel := StrToFloat(OldRelEdit.Text);
Factor := StrToFloat(MultKEdit.Text);
newrel := (Factor * oldrel) / (1.0 + (Factor - 1.0) * oldrel);
NewRelEdit.Text := FloatToStr(newrel);
end;
initialization
{$I spbrunit.lrs}
end.

View File

@ -0,0 +1,274 @@
object SpearmanFrm: TSpearmanFrm
Left = 137
Height = 300
Top = 112
Width = 329
Caption = 'Spearman Rank Correlation'
ClientHeight = 300
ClientWidth = 329
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Label1: TLabel
Left = 7
Height = 14
Top = 1
Width = 90
Caption = 'Variables Available'
ParentColor = False
end
object Label2: TLabel
Left = 200
Height = 14
Top = 17
Width = 48
Caption = 'X Variable'
ParentColor = False
end
object Label3: TLabel
Left = 201
Height = 14
Top = 110
Width = 48
Caption = 'Y Variable'
ParentColor = False
end
object VarList: TListBox
Left = 7
Height = 277
Top = 15
Width = 145
TabOrder = 0
end
object XIn: TBitBtn
Left = 160
Height = 30
Top = 17
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = XInClick
TabOrder = 1
end
object XOut: TBitBtn
Left = 160
Height = 30
Top = 56
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = XOutClick
TabOrder = 2
end
object YIn: TBitBtn
Left = 160
Height = 30
Top = 112
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = YInClick
TabOrder = 3
end
object YOut: TBitBtn
Left = 160
Height = 30
Top = 152
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = YOutClick
TabOrder = 4
end
object XEdit: TEdit
Left = 201
Height = 20
Top = 32
Width = 118
TabOrder = 5
Text = 'XEdit'
end
object YEdit: TEdit
Left = 201
Height = 20
Top = 128
Width = 118
TabOrder = 6
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 161
Height = 26
Top = 194
Width = 64
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 7
end
object CancelBtn: TButton
Left = 255
Height = 26
Top = 194
Width = 64
Caption = 'Cancel'
ModalResult = 2
TabOrder = 8
end
object ComputeBtn: TButton
Left = 161
Height = 26
Top = 240
Width = 64
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 9
end
object ReturnBtn: TButton
Left = 255
Height = 26
Top = 240
Width = 64
Caption = 'Return'
ModalResult = 1
TabOrder = 10
end
end

View File

@ -0,0 +1,231 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSpearmanFrm','FORMDATA',[
'TPF0'#12'TSpearmanFrm'#11'SpearmanFrm'#4'Left'#3#137#0#6'Height'#3','#1#3'To'
+'p'#2'p'#5'Width'#3'I'#1#7'Caption'#6#25'Spearman Rank Correlation'#12'Clien'
+'tHeight'#3','#1#11'ClientWidth'#3'I'#1#6'OnShow'#7#8'FormShow'#10'LCLVersio'
+'n'#6#8'0.9.26.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#1
+#5'Width'#2'Z'#7'Caption'#6#19'Variables Available'#11'ParentColor'#8#0#0#6
+'TLabel'#6'Label2'#4'Left'#3#200#0#6'Height'#2#14#3'Top'#2#17#5'Width'#2'0'#7
+'Caption'#6#10'X Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'
+#3#201#0#6'Height'#2#14#3'Top'#2'n'#5'Width'#2'0'#7'Caption'#6#10'Y Variable'
+#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#7#6'Height'#3#21#1#3
+'Top'#2#15#5'Width'#3#145#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#3'XIn'#4'Left'#3
+#160#0#6'Height'#2#30#3'Top'#2#17#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'
+#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0
+#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169
+'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255
+'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255
+#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161
+#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198
+#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196
+#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255
+#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149
+#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'
+#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195
+'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255
+'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#8'XInClick'#8'TabOrder'#2#1#0#0
+#7'TBitBtn'#4'XOut'#4'Left'#3#160#0#6'Height'#2#30#3'Top'#2'8'#5'Width'#2' '
+#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16
+#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
,#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+''#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#9'X'
+'OutClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#3'YIn'#4'Left'#3#160#0#6'Height'#2
+#30#3'Top'#2'p'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0
+#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0
+#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'
+#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'
+#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0
+'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255#148#208#157
+#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195
+#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0
+#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158#214#167#255
+#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144
+#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201
+#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190
+'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255
+'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#9'NumGlyphs'#2#0#7'OnClick'#7#8'YInClick'#8'TabOrder'#2#3#0#0#7'TBitBtn'#4
+'YOut'#4'Left'#3#160#0#6'Height'#2#30#3'Top'#3#152#0#5'Width'#2' '#10'Glyph.'
+'Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16
+#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255
+'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'
+#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156
+#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255
+#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255
+'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201''#204#138
+#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207
,#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'
+#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0
+'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'
+#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'
+#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#9'YOutClick'#8'Ta'
+'bOrder'#2#4#0#0#5'TEdit'#5'XEdit'#4'Left'#3#201#0#6'Height'#2#20#3'Top'#2' '
+#5'Width'#2'v'#8'TabOrder'#2#5#4'Text'#6#5'XEdit'#0#0#5'TEdit'#5'YEdit'#4'Le'
+'ft'#3#201#0#6'Height'#2#20#3'Top'#3#128#0#5'Width'#2'v'#8'TabOrder'#2#6#4'T'
+'ext'#6#5'Edit1'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#161#0#6'Height'#2#26#3
+'Top'#3#194#0#5'Width'#2'@'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnCl'
+'ick'#8'TabOrder'#2#7#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#255#0#6'Height'#2
+#26#3'Top'#3#194#0#5'Width'#2'@'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8
+'TabOrder'#2#8#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#161#0#6'Height'#2#26#3
+'Top'#3#240#0#5'Width'#2'@'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeB'
+'tnClick'#8'TabOrder'#2#9#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#255#0#6'Heig'
+'ht'#2#26#3'Top'#3#240#0#5'Width'#2'@'#7'Caption'#6#6'Return'#11'ModalResult'
+#2#1#8'TabOrder'#2#10#0#0#0
]);

View File

@ -0,0 +1,422 @@
unit SpearmanUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, OutPutUnit, FunctionsLib,
Globals, DataProcs, Math;
type
{ TSpearmanFrm }
TSpearmanFrm = class(TForm)
XIn: TBitBtn;
XOut: TBitBtn;
YIn: TBitBtn;
YOut: TBitBtn;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
XEdit: TEdit;
YEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure XInClick(Sender: TObject);
procedure XOutClick(Sender: TObject);
procedure YInClick(Sender: TObject);
procedure YOutClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SpearmanFrm: TSpearmanFrm;
implementation
{ TSpearmanFrm }
procedure TSpearmanFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
XEdit.Text := '';
YEdit.Text := '';
Xin.Visible := true;
Xout.Visible := false;
Yin.Visible := true;
Yout.Visible := false;
VarList.Items.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSpearmanFrm.XInClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
XEdit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
Xin.Visible := false;
Xout.Visible := true;
end;
procedure TSpearmanFrm.XOutClick(Sender: TObject);
begin
VarList.Items.Add(XEdit.Text);
XEdit.Text := '';
Xin.Visible := true;
Xout.Visible := false;
end;
procedure TSpearmanFrm.YInClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
YEdit.Text := VarList.Items.Strings[index];
VarList.Items.Delete(index);
Yin.Visible := false;
Yout.Visible := true;
end;
procedure TSpearmanFrm.YOutClick(Sender: TObject);
begin
VarList.Items.Add(YEdit.Text);
YEdit.Text := '';
Yin.Visible := true;
Yout.Visible := false;
end;
procedure TSpearmanFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSpearmanFrm.ComputeBtnClick(Sender: TObject);
label Check1, Check2;
var
i, j, k, itemp, NoTies, NoTieGroups, NoSelected : integer;
col1, col2, NCases : integer;
index : IntDyneMat;
Probability, sumsqrx, sumsqry, Temp, TieSum, Avg, t, SumT, r : double;
z, sumdsqr, df : double;
Ranks, X : DblDyneMat;
d : DblDyneVec;
cellstring, outline : string;
ColNoSelected : IntDyneVec;
ColLabels : StrDyneVec;
VarX, VarY, SDX, SDY, MeanX, MeanY, Rxy : double;
begin
// Allocate memory
SetLength(ColNoSelected,NoVariables);
SetLength(index,NoCases,2);
SetLength(Ranks,NoCases,2);
SetLength(X,NoCases,2);
SetLength(d,NoCases);
SetLength(ColLabels,NoVariables);
// Get column numbers and labels of variables selected
for j := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[j,0];
if cellstring = Xedit.Text then
begin
ColNoSelected[0] := j;
ColLabels[0] := cellstring;
end;
if cellstring = Yedit.Text then
begin
ColNoSelected[1] := j;
ColLabels[1] := cellstring;
end;
end;
NoSelected := 2;
OutPutFrm.RichEdit.Clear;
outline := 'Spearman Rank Correlation Between ';
outline := outline + ColLabels[0];
outline := outline +' & ';
outline := outline + ColLabels[1];
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
// Get scores
NCases := 0;
MeanX := 0.0;
MeanY := 0.0;
VarX := 0.0;
VarY := 0.0;
Rxy := 0.0;
NoTies := 0;
for i := 1 to NoCases do
begin
if ( not GoodRecord(i,NoSelected,ColNoSelected)) then continue;
NCases := NCases + 1;
col1 := ColNoSelected[0];
col2 := ColNoSelected[1];
X[NCases-1,0] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col1,i]));
Ranks[NCases-1,0] := X[NCases-1,0];
X[NCases-1,1] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col2,i]));
Ranks[NCases-1,1] := X[NCases-1,1];
index[NCases-1,0] := NCases;
index[NCases-1,1] := NCases;
VarX := VarX + X[NCases-1,0] * X[NCases-1,0];
VarY := VarY + X[NCases-1,1] * X[NCases-1,1];
MeanX := MeanX + X[NCases-1,0];
MeanY := MeanY + X[NCases-1,1];
Rxy := Rxy + X[NCases-1,0] * X[NCases-1,1];
end;
// Rank the first variable
for i := 1 to NCases - 1 do
begin
for j := i + 1 to NCases do
begin
if (Ranks[i-1,0] > Ranks[j-1,0]) then // swap
begin
Temp := Ranks[i-1,0];
Ranks[i-1,0] := Ranks[j-1,0];
Ranks[j-1,0] := Temp;
itemp := index[i-1,0];
index[i-1,0] := index[j-1,0];
index[j-1,0] := itemp;
Temp := X[i-1,0];
X[i-1,0] := X[j-1,0];
X[j-1,0] := Temp;
end;
end;
end;
// Assign ranks
for i := 1 to NCases do Ranks[i-1,0] := i;
// Check for ties in each
// NoTieGroups := 0;
SumT := 0.0;
i := 1;
while (i < NCases) do
begin
j := i+1;
TieSum := 0.0;
NoTies := 0;
while (j <= NCases) do
begin
if (X[j-1,0] > X[i-1,0]) then goto Check1;
if (X[j-1,0] = X[i-1,0]) then
begin
TieSum := TieSum + Ranks[j-1,0];
NoTies := NoTies + 1;
end;
j := j + 1;
end;
Check1:
if (NoTies > 0) then // at least one tie found
begin
TieSum := TieSum + Ranks[i-1,0];
NoTies := NoTies + 1;
Avg := TieSum / NoTies;
for j := i to i + NoTies - 1 do Ranks[j-1,0] := Avg;
t := ( Power(NoTies,3) - NoTies) / 12.0;
SumT := SumT + t;
// NoTieGroups := NoTieGroups + 1;
i := i + (NoTies-1);
end;
i := i + 1;
end;
sumsqrx := ( (Power(NCases,3) - NCases) / 12.0) - SumT;
outline := format('Tied ranks correction for X = %8.2f for %d ties',[sumsqrx,NoTies]);
OutPutFrm.RichEdit.Lines.Add(outline);
// Repeat sort for second variable
for i := 1 to NCases - 1 do
begin
for j := i + 1 to NCases do
begin
if (Ranks[i-1,1] > Ranks[j-1,1]) then // swap
begin
Temp := Ranks[i-1,1];
Ranks[i-1,1] := Ranks[j-1,1];
Ranks[j-1,1] := Temp;
itemp := index[i-1,1];
index[i-1,1] := index[j-1,1];
index[j-1,1] := itemp;
Temp := X[i-1,1];
X[i-1,1] := X[j-1,1];
X[j-1,1] := Temp;
end;
end;
end;
// Assign ranks
for i := 1 to NCases do Ranks[i-1,1] := i;
// Check for ties in each
SumT := 0.0;
// NoTieGroups := 0;
i := 1;
while (i < NCases) do
begin
j := i+1;
TieSum := 0.0;
NoTies := 0;
while (j <= NCases) do
begin
if (X[j-1,1] > X[i-1,1]) then goto Check2;
if (X[j-1,1] = X[i-1,1]) then
begin
TieSum := TieSum + Ranks[j-1,1];
NoTies := NoTies + 1;
end;
j := j + 1;
end;
Check2:
if (NoTies > 0) then // at least one tie found
begin
TieSum := TieSum + Ranks[i-1,1];
NoTies := NoTies + 1;
Avg := TieSum / NoTies;
for j := i to i + NoTies - 1 do Ranks[j-1,1] := Avg;
t := ( Power(NoTies,3) - NoTies) / 12.0;
SumT := SumT + t;
// NoTieGroups := NoTieGroups + 1;
i := i + (NoTies-1);
end;
i := i + 1;
end;
sumsqry := ( (Power(NCases,3) - NCases) / 12.0) - SumT;
outline := format('Tied ranks correction for Y = %8.2f for %d ties',[sumsqry,NoTies]);
OutPutFrm.RichEdit.Lines.Add(outline);
// arrange scores in order of first variable
for i := 1 to Ncases - 1 do
begin
for j := i + 1 to Ncases do
begin
if (index[i-1,0] > index[j-1,0]) then // swap all
begin
itemp := index[i-1,0];
index[i-1,0] := index[j-1,0];
index[j-1,0] := itemp;
Temp := X[i-1,0];
X[i-1,0] := X[j-1,0];
X[j-1,0] := Temp;
Temp := Ranks[i-1,0];
Ranks[i-1,0] := Ranks[j-1,0];
Ranks[j-1,0] := Temp;
end; // end swap
end; // next j
end; // next i
// arrange scores of the second variable
for i := 1 to Ncases - 1 do
begin
for j := i + 1 to Ncases do
begin
if (index[i-1,1] > index[j-1,1]) then // swap all
begin
itemp := index[i-1,1];
index[i-1,1] := index[j-1,1];
index[j-1,1] := itemp;
Temp := X[i-1,1];
X[i-1,1] := X[j-1,1];
X[j-1,1] := Temp;
Temp := Ranks[i-1,1];
Ranks[i-1,1] := Ranks[j-1,1];
Ranks[j-1,1] := Temp;
end; // end swap
end; // next j
end; // next i
// Calculate difference scores
sumdsqr := 0.0;
for i := 1 to NCases do
begin
d[i-1] := Ranks[i-1,0] - Ranks[i-1,1];
sumdsqr := sumdsqr + (d[i-1] * d[i-1]);
end;
// Calculate corrected spearman rank correlation
r := (sumsqrx + sumsqry - sumdsqr) / (2.0 * sqrt(sumsqrx * sumsqry));
// Calculate Pearson correlation
VarX := VarX - (MeanX * MeanX) / NCases;
VarX := VarX / (NCases-1);
VarY := VarY - (MeanY * MeanY) / NCases;
VarY := VarY / (NCases - 1);
SDX := sqrt(VarX);
SDY := sqrt(VarY);
Rxy := Rxy - (MeanX * MeanY) / NCases;
Rxy := Rxy / (NCases - 1);
Rxy := Rxy / (SDX * SDY);
MeanX := MeanX / NCases;
MeanY := MeanY / NCases;
// Output the results
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Observed scores, their ranks and differences between ranks');
outline := format('CASE %10s Ranks %10s Ranks Rank Difference',
[ColLabels[0], ColLabels[1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 1 to NCases do
begin
outline := format('%4d %10.2f%10.2f%10.2f%10.2f%10.2f',
[i, X[i-1,0], Ranks[i-1,0], X[i-1,1], Ranks[i-1,1], d[i-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := format('Spearman Rank Correlation = %6.3f',[r]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
if (NCases > 10) then// Use normal distribution approximation
begin
z := r * sqrt((NCases - 2) / (1.0 - (r * r)));
outline := format('t-test value for hypothesis r = 0 is %5.3f',[z]);
OutPutFrm.RichEdit.Lines.Add(outline);
df := NCases - 2;
Probability := probt(z,df);
outline := format('Probability > t = %6.4f',[Probability]);
OutPutFrm.RichEdit.Lines.Add(outline);
end
else
begin
outline := 'Use table P, page 284 in Siegel for testing significance of r.';
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Pearson r for original scores := %6.3f',[Rxy]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('For the Original Scores:');
OutPutFrm.RichEdit.Lines.Add('Mean X Variance X Std.Dev. X Mean Y Variance Y Std.Dev. Y');
outline := format('%8.2f %8.2f %8.2f %8.2f %8.2f %8.2f',[MeanX,VarX,SDX,MeanY,VarY,SDY]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
// clean up the heap
ColLabels := nil;
d := nil;
X := nil;
Ranks := nil;
index := nil;
ColNoSelected := nil;
end;
initialization
{$I spearmanunit.lrs}
end.

View File

@ -0,0 +1,473 @@
object SRHTest: TSRHTest
Left = 211
Height = 505
Top = 161
Width = 687
Caption = 'Scheirer-Ray-Hare Test'
ClientHeight = 505
ClientWidth = 687
OnShow = ResetBtnClick
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 8
Height = 16
Top = 11
Width = 51
Caption = 'Variables:'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 368
Top = 29
Width = 185
ItemHeight = 0
TabOrder = 0
end
object DepIn: TBitBtn
Left = 208
Height = 29
Top = 25
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = DepInClick
TabOrder = 1
end
object StaticText1: TStaticText
Left = 256
Height = 15
Top = 21
Width = 73
Caption = 'Dependent Variable'
TabOrder = 2
end
object DepVar: TEdit
Left = 257
Height = 23
Top = 41
Width = 135
TabOrder = 3
Text = 'DepVar'
end
object Fact1In: TBitBtn
Left = 208
Height = 29
Top = 120
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Fact1InClick
TabOrder = 4
end
object StaticText2: TStaticText
Left = 256
Height = 17
Top = 112
Width = 83
Caption = 'Factor 1 Variable'
TabOrder = 5
end
object GroupBox2: TGroupBox
Left = 228
Height = 101
Top = 304
Width = 169
Caption = 'Options'
ClientHeight = 83
ClientWidth = 165
TabOrder = 6
object PlotMeans: TCheckBox
Left = 8
Height = 19
Top = 6
Width = 154
Caption = 'Plot Means Using 3D bars'
TabOrder = 0
end
object Plot2DLines: TCheckBox
Left = 6
Height = 19
Top = 29
Width = 159
Caption = 'Plot Means Using 2D Lines'
TabOrder = 1
end
object Plot3DLines: TCheckBox
Left = 7
Height = 19
Top = 53
Width = 159
Caption = 'Plot Means Using 3D Lines'
TabOrder = 2
end
end
object Label3: TLabel
Left = 7
Height = 16
Top = 415
Width = 150
Caption = 'Alpha Level for Overall Tests'
ParentColor = False
end
object HelpBtn: TButton
Tag = 107
Left = 8
Height = 32
Top = 447
Width = 78
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
object Factor1: TEdit
Left = 256
Height = 23
Top = 136
Width = 135
TabOrder = 8
Text = 'Edit1'
end
object DepOut: TBitBtn
Left = 208
Height = 29
Top = 64
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = DepOutClick
TabOrder = 9
end
object Fact1Out: TBitBtn
Left = 208
Height = 29
Top = 160
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Fact1OutClick
TabOrder = 10
end
object Fact2In: TBitBtn
Left = 208
Height = 29
Top = 216
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Fact2InClick
TabOrder = 11
end
object Fact2Out: TBitBtn
Left = 208
Height = 29
Top = 256
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Fact2OutClick
TabOrder = 12
end
object StaticText3: TStaticText
Left = 256
Height = 13
Top = 216
Width = 95
Caption = 'Factor 2 Variable'
TabOrder = 13
end
object Factor2: TEdit
Left = 256
Height = 23
Top = 240
Width = 135
TabOrder = 14
Text = 'Edit1'
end
object OverallAlpha: TEdit
Left = 158
Height = 23
Top = 408
Width = 45
TabOrder = 15
Text = 'OverallAlpha'
end
object ResetBtn: TButton
Left = 112
Height = 32
Top = 447
Width = 77
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 16
end
object CancelBtn: TButton
Left = 216
Height = 32
Top = 448
Width = 77
Caption = 'Cancel'
ModalResult = 2
TabOrder = 17
end
object ComputeBtn: TButton
Left = 320
Height = 31
Top = 449
Width = 77
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 18
end
object ReturnBtn: TButton
Left = 424
Height = 31
Top = 449
Width = 77
Caption = 'Return'
ModalResult = 1
TabOrder = 19
end
object Memo1: TMemo
Left = 408
Height = 382
Top = 10
Width = 264
Lines.Strings = (
'Notes: This is a non-parametric analysis of'
'ordinal data. It is similar to a two-way'
'Analysis of Variance but utilizes a chi-square'
'statistic (H) for determining the significance'
'of the row, column and interaction effects.'
'The dependent value, if not initially rank'
'data, may be obtained first by creating a new'
'variable with the "transformation" procedure'
'available under the "Variables" menu.'
'The output of this procedure contains the'
'results both of a "traditional" 2-way ANOVA'
'as well as the SRH results. It should be noted'
'that the power of the SRH analysis is less '
'than that of the traditional ANOVA. It is '
'suggested that there be at least 5 or more'
'cases in each cell and that the design is a'
'balanced design of fixed levels. The H '
'statistic is obtained as the division of the'
'sum of squares for an effect by the mean'
'square of the total and the test is performed'
'by a chi-squared probability with the '
'degrees of freedom equal to the SS of the'
'effect being tested.'
)
TabOrder = 20
end
end

View File

@ -0,0 +1,369 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSRHTest','FORMDATA',[
'TPF0'#8'TSRHTest'#7'SRHTest'#4'Left'#3#211#0#6'Height'#3#249#1#3'Top'#3#161#0
+#5'Width'#3#175#2#7'Caption'#6#22'Scheirer-Ray-Hare Test'#12'ClientHeight'#3
+#249#1#11'ClientWidth'#3#175#2#6'OnShow'#7#13'ResetBtnClick'#10'LCLVersion'#6
+#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#16#3'Top'#2#11#5'Wi'
+'dth'#2'3'#7'Caption'#6#10'Variables:'#11'ParentColor'#8#0#0#8'TListBox'#7'V'
+'arList'#4'Left'#2#8#6'Height'#3'p'#1#3'Top'#2#29#5'Width'#3#185#0#10'ItemHe'
+'ight'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'DepIn'#4'Left'#3#208#0#6'Height'
+#2#29#3'Top'#2#25#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0
+#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0
+#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161
+'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255
+'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255
+#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255#148#208#157
+#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195
+#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0
+#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158#214#167#255
+#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144
+#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201
+#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190
+'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255
+'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#9'NumGlyphs'#2#0#7'OnClick'#7#10'DepInClick'#8'TabOrder'#2#1#0#0#11'TStatic'
+'Text'#11'StaticText1'#4'Left'#3#0#1#6'Height'#2#15#3'Top'#2#21#5'Width'#2'I'
+#7'Caption'#6#18'Dependent Variable'#8'TabOrder'#2#2#0#0#5'TEdit'#6'DepVar'#4
+'Left'#3#1#1#6'Height'#2#23#3'Top'#2')'#5'Width'#3#135#0#8'TabOrder'#2#3#4'T'
+'ext'#6#6'DepVar'#0#0#7'TBitBtn'#7'Fact1In'#4'Left'#3#208#0#6'Height'#2#29#3
+'Top'#2'x'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0
+#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0
,#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'
+#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195
+'q'#255#160#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144
+#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255
+'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255
+#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212
+#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133
+#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255
+#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255
+']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145
+'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyp'
+'hs'#2#0#7'OnClick'#7#12'Fact1InClick'#8'TabOrder'#2#4#0#0#11'TStaticText'#11
+'StaticText2'#4'Left'#3#0#1#6'Height'#2#17#3'Top'#2'p'#5'Width'#2'S'#7'Capti'
+'on'#6#17'Factor 1 Variable'#8'TabOrder'#2#5#0#0#9'TGroupBox'#9'GroupBox2'#4
+'Left'#3#228#0#6'Height'#2'e'#3'Top'#3'0'#1#5'Width'#3#169#0#7'Caption'#6#7
+'Options'#12'ClientHeight'#2'S'#11'ClientWidth'#3#165#0#8'TabOrder'#2#6#0#9
+'TCheckBox'#9'PlotMeans'#4'Left'#2#8#6'Height'#2#19#3'Top'#2#6#5'Width'#3#154
+#0#7'Caption'#6#24'Plot Means Using 3D bars'#8'TabOrder'#2#0#0#0#9'TCheckBox'
+#11'Plot2DLines'#4'Left'#2#6#6'Height'#2#19#3'Top'#2#29#5'Width'#3#159#0#7'C'
+'aption'#6#25'Plot Means Using 2D Lines'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11
+'Plot3DLines'#4'Left'#2#7#6'Height'#2#19#3'Top'#2'5'#5'Width'#3#159#0#7'Capt'
+'ion'#6#25'Plot Means Using 3D Lines'#8'TabOrder'#2#2#0#0#0#6'TLabel'#6'Labe'
+'l3'#4'Left'#2#7#6'Height'#2#16#3'Top'#3#159#1#5'Width'#3#150#0#7'Caption'#6
+#29'Alpha Level for Overall Tests'#11'ParentColor'#8#0#0#7'TButton'#7'HelpBt'
+'n'#3'Tag'#2'k'#4'Left'#2#8#6'Height'#2' '#3'Top'#3#191#1#5'Width'#2'N'#7'Ca'
+'ption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#7#0#0#5'TEdit'
+#7'Factor1'#4'Left'#3#0#1#6'Height'#2#23#3'Top'#3#136#0#5'Width'#3#135#0#8'T'
,'abOrder'#2#8#4'Text'#6#5'Edit1'#0#0#7'TBitBtn'#6'DepOut'#4'Left'#3#208#0#6
+'Height'#2#29#3'Top'#2'@'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0
+'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4
+#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207
+'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'
+#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255
+#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'
+#255#255#255#255#0#255#255#255#0'h'#199't'#201#127#204#138#255#162#216#171
+#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204
+#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x'
+#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209
+#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'
+#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255
+'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'
+#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'
+#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'DepOutClick'#8'TabOrde'
+'r'#2#9#0#0#7'TBitBtn'#8'Fact1Out'#4'Left'#3#208#0#6'Height'#2#29#3'Top'#3
+#160#0#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0
+'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0
+#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'
+#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161
+'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131
+#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/'
+'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'
+#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255
+#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132
+#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255
+#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154
+#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255
+#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201
+#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num'
+'Glyphs'#2#0#7'OnClick'#7#13'Fact1OutClick'#8'TabOrder'#2#10#0#0#7'TBitBtn'#7
+'Fact2In'#4'Left'#3#208#0#6'Height'#2#29#3'Top'#3#216#0#5'Width'#2' '#10'Gly'
+'ph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0
+#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'
+#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255
+#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165
,#255#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201
+#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140
+'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255
+#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154
+#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194
+#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'
+#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/'
+'x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#12'Fact2InClick'#8
+'TabOrder'#2#11#0#0#7'TBitBtn'#8'Fact2Out'#4'Left'#3#208#0#6'Height'#2#29#3
+'Top'#3#0#1#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0
+#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'
+#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'
+#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161
+'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131
+#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/'
+'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'
+#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255
+#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132
+#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255
+#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154
+#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255
+#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201
+#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'
+#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255
,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num'
+'Glyphs'#2#0#7'OnClick'#7#13'Fact2OutClick'#8'TabOrder'#2#12#0#0#11'TStaticT'
+'ext'#11'StaticText3'#4'Left'#3#0#1#6'Height'#2#13#3'Top'#3#216#0#5'Width'#2
+'_'#7'Caption'#6#17'Factor 2 Variable'#8'TabOrder'#2#13#0#0#5'TEdit'#7'Facto'
+'r2'#4'Left'#3#0#1#6'Height'#2#23#3'Top'#3#240#0#5'Width'#3#135#0#8'TabOrder'
+#2#14#4'Text'#6#5'Edit1'#0#0#5'TEdit'#12'OverallAlpha'#4'Left'#3#158#0#6'Hei'
+'ght'#2#23#3'Top'#3#152#1#5'Width'#2'-'#8'TabOrder'#2#15#4'Text'#6#12'Overal'
+'lAlpha'#0#0#7'TButton'#8'ResetBtn'#4'Left'#2'p'#6'Height'#2' '#3'Top'#3#191
+#1#5'Width'#2'M'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabO'
+'rder'#2#16#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#216#0#6'Height'#2' '#3'Top'
+#3#192#1#5'Width'#2'M'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'
+#2#17#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3'@'#1#6'Height'#2#31#3'Top'#3
+#193#1#5'Width'#2'M'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'
+#8'TabOrder'#2#18#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#168#1#6'Height'#2#31
+#3'Top'#3#193#1#5'Width'#2'M'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'T'
+'abOrder'#2#19#0#0#5'TMemo'#5'Memo1'#4'Left'#3#152#1#6'Height'#3'~'#1#3'Top'
+#2#10#5'Width'#3#8#1#13'Lines.Strings'#1#6'-Notes: This is a non-parametri'
+'c analysis of'#6')ordinal data. It is similar to a two-way'#6'.Analysis of'
+' Variance but utilizes a chi-square'#6'.statistic (H) for determining the s'
+'ignificance'#6'+of the row, column and interaction effects.'#6'*The depende'
+'nt value, if not initially rank'#6'-data, may be obtained first by creating'
+' a new'#6',variable with the "transformation" procedure'#6'%available under'
+' the "Variables" menu.'#6')The output of this procedure contains the'#6'+re'
+'sults both of a "traditional" 2-way ANOVA'#6'/as well as the SRH results. '
+'It should be noted'#6'+that the power of the SRH analysis is less '#6'+than'
+' that of the traditional ANOVA. It is '#6'*suggested that there be at leas'
+'t 5 or more'#6'+cases in each cell and that the design is a'#6'(balanced de'
+'sign of fixed levels. The H '#6',statistic is obtained as the division of '
+'the'#6'(sum of squares for an effect by the mean'#6'-square of the total an'
+'d the test is performed'#6'&by a chi-squared probability with the '#6')degr'
+'ees of freedom equal to the SS of the'#6#20'effect being tested.'#0#8'TabOr'
+'der'#2#20#0#0#0
]);

View File

@ -0,0 +1,697 @@
unit SRHTestUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, MainUnit, Globals, FunctionsLib, OutPutUnit,
DataProcs, GraphLib, Math, contexthelpunit;
type
{ TSRHTest }
TSRHTest = class(TForm)
CancelBtn: TButton;
ComputeBtn: TButton;
DepIn: TBitBtn;
DepOut: TBitBtn;
DepVar: TEdit;
Fact1In: TBitBtn;
Fact1Out: TBitBtn;
Fact2In: TBitBtn;
Fact2Out: TBitBtn;
Factor1: TEdit;
Factor2: TEdit;
GroupBox2: TGroupBox;
HelpBtn: TButton;
Label1: TLabel;
Label3: TLabel;
Memo1: TMemo;
OverallAlpha: TEdit;
Plot2DLines: TCheckBox;
Plot3DLines: TCheckBox;
PlotMeans: TCheckBox;
ResetBtn: TButton;
ReturnBtn: TButton;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure DepInClick(Sender: TObject);
procedure DepOutClick(Sender: TObject);
procedure Fact1InClick(Sender: TObject);
procedure Fact1OutClick(Sender: TObject);
procedure Fact2InClick(Sender: TObject);
procedure Fact2OutClick(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
NoSelected, intvalue, N : integer;
ColNoSelected : IntDyneVec;
outline, cellstring : string;
SSDep, SSErr, SSF1, SSF2, SSF1F2 : double;
MSDep, MSErr, MSF1, MSF2, MSF3, MSF1F2 : double;
DFTot, DFErr, DFF1, DFF2, DFF1F2 : double;
Omega, OmegaF1, OmegaF2, OmegaF1F2, F, MinSize, MaxSize : double;
FF1, FF2, FF1F2, ProbF1, ProbF2, ProbF1F2 : double;
DepVarCol, F1Col, F2Col, Nf1cells, Nf2cells : integer;
MeanDep, MeanF1, MeanF2, X : double;
minf1, maxf1, minf2, maxf2, nofactors, totcells : integer;
cellcnts : DblDyneVec; // array of cell counts
cellvars : DblDyneVec; // arrray of cell sums of squares then variances
cellsums : DblDyneVec; // array of cell sums then means
equal_grp : boolean; // check for equal groups for post-hoc tests
counts : DblDyneMat; // matrix for 2-way containing cell sizes
sums : DblDyneMat; // matrix for 2-way containing cell sums
vars : DblDyneMat; // matrix for 2-way containing sums of squares
RowSums : DblDyneVec; // 2 way row sums
ColSums : DblDyneVec; // 2 way col sums
RowCount : DblDyneVec; // 2 way row count
ColCount : DblDyneVec; // 2 way col count
NoGrpsA, NoGrpsB : integer;
OrdMeansA, OrdMeansB : DblDyneVec; // reordered means for f1, f2
allAlpha : double; // alphas for tests
wsum, wx2 : DblDyneMat;
ncnt : IntDyneMat;
OKterms : array[1..14] of integer;
CompError : boolean;
procedure getlevels(Sender : TObject);
procedure Calc2Way(Sender: TObject);
procedure TwoWayTable(Sender: TObject);
procedure TwoWayPlot(Sender: TObject);
public
{ public declarations }
end;
var
SRHTest: TSRHTest;
implementation
{ TSRHTest }
procedure TSRHTest.ResetBtnClick(Sender: TObject);
Var i : integer;
begin
VarList.Clear;
DepIn.Visible := true;
Fact1In.Visible := true;
Fact2In.Visible := true;
DepOut.Visible := false;
Fact1Out.Visible := false;
Fact2Out.Visible := false;
DepVar.Text := '';
Factor1.Text := '';
Factor2.Text := '';
PlotMeans.Checked := false;
OverAllalpha.Text := '0.05';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSRHTest.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TSRHTest.DepInClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
DepVar.Text := VarList.Items.Strings[index];
DepIn.Visible := false;
DepOut.Visible := true;
VarList.Items.Delete(index);
end;
procedure TSRHTest.ComputeBtnClick(Sender: TObject);
Var
i : integer;
Label cleanit;
label nexttwo;
label nextthree;
begin
OutPutFrm.RichEdit.Clear;
// initialize values
SetLength(ColNoSelected,NoVariables);
DepVarCol := 0;
F1Col := 0;
F2Col := 0;
SSDep := 0.0;
SSF1 := 0.0;
SSF2 := 0.0;
SSF1F2 := 0.0;
MeanDep := 0.0;
MeanF1 := 0.0;
MeanF2 := 0.0;
Nf1cells := 0;
Nf2cells := 0;
N := 0;
NoSelected := 0;
minf1 := 0;
maxf1 := 0;
minf2 := 0;
maxf2 := 0;
// Get column numbers of dependent variable and factors
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = DepVar.Text then
begin
DepVarCol := i;
NoSelected := NoSelected + 1;
ColNoSelected[NoSelected-1] := DepVarCol;
end;
if cellstring = Factor1.Text then
begin
F1Col := i;
NoSelected := NoSelected + 1;
ColNoSelected[NoSelected-1] := F1Col;
end;
if cellstring = Factor2.Text then
begin
F2Col := i;
NoSelected := NoSelected + 1;
ColNoSelected[NoSelected-1] := F2Col;
end;
end;
nofactors := 2;
allAlpha := StrToFloat(OverAllalpha.Text);
// get min and max of each factor code
getlevels(self);
// allocate space
SetLength(cellcnts,totcells); // array of cell counts
SetLength(cellvars,totcells); // arrray of cell sums of squares then variances
SetLength(cellsums,totcells); // array of cell sums then means
// initialize array values
for i := 1 to totcells do
begin
cellsums[i-1] := 0.0;
cellvars[i-1] := 0.0;
cellcnts[i-1] := 0;
end;
// do analysis
SetLength(counts,Nf1cells,Nf2cells); // matrix for 2-way containing cell sizes
SetLength(sums,Nf1cells,Nf2cells); // matrix for 2-way containing cell sums
SetLength(vars,Nf1cells,Nf2cells); // matrix for 2-way containing sums of squares
SetLength(RowSums,Nf1cells); // 2 way row sums
SetLength(ColSums,Nf2cells); // 2 way col sums
SetLength(RowCount,Nf1cells); // 2 way row count
SetLength(ColCount,Nf2cells); // 2 way col count
SetLength(OrdMeansA,Nf1cells); // ordered means for factor 1
SetLength(OrdMeansB,Nf2cells); // ordered means for factor 2
Calc2Way(self);
if CompError then goto nexttwo;
TwoWayTable(self);
OutPutFrm.ShowModal;
if (PlotMeans.Checked) or (Plot2DLines.Checked)
or (Plot3DLines.Checked) then TwoWayPlot(self);
nexttwo: OrdMeansB := nil;
OrdMeansA := nil;
ColCount := nil;
RowCount := nil;
ColSums := nil;
RowSums := nil;
vars := nil;
sums := nil;
counts := nil;
cleanit:
cellcnts := nil;
cellvars := nil;
cellsums := nil;
ColNoSelected := nil;
end;
procedure TSRHTest.DepOutClick(Sender: TObject);
begin
VarList.Items.Add(DepVar.Text);
DepVar.Text := '';
DepOut.Visible := false;
DepIn.Visible := true;
end;
procedure TSRHTest.Fact1InClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
if index = -1 then exit;
Factor1.Text := VarList.Items.Strings[index];
Fact1In.Visible := false;
Fact1Out.Visible := true;
VarList.Items.Delete(index);
end;
procedure TSRHTest.Fact1OutClick(Sender: TObject);
begin
VarList.Items.Add(Factor1.Text);
Factor1.Text := '';
Fact1Out.Visible := false;
Fact1In.Visible := true;
end;
procedure TSRHTest.Fact2InClick(Sender: TObject);
VAR index : integer;
begin
index := VarList.ItemIndex;
if index = -1 then exit;
Factor2.Text := VarList.Items.Strings[index];
Fact2In.Visible := false;
Fact2Out.Visible := true;
VarList.Items.Delete(index);
end;
procedure TSRHTest.Fact2OutClick(Sender: TObject);
begin
VarList.Items.Add(Factor2.Text);
Factor2.Text := '';
Fact2Out.Visible := false;
Fact2In.Visible := true;
end;
procedure TSRHTest.getlevels(Sender: TObject);
VAR i : integer;
begin
minf1 := 10000;
maxf1 := -10000;
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
intvalue := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[F1Col,i])));
if intvalue > maxf1 then maxf1 := intvalue;
if intvalue < minf1 then minf1 := intvalue;
end;
Nf1cells := maxf1 - minf1 + 1;
if nofactors > 1 then
begin
minf2 := 10000;
maxf2 := -10000;
for i := 1 to NoCases do
begin
if Not GoodRecord(i,NoSelected,ColNoSelected) then continue;
intvalue := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[F2Col,i])));
if intvalue > maxf2 then maxf2 := intvalue;
if intvalue < minf2 then minf2 := intvalue;
end;
Nf2cells := maxf2 - minf2 + 1;
end;
totcells := Nf1cells + Nf2cells;
end;
procedure TSRHTest.Calc2Way(Sender: TObject);
var
i, j : integer;
grpA, grpB : integer;
Constant, RowsTotCnt, ColsTotCnt, SSCells : double;
begin
CompError := false;
// initialize matrix values
NoGrpsA := maxf1 - minf1 + 1;
NoGrpsB := maxf2 - minf2 + 1;
for i := 1 to NoGrpsA do
begin
RowSums[i-1] := 0.0;
RowCount[i-1] := 0.0;
for j := 1 to NoGrpsB do
begin
counts[i-1,j-1] := 0.0;
sums[i-1,j-1] := 0.0;
vars[i-1,j-1] := 0.0;
end;
end;
for i := 1 to NoGrpsB do
begin
ColCount[i-1] := 0.0;
ColSums[i-1] := 0.0;
end;
N := 0;
MeanDep := 0.0;
SSDep := 0.0;
SSCells := 0.0;
RowsTotCnt := 0.0;
ColsTotCnt := 0.0;
// get working totals
for i := 1 to NoCases do
begin
if not GoodRecord(i,NoSelected,ColNoSelected) then continue;
grpA := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[F1Col,i])));
grpB := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[F2Col,i])));
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[DepVarCol,i]));
grpA := grpA - minf1 + 1;
grpB := grpB - minf2 + 1;
counts[grpA-1,grpB-1] := counts[grpA-1,grpB-1] + 1;
sums[grpA-1,grpB-1] := sums[grpA-1,grpB-1] + X;
vars[grpA-1,grpB-1] := vars[grpA-1,grpB-1] + (X * X);
RowSums[GrpA-1] := RowSums[GrpA-1] + X;
ColSums[GrpB-1] := ColSums[GrpB-1] + X;
RowCount[GrpA-1] := RowCount[GrpA-1] + 1.0;
ColCount[GrpB-1] := ColCount[GrpB-1] + 1.0;
MeanDep := MeanDep + X;
SSDep := SSDep + (X * X);
N := N + 1;
end;
// Calculate results
for i := 0 to NoGrpsA-1 do
begin
SSF1 := SSF1 + ((RowSums[i] * RowSums[i]) / RowCount[i]);
RowsTotCnt := RowsTotCnt + RowCount[i];
end;
for j := 0 to NoGrpsB-1 do
begin
SSF2 := SSF2 + ((ColSums[j] * ColSums[j]) / ColCount[j]);
ColsTotCnt := ColsTotCnt + ColCount[j];
end;
for i := 0 to NoGrpsA-1 do
begin
for j := 0 to NoGrpsB-1 do
if counts[i,j] > 0 then
SSCells := SSCells + ((sums[i,j] * sums[i,j]) / counts[i,j]);
end;
if N > 0 then Constant := (MeanDep * MeanDep) / N else Constant := 0.0;
SSF1 := SSF1 - Constant;
SSF2 := SSF2 - Constant;
SSF1F2 := SSCells - SSF1 - SSF2 - Constant;
SSErr := SSDep - SSCells;
SSDep := SSDep - Constant;
if (SSF1F2 < 0) or (SSF1 < 0) or (SSF2 < 0) then
begin
ShowMessage('ERROR! A negative SS found. Unbalanced design? Ending analysis.');
CompError := true;
exit;
end;
DFTot := N - 1;
DFF1 := NoGrpsA - 1;
DFF2 := NoGrpsB - 1;
DFF1F2 := DFF1 * DFF2;
DFErr := DFTot - DFF1 - DFF2 - DFF1F2;
// DFCells := N - (NoGrpsA * NoGrpsB);
MSF1 := SSF1 / DFF1;
MSF2 := SSF2 / DFF2;
MSF1F2 := SSF1F2 / DFF1F2;
MSErr := SSErr / DFErr;
MSDep := SSDep / DFTot;
OmegaF1 := (SSF1 - DFF1 * MSErr) / (SSDep + MSErr);
OmegaF2 := (SSF2 - DFF2 * MSErr) / (SSDep + MSErr);
OmegaF1F2 := (SSF1F2 - DFF1F2 * MSErr) / (SSDep + MSErr);
Omega := OmegaF1 + OmegaF2 + OmegaF1F2;
MeanDep := MeanDep / N;
// f tests for fixed effects
FF1 := abs(MSF1 / MSErr);
FF2 := abs(MSF2 / MSErr);
FF1F2 := abs(MSF1F2 / MSErr);
ProbF1 := probf(FF1,DFF1,DFErr);
ProbF2 := probf(FF2,DFF2,DFErr);
ProbF1F2 := probf(FF1F2,DFF1F2,DFErr);
if (ProbF1 > 1.0) then ProbF1 := 1.0;
if (ProbF2 > 1.0) then ProbF2 := 1.0;
if (ProbF1F2 > 1.0) then ProbF1F2 := 1.0;
// Obtain omega squared (proportion of dependent variable explained)
if (OmegaF1 < 0.0) then OmegaF1 := 0.0;
if (OmegaF2 < 0.0) then OmegaF2 := 0.0;
if (OmegaF1F2 < 0.0) then OmegaF1F2 := 0.0;
if (Omega < 0.0) then Omega := 0.0;
end;
procedure TSRHTest.TwoWayTable(Sender: TObject);
var
groupsize : integer;
MinVar, MaxVar, sumvars, sumDFrecip : double;
i, j : integer;
XBar, V, S, RowSS, ColSS : double;
sumfreqlogvar, c, bartlett, cochran, hartley, chiprob : double;
H, HProb : double;
begin
If CompError then exit;
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Two Way Analysis of Variance');
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Variable analyzed: %s',[DepVar.Text]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Factor A (rows) variable: %s',[Factor1.Text]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Factor B (columns) variable: %s',[Factor2.Text]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('SOURCE D.F. SS MS F PROB.> F Omega Sqr. H H Prob.');
OutPutFrm.RichEdit.Lines.Add('');
H := SSF1 / MSDep;
HProb := 1.0 - chisquaredprob(H,round(DFF1));
outline := format('Among Rows %4.0f %8.3f %8.3f %8.3f %6.3f %6.3f %6.3f %6.3f',
[DFF1,SSF1,MSF1,FF1,ProbF1,OmegaF1, H, HProb]);
OutPutFrm.RichEdit.Lines.Add(outline);
H := SSF2 / MSDep;
HProb := 1.0 - chisquaredprob(H,round(DFF2));
outline := format('Among Columns %4.0f %8.3f %8.3f %8.3f %6.3f %6.3f %6.3f %6.3f',
[DFF2,SSF2,MSF2,FF2,ProbF2,OmegaF2,H , HProb]);
OutPutFrm.RichEdit.Lines.Add(outline);
H := SSF1F2 / MSDep;
HProb := 1.0 - chisquaredprob(H,round(DFF1F2));
outline := format('Interaction %4.0f %8.3f %8.3f %8.3f %6.3f %6.3f %6.3f %6.3f',
[DFF1F2,SSF1F2,MSF1F2,FF1F2,ProbF1F2,OmegaF1F2, H, HProb]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Within Groups %4.0f %8.3f %8.3f',
[DFErr,SSErr,MSErr]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Total %4.0f %8.3f %8.3f',
[DFTot,SSDep,MSDep]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Omega squared for combined effects = %8.3f',[Omega]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Descriptive Statistics');
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('GROUP Row Col. N MEAN VARIANCE STD.DEV.');
groupsize := round(counts[0,0]);
equal_grp := true;
MaxVar := 0.0;
MinVar := 1e20;
sumvars := 0.0;
sumfreqlogvar := 0.0;
sumDFrecip := 0.0;
// Display cell means, variances, standard deviations
V := 0.0;
XBar := 0.0;
S := 0.0;
for i := 0 to NoGrpsA-1 do
begin
for j := 0 to NoGrpsB-1 do
begin
if counts[i,j] > 1 then
begin
XBar := sums[i,j] / counts[i,j];
V := vars[i,j] - ( (sums[i,j] * sums[i,j]) / counts[i,j]);
V := V / (counts[i,j] - 1.0);
S := sqrt(V);
sumvars := sumvars + V;
if V > MaxVar then MaxVar := V;
if V < MinVar then MinVar := V;
sumDFrecip := sumDFrecip + (1.0 / (counts[i,j] - 1.0));
sumfreqlogvar := sumfreqlogvar + ((counts[i,j] - 1.0) * ln(V));
if counts[i,j] <> groupsize then equal_grp := false;
end;
outline := format('Cell %3d %3d %3.0f %8.3f %8.3f %8.3f',
[minf1+i,minf2+j,counts[i,j],XBar,V,S]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
//Display Row means, variances, standard deviations
for i := 0 to NoGrpsA-1 do
begin
XBar := RowSums[i] / RowCount[i];
OrdMeansA[i] := XBar;
RowSS := 0.0;
for j := 0 to NoGrpsB-1 do RowSS := RowSS + vars[i,j];
V := RowSS - (RowSums[i] * RowSums[i] / RowCount[i]);
V := V / (RowCount[i] - 1.0);
S := sqrt(V);
outline := format('Row %3d %3.0f %8.3f %8.3f %8.3f',
[minf1+i,RowCount[i],XBar,V,S]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
//Display means, variances and standard deviations for columns
for j := 0 to NoGrpsB-1 do
begin
XBar := ColSums[j] / ColCount[j];
OrdMeansB[j] := XBar;
ColSS := 0.0;
for i := 0 to NoGrpsA-1 do ColSS := ColSS + vars[i,j];
if ColCount[j] > 0 then V := ColSS - (ColSums[j] * ColSums[j] / ColCount[j]);
if ColCount[j] > 1 then V := V / (ColCount[j] - 1.0);
if V > 0.0 then S := sqrt(V);
outline := format('Col %3d %3.0f %8.3f %8.3f %8.3f',
[minf2+j,ColCount[j],XBar,V,S]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
outline := format('TOTAL %3d %8.3f %8.3f %8.3f',
[N,MeanDep,MSDep,sqrt(MSDep)]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('');
c := 1.0 + (1.0 / (3.0 * NoGrpsA * NoGrpsB - 1.0)) * (sumDFrecip - (1.0 / DFErr));
bartlett := (2.303 / c) * ((DFErr * ln(MSErr)) - sumfreqlogvar);
chiprob := 1.0 - chisquaredprob(bartlett,round(NoGrpsA * NoGrpsB - 1));
cochran := maxvar / sumvars;
hartley := maxvar / minvar;
OutPutFrm.RichEdit.Lines.Add('TESTS FOR HOMOGENEITY OF VARIANCE');
OutPutFrm.RichEdit.Lines.Add('---------------------------------------------------------------------');
outline := format('Hartley Fmax test statistic = %10.2f with deg.s freedom: %d and %d.',
[hartley, (NoGrpsA*NoGrpsB),(groupsize-1) ]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Cochran C statistic = %10.2f with deg.s freedom: %d and %d.',
[cochran, (NoGrpsA*NoGrpsB), (groupsize - 1)]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Bartlett Chi-square statistic = %10.2f with %4d D.F. Prob. larger value = %6.3f',
[bartlett, (NoGrpsA*NoGrpsB - 1), chiprob]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('---------------------------------------------------------------------');
end;
procedure TSRHTest.TwoWayPlot(Sender: TObject);
var
i, j : integer;
maxmean, XBar : double;
XValue : DblDyneVec;
title : string;
plottype : integer;
setstring : string[11];
begin
if CompError then exit;
SetLength(XValue,Nf1cells+Nf2cells);
plottype := 2;
if PlotMeans.Checked then plottype := 2;
if Plot2DLines.Checked then plottype := 5;
if Plot3DLines.Checked then plottype := 6;
// do Factor A first
setstring := 'FACTOR A';
GraphFrm.SetLabels[1] := setstring;
maxmean := 0.0;
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.AutoScale := 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.AutoScale := 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;
SetLength(GraphFrm.Ypoints,NF1cells,NF2cells);
SetLength(GraphFrm.Xpoints,1,NF2cells);
for i := 1 to NF1cells do
begin
setstring := Factor1.Text + ' ' + IntToStr(i);
GraphFrm.SetLabels[i] := setstring;
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.nbars := NF2cells;
GraphFrm.Heading := 'Factor A x Factor B';
title := Factor2.Text + ' Codes';
GraphFrm.XTitle := title;
GraphFrm.YTitle := 'Mean';
GraphFrm.barwideprop := 0.5;
GraphFrm.AutoScale := 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;
XValue := nil;
GraphFrm.Xpoints := nil;
GraphFrm.Ypoints := nil;
end;
initialization
{$I srhtestunit.lrs}
end.

View File

@ -0,0 +1,198 @@
object StemLeafFrm: TStemLeafFrm
Left = 163
Height = 298
Top = 108
Width = 525
Caption = 'Stem and Leaf Analysis'
ClientHeight = 298
ClientWidth = 525
OnShow = FormShow
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 8
Height = 16
Top = 8
Width = 102
Caption = 'Available Variables:'
ParentColor = False
end
object Label2: TLabel
Left = 232
Height = 16
Top = 8
Width = 98
Caption = 'Selected Variables:'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 233
Top = 24
Width = 161
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 185
Height = 32
Top = 24
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 185
Height = 32
Top = 56
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object AllBtn: TBitBtn
Left = 185
Height = 32
Top = 120
Width = 35
Caption = 'All'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 3
end
object SelectList: TListBox
Left = 232
Height = 230
Top = 27
Width = 168
ItemHeight = 0
TabOrder = 4
end
object ResetBtn: TButton
Left = 425
Height = 30
Top = 56
Width = 90
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object CancelBtn: TButton
Left = 425
Height = 30
Top = 104
Width = 90
Caption = 'Cancel'
ModalResult = 2
TabOrder = 6
end
object ComputeBtn: TButton
Left = 425
Height = 30
Top = 152
Width = 90
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 7
end
object ReturnBtn: TButton
Left = 425
Height = 30
Top = 200
Width = 90
Caption = 'Return'
ModalResult = 1
TabOrder = 8
end
object TestChk: TCheckBox
Left = 8
Height = 19
Top = 272
Width = 202
Caption = 'Show All Scaled Values and Srrings'
TabOrder = 9
end
object HelpBtn: TButton
Tag = 148
Left = 425
Height = 31
Top = 8
Width = 90
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 10
end
end

View File

@ -0,0 +1,132 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TStemLeafFrm','FORMDATA',[
'TPF0'#12'TStemLeafFrm'#11'StemLeafFrm'#4'Left'#3#163#0#6'Height'#3'*'#1#3'To'
+'p'#2'l'#5'Width'#3#13#2#7'Caption'#6#22'Stem and Leaf Analysis'#12'ClientHe'
+'ight'#3'*'#1#11'ClientWidth'#3#13#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#16#3'Top'#2#8#5'Wid'
+'th'#2'f'#7'Caption'#6#20'Available Variables:'#11'ParentColor'#8#0#0#6'TLab'
+'el'#6'Label2'#4'Left'#3#232#0#6'Height'#2#16#3'Top'#2#8#5'Width'#2'b'#7'Cap'
+'tion'#6#19'Selected Variables:'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'
+#4'Left'#2#8#6'Height'#3#233#0#3'Top'#2#24#5'Width'#3#161#0#10'ItemHeight'#2
+#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#185#0
+#6'Height'#2' '#3'Top'#2#24#5'Width'#2'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0
+'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4
+#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#1#0
+#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#185#0#6'Height'#2' '#3'Top'#2'8'#5'Width'#2
+'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0
+#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11
+'OutBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'AllBtn'#4'Left'#3#185#0#6'Hei'
+'ght'#2' '#3'Top'#2'x'#5'Width'#2'#'#7'Caption'#6#3'All'#9'NumGlyphs'#2#0#7
+'OnClick'#7#11'AllBtnClick'#8'TabOrder'#2#3#0#0#8'TListBox'#10'SelectList'#4
+'Left'#3#232#0#6'Height'#3#230#0#3'Top'#2#27#5'Width'#3#168#0#10'ItemHeight'
+#2#0#8'TabOrder'#2#4#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#169#1#6'Height'#2
+#30#3'Top'#2'8'#5'Width'#2'Z'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtn'
+'Click'#8'TabOrder'#2#5#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#169#1#6'Height'
+#2#30#3'Top'#2'h'#5'Width'#2'Z'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8
+'TabOrder'#2#6#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#169#1#6'Height'#2#30#3
+'Top'#3#152#0#5'Width'#2'Z'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeB'
+'tnClick'#8'TabOrder'#2#7#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#169#1#6'Heig'
+'ht'#2#30#3'Top'#3#200#0#5'Width'#2'Z'#7'Caption'#6#6'Return'#11'ModalResult'
+#2#1#8'TabOrder'#2#8#0#0#9'TCheckBox'#7'TestChk'#4'Left'#2#8#6'Height'#2#19#3
+'Top'#3#16#1#5'Width'#3#202#0#7'Caption'#6'"Show All Scaled Values and Srrin'
+'gs'#8'TabOrder'#2#9#0#0#7'TButton'#7'HelpBtn'#3'Tag'#3#148#0#4'Left'#3#169#1
+#6'Height'#2#31#3'Top'#2#8#5'Width'#2'Z'#7'Caption'#6#4'Help'#7'OnClick'#7#12
+'HelpBtnClick'#8'TabOrder'#2#10#0#0#0
]);

View File

@ -0,0 +1,373 @@
unit StemLeafUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, Globals, OutPutUnit, DataProcs,
DictionaryUnit, Math, Clipbrd, contexthelpunit;
type
{ TStemLeafFrm }
TStemLeafFrm = class(TForm)
HelpBtn: TButton;
InBtn: TBitBtn;
OutBtn: TBitBtn;
AllBtn: TBitBtn;
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
TestChk: TCheckBox;
Label1: TLabel;
Label2: TLabel;
VarList: TListBox;
SelectList: TListBox;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
StemLeafFrm: TStemLeafFrm;
implementation
{ TStemLeafFrm }
procedure TStemLeafFrm.ResetBtnClick(Sender: TObject);
var i : integer;
begin
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
SelectList.Clear;
InBtn.Visible := true;
OutBtn.Visible :=false;
AllBtn.Visible := true;
end;
procedure TStemLeafFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TStemLeafFrm.HelpBtnClick(Sender: TObject);
begin
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TStemLeafFrm.AllBtnClick(Sender: TObject);
VAR i : integer;
begin
for i := 0 to VarList.Items.Count-1 do
SelectList.Items.Add(VarList.Items.Strings[i]);
VarList.Clear;
OutBtn.Visible := true;
InBtn.Visible := false;
AllBtn.Visible := false;
end;
procedure TStemLeafFrm.ComputeBtnClick(Sender: TObject);
var
i, j, k, L, m, ncases, noselected, largest, smallest, howlong : integer;
minsize, maxsize, stem, minstem, maxstem, bin, index : integer;
leafvalue, counter, smallcount, testvalue, temp1, largestcount : integer;
cellstring, gridstring, outline, astring : string;
selected : IntDyneVec;
bins : IntDyneVec;
frequency : IntDyneVec;
ValueString : StrDyneVec;
values : DblDyneVec;
leafcount : IntDyneMat;
min, max, temp, X, stemsize : double;
begin
noselected := SelectList.Items.Count;
if (noselected = 0) then
begin
ShowMessage('ERROR! No variables were selected.');
exit;
end;
SetLength(selected,noselected);
SetLength(values,NoCases);
SetLength(bins,100);
SetLength(frequency,100);
SetLength(ValueString,NoCases);
SetLength(leafcount,100,10);
// Get selected variables
for i := 1 to noselected do
begin
cellstring := SelectList.Items.Strings[i-1];
for j := 1 to NoVariables do
if (cellstring = OS3MainFrm.DataGrid.Cells[j,0]) then selected[i-1] := j;
end;
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('STEM AND LEAF PLOTS');
OutPutFrm.RichEdit.Lines.Add('');
// Analyze each variable selected
for j := 0 to noselected - 1 do
begin
k := selected[j];
outline := format('Stem and Leaf Plot for variable: %s',[OS3MainFrm.DataGrid.Cells[k,0]]);
OutPutFrm.RichEdit.Lines.Add(outline);
ncases := 0;
min := 1.0e20;
max := -1.0e20;
minsize := 1000;
maxsize := -1000;
// Store values of the variable
for i := 1 to NoCases do
begin
if not ValidValue(i,k) then continue;
values[ncases] := StrToFloat(OS3MainFrm.DataGrid.Cells[k,i]);
ValueString[ncases] := Trim(OS3MainFrm.DataGrid.Cells[k,i]);
if (values[ncases] < min) then min := values[ncases];
if (values[ncases] > max) then max := values[ncases];
if Length(ValueString[ncases]) > maxsize then maxsize := Length(ValueString[ncases]);
if Length(ValueString[ncases]) < minsize then minsize := Length(ValueString[ncases]);
ncases := ncases + 1;
end;
largest := ceil(max);
smallest := ceil(min);
stemsize := 1.0;
if ((largest > 0) and (largest > 10)) then
begin
while (largest > 10)do
begin
largest := largest div 10;
stemsize := stemsize * 10.0;
end;
end
else if ((largest < 0) and (smallest < -10)) then // largest value is less than 0.0
begin
while (smallest < -10)do
begin
smallest := smallest * 10;
stemsize := stemsize / 10.0;
end;
end;
// rescale values by stemsize
for i := 0 to ncases - 1 do values[i] := values[i] / stemsize;
// multiply values by 10, round and save value divided by 10
for i := 0 to ncases - 1 do
begin
temp := floor(values[i] * 10);
temp := temp / 10.0;
values[i] := temp;
astring := format('%4.1f',[values[i]]);
ValueString[i] := astring;
end;
// get max and min stem values for creating bins for stem values
minstem := 999;
maxstem := -999;
for i := 0 to ncases - 1 do
begin
stem := floor(values[i]);
if (stem < minstem) then minstem := stem;
if (stem > maxstem) then maxstem := stem;
end;
// create arrays for stem and leaf plot
for i := 0 to 19 do frequency[i] := 0;
// sort values into ascending order
for i := 0 to ncases-2 do
begin
for k := i+1 to ncases - 1 do
begin
if (values[i] > values[k]) then // swap values
begin
X := values[i];
values[i] := values[k];
values[k] := X;
cellstring := ValueString[i];
ValueString[i] := ValueString[k];
ValueString[k] := cellstring;
end;
end;
end;
(*
// check sizes - delete if ok
outline := format('maxsize, minsize,stemsize: %10d %10d %10.2f',[maxsize, minsize, stemsize]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
*)
if (TestChk.Checked) then
begin // test output
OutPutFrm.RichEdit.Lines.Add('value ValueString');
for i := 0 to ncases - 1 do
begin
outline := format('%10.1f %s',[values[i],ValueString[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Frequency Stem & Leaf');
// initialize leaf count for the bins
for i := 0 to 99 do // bins
begin
for k := 0 to 9 do leafcount[i,k] := 0; // leafs 0 to 9
end;
// count leafs in each bin
for i := 0 to ncases - 1 do
begin
bin := floor(values[i]); // truncate to get stem value
bin := bin - minstem; // get the bin number between 0 and 100
if (bin < 100) and (bin >= 0) then
begin
bins[bin] := floor(values[i]);
frequency[bin] := frequency[bin] + 1; // count number of stem values
end
else
begin
ShowMessage('Error in bin value');
exit;
end;
// get leaf value
astring := ValueString[i];
index := Pos('.',astring);
leafvalue := StrToInt(astring[index+1]);
if (leafvalue < 10) and (leafvalue >= 0) then
leafcount[bin,leafvalue] := leafcount[bin,leafvalue] + 1
else
begin
ShowMessage('Error in leafvalue');
exit;
end;
end;
// get max leaf counters
largestcount := 0;
for i := 0 to 99 do // bin
begin
if frequency[i] = 0 then continue; // skip empty bins
counter := 0;
for k := 0 to 9 do // leaf counts
begin
counter := counter + leafcount[i,k];
end;
if counter > largestcount then largestcount := counter;
end;
// determine leaf depth needed to get counter <= 50
if (largestcount > 50) then
begin
smallcount := 2;
testvalue := largestcount;
while (testvalue > 50) do
begin
testvalue := largestcount div smallcount;
smallcount := smallcount + 1;
end;
smallcount := smallcount - 1; // leaf depth needed to reduce line lengths to 50 or less
end
else smallcount := 1;
// rescale leafs
for i := 0 to 99 do // bin
begin
for k := 0 to 9 do // leaf
leafcount[i,k] := leafcount[i,k] div smallcount;
end;
// plot results
for i := 0 to 99 do
begin
if frequency[i] = 0 then continue; // skip empty bins
begin
outline := format('%6d %3d ',[frequency[i],bins[i]]);
for k := 0 to 9 do
begin
if leafcount[i,k] = 0 then continue;
for L := 1 to leafcount[i,k] do
begin
outline := outline + format('%d',[k]);
end;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
end;
end;
// summarize values
OutPutFrm.RichEdit.Lines.Add('');
outline := format('Stem width := %5.2f, max. leaf depth := %2d',[stemsize,smallcount]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Min. value := %8.3f, Max. value := %8.3f',[min,max]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('No. of good cases := %d',[ncases]);
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
end; // next jth variable
OutPutFrm.ShowModal;
// clean up
frequency := nil;
bins := nil;
ValueString := nil;
values := nil;
selected := nil;
leafcount := nil;
end;
procedure TStemLeafFrm.InBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
SelectList.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
if VarList.Items.Count <= 0 then InBtn.Visible := false;
if SelectList.Items.Count > 0 then OutBtn.Visible := true;
end;
procedure TStemLeafFrm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := SelectList.ItemIndex;
if index > 0 then
begin
VarList.Items.Add(SelectList.Items.Strings[index]);
SelectList.Items.Delete(index);
end;
if SelectList.Items.Count = 0 then OutBtn.Visible := false;
if VarList.Items.Count > 0 then InBtn.Visible := true;
end;
initialization
{$I stemleafunit.lrs}
end.

View File

@ -0,0 +1,406 @@
object StepFwdFrm: TStepFwdFrm
Left = 149
Height = 394
Top = 101
Width = 558
Caption = 'Forward Stepwise Multiple Regression'
ClientHeight = 394
ClientWidth = 558
OnShow = FormShow
LCLVersion = '0.9.26.2'
object Label1: TLabel
Left = 6
Height = 14
Top = 3
Width = 90
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
Left = 194
Height = 14
Top = 4
Width = 119
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object Label3: TLabel
Left = 374
Height = 14
Top = 4
Width = 95
Caption = 'Dependent Variable'
ParentColor = False
end
object Label4: TLabel
Left = 336
Height = 14
Top = 97
Width = 140
Caption = 'Minimum Probability to Enter:'
ParentColor = False
end
object Label5: TLabel
Left = 335
Height = 14
Top = 128
Width = 145
Caption = 'Minimum Probability to Retain:'
ParentColor = False
end
object VarList: TListBox
Left = 6
Height = 243
Top = 22
Width = 140
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 154
Height = 29
Top = 24
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 154
Height = 29
Top = 56
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object AllBtn: TBitBtn
Left = 154
Height = 29
Top = 104
Width = 32
Caption = 'ALL'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 3
end
object ListBox1: TListBox
Left = 191
Height = 241
Top = 23
Width = 139
TabOrder = 4
end
object DepInBtn: TBitBtn
Left = 336
Height = 29
Top = 23
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = DepInBtnClick
TabOrder = 5
end
object DepOutBtn: TBitBtn
Left = 336
Height = 29
Top = 56
Width = 32
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = DepOutBtnClick
TabOrder = 6
end
object DepVar: TEdit
Left = 374
Height = 19
Top = 35
Width = 153
TabOrder = 7
Text = 'DepVar'
end
object InProb: TEdit
Left = 488
Height = 22
Top = 88
Width = 39
TabOrder = 8
Text = 'InProb'
end
object ProbOut: TEdit
Left = 488
Height = 22
Top = 120
Width = 39
TabOrder = 9
Text = 'Edit1'
end
object GroupBox1: TGroupBox
Left = 335
Height = 223
Top = 161
Width = 196
Caption = 'Options'
ClientHeight = 205
ClientWidth = 192
TabOrder = 10
object CPChkBox: TCheckBox
Left = 4
Height = 17
Top = 1
Width = 152
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 4
Height = 17
Top = 24
Width = 179
Caption = 'Show Variance-covariance Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 5
Height = 17
Top = 47
Width = 156
Caption = 'Show Intercorrelations Matrix'
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 5
Height = 17
Top = 70
Width = 82
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 5
Height = 17
Top = 92
Width = 97
Caption = 'Show Variances'
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 4
Height = 17
Top = 115
Width = 146
Caption = 'Show Standard Deviations'
TabOrder = 5
end
object MatInChkBox: TCheckBox
Left = 5
Height = 17
Top = 137
Width = 145
Caption = 'Get Data from a Matrix File'
TabOrder = 6
end
object MatSaveChkBox: TCheckBox
Left = 5
Height = 17
Top = 159
Width = 147
Caption = 'Save the Correlation Matrix'
TabOrder = 7
end
object PredictChkBox: TCheckBox
Left = 4
Height = 17
Top = 180
Width = 182
Caption = 'Predictions, residuals, C.I.''s to Grid'
TabOrder = 8
end
end
object ResetBtn: TButton
Left = 32
Height = 31
Top = 288
Width = 70
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 11
end
object ComputeBtn: TButton
Left = 32
Height = 31
Top = 344
Width = 70
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 12
end
object CancelBtn: TButton
Left = 224
Height = 31
Top = 288
Width = 70
Caption = 'Cancel'
ModalResult = 2
TabOrder = 13
end
object ReturnBtn: TButton
Left = 224
Height = 31
Top = 344
Width = 70
Caption = 'Return'
ModalResult = 1
TabOrder = 14
end
object OpenDialog1: TOpenDialog
left = 128
top = 288
end
object SaveDialog1: TSaveDialog
left = 127
top = 335
end
end

View File

@ -0,0 +1,263 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TStepFwdFrm','FORMDATA',[
'TPF0'#11'TStepFwdFrm'#10'StepFwdFrm'#4'Left'#3#149#0#6'Height'#3#138#1#3'Top'
+#2'e'#5'Width'#3'.'#2#7'Caption'#6'$Forward Stepwise Multiple Regression'#12
+'ClientHeight'#3#138#1#11'ClientWidth'#3'.'#2#6'OnShow'#7#8'FormShow'#10'LCL'
+'Version'#6#8'0.9.26.2'#0#6'TLabel'#6'Label1'#4'Left'#2#6#6'Height'#2#14#3'T'
+'op'#2#3#5'Width'#2'Z'#7'Caption'#6#19'Available Variables'#11'ParentColor'#8
+#0#0#6'TLabel'#6'Label2'#4'Left'#3#194#0#6'Height'#2#14#3'Top'#2#4#5'Width'#2
+'w'#7'Caption'#6#24'Variables to be Analyzed'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label3'#4'Left'#3'v'#1#6'Height'#2#14#3'Top'#2#4#5'Width'#2'_'#7'Caption'
+#6#18'Dependent Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3
+'P'#1#6'Height'#2#14#3'Top'#2'a'#5'Width'#3#140#0#7'Caption'#6#29'Minimum Pr'
+'obability to Enter:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#4'Left'#3'O'
+#1#6'Height'#2#14#3'Top'#3#128#0#5'Width'#3#145#0#7'Caption'#6#30'Minimum Pr'
+'obability to Retain:'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2
+#6#6'Height'#3#243#0#3'Top'#2#22#5'Width'#3#140#0#11'MultiSelect'#9#8'TabOrd'
+'er'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#154#0#6'Height'#2#29#3'Top'#2#24#5
+'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0
+'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0
+#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'
+#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190
+'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255
+'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139
+'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160
+#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255
+#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128
+#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199
+'t'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150
+#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255
+#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255
+#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255
+'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163
+'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247
+';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187
+'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnCl'
+'ick'#7#10'InBtnClick'#8'TabOrder'#2#1#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#154
+#0#6'Height'#2#29#3'Top'#2'8'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0
+#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0
+#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207
+'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'
+#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255
+#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'
+#255#255#255#255#0#255#255#255#0'h'#199't'#201''#204#138#255#162#216#171#255
+#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149
+#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'
+#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205
+#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'
+#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'
+#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'
+#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199
+'t'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'OutBtnClick'#8'TabOrder'#2#2#0#0
+#7'TBitBtn'#6'AllBtn'#4'Left'#3#154#0#6'Height'#2#29#3'Top'#2'h'#5'Width'#2
+' '#7'Caption'#6#3'ALL'#9'NumGlyphs'#2#0#7'OnClick'#7#11'AllBtnClick'#8'TabO'
+'rder'#2#3#0#0#8'TListBox'#8'ListBox1'#4'Left'#3#191#0#6'Height'#3#241#0#3'T'
+'op'#2#23#5'Width'#3#139#0#8'TabOrder'#2#4#0#0#7'TBitBtn'#8'DepInBtn'#4'Left'
+#3'P'#1#6'Height'#2#29#3'Top'#2#23#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0
+'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0
+#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255
+#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'
+#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'
+#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255
+#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211
+#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130
+#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'
+#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171
+#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204
+#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'
+#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255
+'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161
+'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#13'DepInBtnClick'#8'TabOr'
+'der'#2#5#0#0#7'TBitBtn'#9'DepOutBtn'#4'Left'#3'P'#1#6'Height'#2#29#3'Top'#2
+'8'#5'Width'#2' '#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0
+#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0
+#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153
+'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'
+#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255
+'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'
+#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195
+'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144
+#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255
+'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255
+#255#0'h'#199't'#201''#204#138#255#162#216#171#255#158#214#167#255#154#212
+#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133
+#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255
+#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135
+#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'
+#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255
+#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyp'
+'hs'#2#0#7'OnClick'#7#14'DepOutBtnClick'#8'TabOrder'#2#6#0#0#5'TEdit'#6'DepV'
+'ar'#4'Left'#3'v'#1#6'Height'#2#19#3'Top'#2'#'#5'Width'#3#153#0#8'TabOrder'#2
+#7#4'Text'#6#6'DepVar'#0#0#5'TEdit'#6'InProb'#4'Left'#3#232#1#6'Height'#2#22
+#3'Top'#2'X'#5'Width'#2''''#8'TabOrder'#2#8#4'Text'#6#6'InProb'#0#0#5'TEdit'
+#7'ProbOut'#4'Left'#3#232#1#6'Height'#2#22#3'Top'#2'x'#5'Width'#2''''#8'TabO'
+'rder'#2#9#4'Text'#6#5'Edit1'#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3'O'#1#6
+'Height'#3#223#0#3'Top'#3#161#0#5'Width'#3#196#0#7'Caption'#6#7'Options'#12
+'ClientHeight'#3#205#0#11'ClientWidth'#3#192#0#8'TabOrder'#2#10#0#9'TCheckBo'
+'x'#8'CPChkBox'#4'Left'#2#4#6'Height'#2#17#3'Top'#2#1#5'Width'#3#152#0#7'Cap'
+'tion'#6#26'Show Cross-Products Matrix'#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'C'
+'ovChkBox'#4'Left'#2#4#6'Height'#2#17#3'Top'#2#24#5'Width'#3#179#0#7'Caption'
+#6#31'Show Variance-covariance Matrix'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'C'
+'orrsChkBox'#4'Left'#2#5#6'Height'#2#17#3'Top'#2'/'#5'Width'#3#156#0#7'Capti'
+'on'#6#29'Show Intercorrelations Matrix'#8'TabOrder'#2#2#0#0#9'TCheckBox'#11
+'MeansChkBox'#4'Left'#2#5#6'Height'#2#17#3'Top'#2'F'#5'Width'#2'R'#7'Caption'
+#6#10'Show Means'#8'TabOrder'#2#3#0#0#9'TCheckBox'#9'VarChkBox'#4'Left'#2#5#6
+'Height'#2#17#3'Top'#2'\'#5'Width'#2'a'#7'Caption'#6#14'Show Variances'#8'Ta'
+'bOrder'#2#4#0#0#9'TCheckBox'#8'SDChkBox'#4'Left'#2#4#6'Height'#2#17#3'Top'#2
+'s'#5'Width'#3#146#0#7'Caption'#6#24'Show Standard Deviations'#8'TabOrder'#2
+#5#0#0#9'TCheckBox'#11'MatInChkBox'#4'Left'#2#5#6'Height'#2#17#3'Top'#3#137#0
+#5'Width'#3#145#0#7'Caption'#6#27'Get Data from a Matrix File'#8'TabOrder'#2
+#6#0#0#9'TCheckBox'#13'MatSaveChkBox'#4'Left'#2#5#6'Height'#2#17#3'Top'#3#159
+#0#5'Width'#3#147#0#7'Caption'#6#27'Save the Correlation Matrix'#8'TabOrder'
+#2#7#0#0#9'TCheckBox'#13'PredictChkBox'#4'Left'#2#4#6'Height'#2#17#3'Top'#3
+#180#0#5'Width'#3#182#0#7'Caption'#6'&Predictions, residuals, C.I.''s to Gri'
+'d'#8'TabOrder'#2#8#0#0#0#7'TButton'#8'ResetBtn'#4'Left'#2' '#6'Height'#2#31
+#3'Top'#3' '#1#5'Width'#2'F'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnC'
+'lick'#8'TabOrder'#2#11#0#0#7'TButton'#10'ComputeBtn'#4'Left'#2' '#6'Height'
+#2#31#3'Top'#3'X'#1#5'Width'#2'F'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'Co'
+'mputeBtnClick'#8'TabOrder'#2#12#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#224#0
+#6'Height'#2#31#3'Top'#3' '#1#5'Width'#2'F'#7'Caption'#6#6'Cancel'#11'ModalR'
+'esult'#2#2#8'TabOrder'#2#13#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#224#0#6'H'
+'eight'#2#31#3'Top'#3'X'#1#5'Width'#2'F'#7'Caption'#6#6'Return'#11'ModalResu'
,'lt'#2#1#8'TabOrder'#2#14#0#0#11'TOpenDialog'#11'OpenDialog1'#4'left'#3#128#0
+#3'top'#3' '#1#0#0#11'TSaveDialog'#11'SaveDialog1'#4'left'#2''#3'top'#3'O'#1
+#0#0#0
]);

View File

@ -0,0 +1,464 @@
unit StepFwdMRUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, Globals, MainUnit, MatrixLib, OutPutUnit,
FunctionsLib, DataProcs;
type
{ TStepFwdFrm }
TStepFwdFrm = class(TForm)
OpenDialog1: TOpenDialog;
ResetBtn: TButton;
ComputeBtn: TButton;
CancelBtn: TButton;
ReturnBtn: TButton;
PredictChkBox: TCheckBox;
MatSaveChkBox: TCheckBox;
MatInChkBox: TCheckBox;
SaveDialog1: TSaveDialog;
SDChkBox: TCheckBox;
VarChkBox: TCheckBox;
MeansChkBox: TCheckBox;
CorrsChkBox: TCheckBox;
CovChkBox: TCheckBox;
CPChkBox: TCheckBox;
GroupBox1: TGroupBox;
InProb: TEdit;
ProbOut: TEdit;
InBtn: TBitBtn;
Label4: TLabel;
Label5: TLabel;
OutBtn: TBitBtn;
AllBtn: TBitBtn;
DepInBtn: TBitBtn;
DepOutBtn: TBitBtn;
DepVar: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ListBox1: TListBox;
VarList: TListBox;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure DepInBtnClick(Sender: TObject);
procedure DepOutBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
StepFwdFrm: TStepFwdFrm;
implementation
{ TStepFwdFrm }
procedure TStepFwdFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
ListBox1.Clear;
for i := 1 to NoVariables do
begin
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
InBtn.Enabled := true;
OutBtn.Enabled := false;
DepInBtn.Enabled := true;
DepOutBtn.Enabled := false;
DepVar.Text := '';
InProb.Text := '0.05';
ProbOut.Text := '0.10';
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
end;
procedure TStepFwdFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TStepFwdFrm.AllBtnClick(Sender: TObject);
var count, index : integer;
begin
count := VarList.Items.Count;
for index := 0 to count-1 do
begin
ListBox1.Items.Add(VarList.Items.Strings[index]);
end;
VarList.Clear;
end;
procedure TStepFwdFrm.ComputeBtnClick(Sender: TObject);
Label CleanUp, lastone;
var
i, j, k, k1, col, NoVars, mattype, NCases,errcnt : integer;
errorcode : boolean;
Index, NoIndepVars : integer;
largest, R2, Constant, Beta, df1, df2, SSt, SSres, VarEst : double;
StdErrEst, F, FProbF, sum, B, SSx, StdErrB, NewR2, LargestPartial : double;
pdf1, pdf2, PartF, PartProb, LargestProb, POut : double;
SmallestProb : double;
BetaWeights : DblDyneVec;
cellstring, outline, valstring : string;
corrs : DblDyneMat;
Means : DblDyneVec;
Variances : DblDyneVec;
StdDevs : DblDyneVec;
ColNoSelected : IntDyneVec;
title : string;
RowLabels : StrDyneVec;
ColLabels : StrDyneVec;
IndRowLabels : StrDyneVec;
IndColLabels : StrDyneVec;
IndepCorrs : DblDyneMat;
IndepInverse : DblDyneMat;
IndepIndex : IntDyneVec;
XYCorrs : DblDyneVec;
matched : boolean;
Partial : DblDyneVec;
Candidate : IntDyneVec;
TempNoVars : Integer;
StepNo : integer;
filename : string;
begin
if NoVariables = 0 then NoVariables := 200;
SetLength(corrs,NoVariables+1,NoVariables+1);
SetLength(IndepCorrs,NoVariables,NoVariables);
SetLength(IndepInverse,NoVariables,NoVariables);
SetLength(Means,NoVariables);
SetLength(Variances,NoVariables);
SetLength(StdDevs,NoVariables);
SetLength(RowLabels,NoVariables);
SetLength(ColLabels,NoVariables);
SetLength(XYCorrs,NoVariables);
SetLength(IndepIndex,NoVariables);
SetLength(IndColLabels,NoVariables);
SetLength(IndRowLabels,NoVariables);
SetLength(BetaWeights,NoVariables);
SetLength(Partial,NoVariables);
SetLength(Candidate,NoVariables);
SetLength(ColNoSelected,NoVariables);
OutPutFrm.RichEdit.Clear;
// OutPutFrm.RichEdit.ParaGraph.Alignment := taLeftJustify;
OutPutFrm.RichEdit.Lines.Add('Stepwise Multiple Regression by Bill Miller');
StepNo := 1;
errcnt := 0;
errorcode := false;
if MatInChkBox.Checked = true then
begin
OpenDialog1.Filter := 'OS3 matrix files (*.MAT)|*.MAT|All files (*.*)|*.*';
OpenDialog1.FilterIndex := 1;
if OpenDialog1.Execute then
begin
filename := OpenDialog1.FileName;
MATREAD(Corrs,NoVars,NoVars,Means,StdDevs,NCases,RowLabels,ColLabels,filename);
for i := 0 to NoVars-1 do
begin
Variances[i] := sqr(StdDevs[i]);
ColNoSelected[i] := i+1;
end;
DepVar.Text := RowLabels[NoVars-1];
for i := 0 to NoVars-2 do ListBox1.Items.Add(RowLabels[i]);
ShowMessage('NOTICE! Last variable in matrix is the dependent variable');
end;
end;
if MatInChkBox.Checked = false then
begin
{ get independent item columns }
NoVars := ListBox1.Items.Count;
if NoVars < 1 then
begin
ShowMessage('ERROR! No independent variables selected.');
goto CleanUp;
end;
for i := 0 to NoVars-1 do
begin
cellstring := ListBox1.Items.Strings[i];
for j := 1 to NoVariables do
begin
if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then
begin
ColNoSelected[i] := j;
RowLabels[i] := cellstring;
ColLabels[i] := cellstring;
end;
end;
end;
{ get dependendent variable column }
if DepVar.Text = '' then
begin
ShowMessage('ERROR! No Dependent variable selected.');
goto CleanUp;
end;
NoVars := NoVars + 1;
for j := 1 to NoVariables do
begin
if DepVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then
begin
ColNoSelected[NoVars-1] := j;
RowLabels[NoVars-1] := DepVar.Text;
ColLabels[NoVars-1] := DepVar.Text;
end;
end;
if CPChkBox.Checked = true then
begin
title := 'Cross-Products Matrix';
GridXProd(NoVars,ColNoSelected,Corrs,errorcode,NCases);
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
if CovChkBox.Checked = true then
begin
title := 'Variance-Covariance Matrix';
GridCovar(NoVars,ColNoSelected,Corrs,Means,Variances,
StdDevs,errorcode,NCases);
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
Correlations(NoVars,ColNoSelected,Corrs,Means,Variances,
StdDevs,errorcode,NCases);
end;
if CorrsChkBox.Checked = true then
begin
title := 'Product-Moment Correlations Matrix';
MAT_PRINT(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases);
end;
if MatSaveChkBox.Checked = true then
begin
SaveDialog1.Filter := 'OS3 matrix files (*.MAT)|*.MAT|All files (*.*)|*.*';
SaveDialog1.FilterIndex := 1;
if SaveDialog1.Execute then
begin
filename := SaveDialog1.FileName;
MATSAVE(Corrs,NoVars,NoVars,Means,StdDevs,NCases,RowLabels,ColLabels,filename);
end;
end;
title := 'Means';
if MeansChkBox.Checked = true then
DynVectorPrint(Means,NoVars,title,ColLabels,NCases);
title := 'Variances';
if VarChkBox.Checked = true then
DynVectorPrint(Variances,NoVars,title,ColLabels,NCases);
title := 'Standard Deviations';
if SDChkBox.Checked = true then
DynVectorPrint(StdDevs,NoVars,title,ColLabels,NCases);
if errorcode then
begin
OutPutFrm.RichEdit.Lines.Add('One or more correlations could not be computed due to zero variance of a variable.');
end;
OutPutFrm.ShowModal;
if errorcode then
begin
ShowMessage('ERROR! A selected variable has no variability-run aborted.');
goto CleanUp;
end;
OutPutFrm.RichEdit.Clear;
OutPutFrm.RichEdit.Lines.Add('Stepwise Multiple Regression by Bill Miller');
{ Select largest correlation to begin. Note: dependent is last variable }
largest := 0.0;
Index := 1;
for i := 1 to NoVars - 1 do
begin
if abs(corrs[i-1,NoVars-1]) > largest then
begin
largest := abs(corrs[i-1,NoVars-1]);
Index := i;
end;
end;
NoIndepVars := 1;
IndepIndex[NoIndepVars-1] := Index;
POut := StrToFloat(ProbOut.Text);
OutPutFrm.RichEdit.Lines.Add('');
outline := format('----------------- STEP %d ------------------',[StepNo]);
OutPutFrm.RichEdit.Lines.Add(outline);
MReg2(NCases,NoVars,NoIndepVars,IndepIndex,corrs,IndepInverse,
RowLabels,R2,BetaWeights,
Means,Variances,errcnt,StdErrEst,constant,POut,true, true,false);
OutPutFrm.ShowModal;
while NoIndepVars < NoVars-1 do
begin
{ select the next independent variable based on the largest
semipartial correlation with the dependent variable. The
squared semipartial for each remaining independent variable
is the difference between the squared MC of the dependent
variable with all previously entered variables plus a candidate
variable and the squared MC with just the previously entered
variables ( the previously obtained R2 ). }
{ build list of candidates }
StepNo := StepNo + 1;
k := 0;
for i := 1 to NoVars - 1 do
begin
matched := false;
for j := 0 to NoIndepVars-1 do
begin
if IndepIndex[j] = i then matched := true;
end;
if (matched = false) then
begin
k := k + 1;
Candidate[k-1] := i;
end;
end; { k is the no. of candidates }
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Candidates for entry in next step.');
OutPutFrm.RichEdit.Lines.Add('Candidate Partial F Statistic Prob. DF1 DF2');
LargestProb := 0.0;
SmallestProb := 1.0;
for k1 := 1 to k do
begin
{ get Mult Corr. with previously entered plus candidate }
IndepIndex[NoIndepVars] := Candidate[k1-1];
TempNoVars := NoIndepVars + 1;
MReg2(NCases,NoVars,TempNoVars,IndepIndex,corrs,IndepInverse,
RowLabels,NewR2,BetaWeights, Means,Variances,
errcnt, StdErrEst, constant, POut, false, false,false);
Partial[k1-1] := (NewR2 - R2) / (1.0 - R2);
pdf1 := 1;
pdf2 := NCases - TempNoVars - 1;
PartF := ((NewR2 - R2) * pdf2) / (1.0 - NewR2);
PartProb := probf(PartF,pdf1,pdf2);
if PartProb < SmallestProb then SmallestProb := PartProb;
if PartProb > LargestProb then LargestProb := PartProb;
outline := format('%-10s %6.4f %7.4f %6.4f %3.0f %3.0f',
[RowLabels[Candidate[k1-1]-1], sqrt(abs(Partial[k1-1])), PartF, PartProb, pdf1, pdf2]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
if (SmallestProb > StrToFloat(InProb.Text)) then
begin
OutPutFrm.RichEdit.Lines.Add('No further steps meet criterion for entry.');
goto lastone;
end;
{ select variable with largest partial to enter next }
largestpartial := 0.0;
Index := 1;
for i := 1 to k do
begin
if Partial[i-1] > LargestPartial then
begin
Index := Candidate[i-1];
LargestPartial := Partial[i-1];
end;
end;
outline := format('Variable %s will be added',[RowLabels[Index-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
NoIndepVars := NoIndepVars + 1;
IndepIndex[NoIndepVars-1] := Index;
OutPutFrm.RichEdit.Lines.Add('');
outline := format('----------------- STEP %d ------------------',[StepNo]);
OutPutFrm.RichEdit.Lines.Add(outline);
MReg2(NCases,NoVars,NoIndepVars,IndepIndex,corrs,IndepInverse,
RowLabels,R2,BetaWeights, Means,Variances,
errcnt, StdErrEst, constant,POut,true,true,false);
if (errcnt > 0) or (NoIndepVars = NoVars-1) then { out tolerance exceeded - finish up }
lastone: begin
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('-------------FINAL STEP-----------');
MReg2(NCases,NoVars,NoIndepVars,IndepIndex,corrs,IndepInverse,
RowLabels,NewR2,BetaWeights,Means,Variances,
errcnt,StdErrEst,constant,POut,true,false,false);
k1 := NoIndepVars; { store temporarily }
NoIndepVars := NoVars; { this stops loop }
end;
end; { while not done }
OutPutFrm.ShowModal;
NoIndepVars := k1;
{ add [predicted scores, residual scores, etc. to grid if options elected }
if MatInChkBox.Checked = true then PredictChkBox.Checked := false;
if PredictChkBox.Checked = true then
Predict(ColNoSelected, NoVars, IndepInverse, Means, StdDevs,
BetaWeights, StdErrEst, IndepIndex, NoIndepVars);
CleanUp:
ColNoSelected := nil;
Candidate := nil;
Partial := nil;
BetaWeights := nil;
IndColLabels := nil;
IndRowLabels := nil;
IndepIndex := nil;
XYCorrs := nil;
ColLabels := nil;
RowLabels := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
IndepInverse := nil;
IndepCorrs := nil;
corrs := nil;
end;
procedure TStepFwdFrm.DepInBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ListBox1.ItemIndex;
DepVar.Text := ListBox1.Items.Strings[index];
ListBox1.Items.Delete(index);
DepOutBtn.Enabled := true;
DepInBtn.Enabled := false;
end;
procedure TStepFwdFrm.DepOutBtnClick(Sender: TObject);
begin
ListBox1.Items.Add(DepVar.Text);
DepVar.Text := '';
DepInBtn.Enabled := true;
end;
procedure TStepFwdFrm.InBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
ListBox1.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
OutBtn.Enabled := true;
end;
procedure TStepFwdFrm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ListBox1.ItemIndex;
VarList.Items.Add(ListBox1.Items.Strings[index]);
ListBox1.Items.Delete(index);
InBtn.Enabled := true;
end;
initialization
{$I stepfwdmrunit.lrs}
end.

View File

@ -0,0 +1,180 @@
object SuccIntFrm: TSuccIntFrm
Left = 162
Height = 332
Top = 103
Width = 383
Caption = 'Successive Interval Scaling'
ClientHeight = 332
ClientWidth = 383
OnShow = FormShow
LCLVersion = '0.9.30'
object Label1: TLabel
Left = 9
Height = 16
Top = 7
Width = 99
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
Left = 216
Height = 16
Top = 7
Width = 95
Caption = 'Selected Variables'
ParentColor = False
end
object VarList: TListBox
Left = 8
Height = 256
Top = 23
Width = 155
ItemHeight = 0
MultiSelect = True
TabOrder = 0
end
object InBtn: TBitBtn
Left = 169
Height = 33
Top = 23
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = InBtnClick
TabOrder = 1
end
object OutBtn: TBitBtn
Left = 169
Height = 33
Top = 64
Width = 35
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580
3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3
71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6
89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7
74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA
90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF
FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799
4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = OutBtnClick
TabOrder = 2
end
object AllBtn: TBitBtn
Left = 169
Height = 33
Top = 112
Width = 35
Caption = 'ALL'
NumGlyphs = 0
OnClick = AllBtnClick
TabOrder = 3
end
object ItemList: TListBox
Left = 212
Height = 257
Top = 24
Width = 154
ItemHeight = 0
TabOrder = 4
end
object ResetBtn: TButton
Left = 8
Height = 29
Top = 289
Width = 67
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object CancelBtn: TButton
Left = 96
Height = 29
Top = 289
Width = 67
Caption = 'Cancel'
ModalResult = 2
TabOrder = 6
end
object ComputeBtn: TButton
Left = 212
Height = 29
Top = 289
Width = 67
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 7
end
object ReturnBtn: TButton
Left = 299
Height = 29
Top = 289
Width = 67
Caption = 'Return'
ModalResult = 1
TabOrder = 8
end
end

View File

@ -0,0 +1,128 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSuccIntFrm','FORMDATA',[
'TPF0'#11'TSuccIntFrm'#10'SuccIntFrm'#4'Left'#3#162#0#6'Height'#3'L'#1#3'Top'
+#2'g'#5'Width'#3#127#1#7'Caption'#6#27'Successive Interval Scaling'#12'Clien'
+'tHeight'#3'L'#1#11'ClientWidth'#3#127#1#6'OnShow'#7#8'FormShow'#10'LCLVersi'
+'on'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2#16#3'Top'#2#7
+#5'Width'#2'c'#7'Caption'#6#19'Available Variables'#11'ParentColor'#8#0#0#6
+'TLabel'#6'Label2'#4'Left'#3#216#0#6'Height'#2#16#3'Top'#2#7#5'Width'#2'_'#7
+'Caption'#6#18'Selected Variables'#11'ParentColor'#8#0#0#8'TListBox'#7'VarLi'
+'st'#4'Left'#2#8#6'Height'#3#0#1#3'Top'#2#23#5'Width'#3#155#0#10'ItemHeight'
+#2#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#169
+#0#6'Height'#2'!'#3'Top'#2#23#5'Width'#2'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0
+#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0
+#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'
+#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'
+#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0#255#255#255#0
+#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255#152#211#161#255
+#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137
+#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255
+#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162#216#171#255#158
+#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255
+#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'J'#145'P'#255
+'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'
+#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'
+#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'InBtnClick'#8'TabOrder'#2#1#0
+#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#169#0#6'Height'#2'!'#3'Top'#2'@'#5'Width'#2
+'#'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0
+#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255'['#170'd'#255
+'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%'
+'i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195'q'#196'{'#200
+#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139
+#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'
+#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255#255#0'h'#199't'#201
+#127#204#138#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159
+#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197
+#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135#255']'#184'h'#255'X'
+#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'
+#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255#255#255#0#255#255#255
+#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
+#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
+#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11
+'OutBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'AllBtn'#4'Left'#3#169#0#6'Hei'
+'ght'#2'!'#3'Top'#2'p'#5'Width'#2'#'#7'Caption'#6#3'ALL'#9'NumGlyphs'#2#0#7
+'OnClick'#7#11'AllBtnClick'#8'TabOrder'#2#3#0#0#8'TListBox'#8'ItemList'#4'Le'
+'ft'#3#212#0#6'Height'#3#1#1#3'Top'#2#24#5'Width'#3#154#0#10'ItemHeight'#2#0
+#8'TabOrder'#2#4#0#0#7'TButton'#8'ResetBtn'#4'Left'#2#8#6'Height'#2#29#3'Top'
+#3'!'#1#5'Width'#2'C'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8
+'TabOrder'#2#5#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'`'#6'Height'#2#29#3'Top'
+#3'!'#1#5'Width'#2'C'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'
+#2#6#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#212#0#6'Height'#2#29#3'Top'#3'!'
+#1#5'Width'#2'C'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8
+'TabOrder'#2#7#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3'+'#1#6'Height'#2#29#3'T'
+'op'#3'!'#1#5'Width'#2'C'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOr'
+'der'#2#8#0#0#0
]);

View File

@ -0,0 +1,580 @@
unit SuccIntUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, MainUnit, OutPutUnit, FunctionsLib, Globals,
DataProcs, Math;
type
{ TSuccIntFrm }
TSuccIntFrm = class(TForm)
ResetBtn: TButton;
CancelBtn: TButton;
ComputeBtn: TButton;
ReturnBtn: TButton;
InBtn: TBitBtn;
OutBtn: TBitBtn;
AllBtn: TBitBtn;
Label1: TLabel;
Label2: TLabel;
ItemList: TListBox;
VarList: TListBox;
procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
SuccIntFrm: TSuccIntFrm;
implementation
{ TSuccIntFrm }
procedure TSuccIntFrm.ResetBtnClick(Sender: TObject);
VAR i : integer;
begin
VarList.Clear;
ItemList.Clear;
OutBtn.Visible := false;
InBtn.Visible := true;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TSuccIntFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TSuccIntFrm.AllBtnClick(Sender: TObject);
VAR i, count : integer;
begin
count := VarList.Items.Count;
for i := 1 to count do
ItemList.Items.Add(VarList.Items.Strings[i-1]);
InBtn.Visible := false;
OutBtn.Visible := true;
end;
procedure TSuccIntFrm.ComputeBtnClick(Sender: TObject);
var
i, j, k, col, X, NoSelected, MaxCat, count, subscript : integer;
discrow : integer;
CatCount : IntDyneVec;
ColNoSelected : IntDyneVec;
FreqMat : IntDyneMat;
RowTots : IntDyneVec;
PropMat, Zmatrix, WidthMat, TheorZMat, ThCumPMat, CumMat : DblDyneMat;
DiscDisp, Mean, StdDev, CumWidth, ScaleValue : DblDyneVec;
d1, d2, C1, L1, L2, t3, sum, discrep, z, prop, maxdiscrep : double;
RowLabels, ColLabels : StrDyneVec;
outline, astring : string;
Save_Cursor : TCursor;
found : boolean;
begin
MaxCat := 0;
L1 := 0.01;
L2 := 0.99;
maxdiscrep := 0.0;
// Allocate space
SetLength(DiscDisp,NoVariables);
SetLength(ScaleValue,NoVariables);
SetLength(RowLabels,NoVariables);
SetLength(ColNoSelected,NoVariables);
// Get items selected
NoSelected := ItemList.Items.Count;
for i := 1 to NoSelected do
begin
for j := 1 to NoVariables do
begin
outline := ItemList.Items.Strings[i-1];
if outline = OS3MainFrm.DataGrid.Cells[j,0] then ColNoSelected[i-1] := j;
end;
end;
(*
OutPutFrm.RichEdit.Lines.Add('check of parameters');
outline := format('No Selected = %3d',[NoSelected]);
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 1 to NoSelected do
begin
outline := format('ItemList %d = %s',[i-1,ItemList.Items.Strings[i-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Col. No. Selected %3d = %3d',[i-1,ColNoSelected[i-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.ShowModal;
OutPutFrm.RichEdit.Clear;
*)
//Find largest category value in data
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 > MaxCat) then MaxCat := X;
end;
end;
// Initialize arrays
SetLength(CatCount,MaxCat);
SetLength(FreqMat,NoVariables,MaxCat);
SetLength(RowTots,NoVariables);
SetLength(PropMat,NoVariables,MaxCat);
SetLength(Zmatrix,NoVariables,MaxCat);
SetLength(WidthMat,NoVariables,MaxCat);
SetLength(TheorZMat,NoVariables,MaxCat);
SetLength(ThCumPMat,NoVariables,MaxCat);
SetLength(CumMat,NoVariables,MaxCat);
SetLength(Mean,MaxCat);
SetLength(StdDev,MaxCat);
SetLength(CumWidth,MaxCat);
SetLength(ColLabels,MaxCat);
for i := 0 to NoSelected-1 do
begin
RowTots[i] := 0;
DiscDisp[i] := 0.0;
ScaleValue[i] := 0.0;
for j := 0 to MaxCat-1 do
begin
FreqMat[i,j] := 0;
PropMat[i,j] := 0.0;
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
FreqMat[j-1,X-1] := FreqMat[j-1,X-1] + 1;
end;
end;
// Get row totals of the frequency matrix
for i := 0 to NoSelected-1 do
begin
RowTots[i] := 0;
for j := 0 to MaxCat-1 do
begin
RowTots[i] := RowTots[i] + FreqMat[i,j];
end;
end;
// Convert frequencies to proportions of the row totals
for i := 0 to NoSelected-1 do
for j := 0 to MaxCat-1 do
PropMat[i,j] := FreqMat[i,j] / RowTots[i];
// Accumulate the proportions accross the categories
for i := 1 to NoSelected do
begin
CumMat[i-1,0] := PropMat[i-1,0];
for j := 2 to MaxCat do
begin
CumMat[i-1,j-1] := CumMat[i-1,j-2] + PropMat[i-1,j-1];
if (j = MaxCat) then CumMat[i-1,j-1] := 1.0;
end;
end;
// Convert cumulative proportions to z scores
for i := 0 to NoSelected-1 do
begin
for j := 0 to MaxCat-1 do
begin
if (CumMat[i,j] < L1) then Zmatrix[i,j] := 99.0; //flag -infinity
if (CumMat[i,j] > L2) then Zmatrix[i,j] := 99.0; //flag +infinity
if ((CumMat[i,j] >= L1) and (CumMat[i,j] <= L2)) then
Zmatrix[i,j] := inversez(CumMat[i,j]);
end;
end;
// Obtain discriminal dispersions of the items
t3 := 0.0;
for i := 1 to NoSelected do
begin
d1 := 0.0;
d2 := 0.0;
C1 := 0.0;
for j := 1 to MaxCat - 1 do
begin
if (Zmatrix[i-1,j-1] <> 99.0) then
begin
d1 := d1 + Zmatrix[i-1,j-1];
d2 := d2 + (Zmatrix[i-1,j-1] * Zmatrix[i-1,j-1]);
C1 := C1 + 1.0;
end;
end;
if (C1 > 1) then
begin
DiscDisp[i-1] := d2 - ((d1 * d1) / C1);
DiscDisp[i-1] := DiscDisp[i-1] / (C1-1.0);
DiscDisp[i-1] := sqrt(DiscDisp[i-1]);
end
else DiscDisp[i-1] := 99.0;
if ((DiscDisp[i-1] > 0) and (DiscDisp[i-1] <> 99.0))then t3 := t3 + (1.0 / DiscDisp[i-1]);
end;
//Constant t3 =No. items / recipricols of std.dev.s of item z scores
t3 := NoSelected / t3;
for i := 0 to NoSelected-1 do
begin
if ((DiscDisp[i] > 0.0) and (t3 > 0)) then
DiscDisp[i] := (1.0 / DiscDisp[i]) * t3
else DiscDisp[i] := 99.0;
end;
// Now, calculate interval widths
for j := 2 to MaxCat - 1 do
begin
for i := 1 to NoSelected do
begin
if ((Zmatrix[i-1,j-1] <> 99.0) and (Zmatrix[i-1,j-2] <> 99.0)) then
WidthMat[i-1,j-2] := Zmatrix[i-1,j-1] - Zmatrix[i-1,j-2]
else WidthMat[i-1,j-2] := 99.0;
end;
end;
//Calculate Means and Standard Deviations of category Widths
for j := 1 to MaxCat-2 do
begin
for i := 1 to NoSelected do
begin
if (WidthMat[i-1,j-1] <> 99.0) then
begin
CatCount[j-1] := CatCount[j-1] + 1;
Mean[j-1] := Mean[j-1] + WidthMat[i-1,j-1];
StdDev[j-1] := StdDev[j-1] + (WidthMat[i-1,j-1] * WidthMat[i-1,j-1]);
end;
end;
if (CatCount[j-1] > 1) then
begin
Mean[j-1] := Mean[j-1] / CatCount[j-1];
StdDev[j-1] := (StdDev[j-1] / CatCount[j-1]) - (Mean[j-1] * Mean[j-1]);
StdDev[j-1] := StdDev[j-1] * (CatCount[j-1] / (CatCount[j-1] - 1));
end;
end;
// Calculate cumulative widths
CumWidth[0] := Mean[0];
for j := 2 to MaxCat - 1 do
CumWidth[j-1] := CumWidth[j-2] + Mean[j-1];
// Calculate scale item scale values
for i := 1 to NoSelected do
begin
found := false;
count := 1;
while (not found) do
begin
if (CumMat[i-1,count-1] >= 0.5) then
begin
found := true;
subscript := count;
end;
if (count = (MaxCat)) then
begin
found := true;
subscript := count;
end;
count := count + 1;
end;
if ((subscript > 2) and (subscript < MaxCat)) then
begin
ScaleValue[i-1] := Mean[subscript-2] * ((0.5 - CumMat[i-1,subscript-2])
/ PropMat[i-1,subscript-1]);
if (subscript > 1) then ScaleValue[i-1] := ScaleValue[i-1] +
CumWidth[subscript-3];
end
else
begin //extreme value - get average of z scores in first cat. and / 2
sum := 0.0;
for k := 1 to NoSelected do sum := sum + Zmatrix[i-1,0];
sum := sum / abs(NoSelected * 2);
ScaleValue[i-1] := sum * ((0.5 - (CumMat[i-1,0] / 2.0)) / (CumMat[i-1,0] / 2.0));
end;
end;
//Calculate Theoretical z scores from the scale values
discrep := 0.0;
count := 0;
for i := 1 to NoSelected do
begin
z := -ScaleValue[i-1];
TheorZMat[i-1,0] := z;
prop := probz(z);
ThCumPMat[i-1,0] := prop;
for j := 2 to MaxCat - 1 do
begin
z := CumWidth[j-2] - ScaleValue[i-1];
if (z < -3) then z := -3.0;
if (z > 3) then z := 3.0;
prop := probz(z);
TheorZMat[i-1,j-1] := z;
ThCumPMat[i-1,j-1] := prop;
discrep := discrep + abs(CumMat[i-1,j-1] - prop);
if abs(CumMat[i-1,j-1] - prop) > maxdiscrep then
begin
maxdiscrep := abs(CumMat[i-1,j-1] - prop);
discrow := i;
end;
count := count + 1;
end;
ThCumPMat[i-1,MaxCat-1] := 1.0;
end;
discrep := discrep / count; // average discrepency between theoretical and observed
// Report results
for i := 1 to NoSelected do
RowLabels[i-1] := OS3MainFrm.DataGrid.Cells[ColNoSelected[i-1],0];
for i := 1 to MaxCat do
begin
outline := format(' %2d-%2d ',[i-1,i]);
ColLabels[i-1] := outline;
end;
OutPutFrm.RichEdit.Lines.Add(' SUCCESSIVE INTERVAL SCALING RESULTS');
OutPutFrm.RichEdit.Lines.Add('');
outline := ' ';
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 1 to NoSelected do
begin
outline := format('%10s',[RowLabels[i-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Frequency ';
for j := 1 to MaxCat do
begin
astring := format('%7d',[FreqMat[i-1,j-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Proportion ';
for j := 1 to MaxCat do
begin
astring := format('%7.3f',[PropMat[i-1,j-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Cum. Prop. ';
for j := 1 to MaxCat do
begin
astring := format('%7.3f',[CumMat[i-1,j-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Normal z ';
for j := 1 to MaxCat do
begin
if (Zmatrix[i-1,j-1] <> 99.0) then
begin
astring := format('%7.3f',[Zmatrix[i-1,j-1]]);
outline := outline + astring;
end
else outline := outline + ' - ';
end;
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add(' INTERVAL WIDTHS');
outline := ' ';
for i := 1 to MaxCat - 2 do
begin
astring := format(' %2d-%2d ',[i+1,i]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := '';
for i := 1 to NoSelected do
begin
astring := format('%10s',[RowLabels[i-1]]);
outline := outline + astring;
for j := 1 to MaxCat-2 do
begin
if (WidthMat[i-1,j-1] <> 99.0) then
begin
astring := format('%7.3f',[WidthMat[i-1,j-1]]);
outline := outline + astring;
end
else outline := outline + ' - ';
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := '';
end;
OutPutFrm.RichEdit.Lines.Add('');
outline := 'Mean Width';
for i := 1 to MaxCat - 2 do
begin
astring := format('%7.2f',[Mean[i-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'No. Items ';
for i := 1 to MaxCat - 2 do
begin
astring := format('%7d',[CatCount[i-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Std. Dev.s';
for i := 1 to MaxCat - 2 do
begin
astring := format('%7.2f',[StdDev[i-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := 'Cum. Means';
for i := 1 to MaxCat - 2 do
begin
astring := format('%7.2f',[CumWidth[i-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('ESTIMATES OF SCALE VALUES AND THEIR DISPERSIONS');
OutPutFrm.RichEdit.Lines.Add('Item No. Ratings Scale Value Discriminal Dispersion');
for i := 0 to NoSelected-1 do
begin
outline := format('%10s %3d %6.3f %6.3f',
[RowLabels[i],RowTots[i],ScaleValue[i],DiscDisp[i]]);
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Z scores Estimated from Scale values');
outline := ' ';
for i := 0 to MaxCat-1 do outline := outline + ColLabels[i];
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 1 to NoSelected do
begin
outline := format('%10s',[RowLabels[i-1]]);
for j := 1 to MaxCat - 1 do
begin
astring := format('%7.3f',[TheorZMat[i-1,j-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
OutPutFrm.RichEdit.Lines.Add('Cumulative Theoretical Proportions');
outline := ' ';
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
OutPutFrm.RichEdit.Lines.Add(outline);
for i := 1 to NoSelected do
begin
outline := format('%10s',[RowLabels[i-1]]);
for j := 1 to MaxCat do
begin
astring := format('%7.3f',[ThCumPMat[i-1,j-1]]);
outline := outline + astring;
end;
OutPutFrm.RichEdit.Lines.Add(outline);
end;
OutPutFrm.RichEdit.Lines.Add('');
outline := 'Average Discrepency Between Theoretical and Observed Cumulative Proportions = ';
astring := format('%6.3f',[discrep]);
outline := outline + astring;
OutPutFrm.RichEdit.Lines.Add(outline);
outline := format('Maximum discrepency = %6.3f found in item %s',
[maxdiscrep,RowLabels[discrow-1]]);
OutPutFrm.RichEdit.Lines.Add(outline);
Screen.Cursor := Save_Cursor;
OutPutFrm.ShowModal;
// Clean up heap
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;
procedure TSuccIntFrm.InBtnClick(Sender: TObject);
VAR i, index : integer;
begin
index := VarList.Items.Count;
i := 0;
while i < index do
begin
if (VarList.Selected[i]) then
begin
ItemList.Items.Add(VarList.Items.Strings[i]);
VarList.Items.Delete(i);
index := index - 1;
i := 0;
end
else i := i + 1;
end;
OutBtn.Visible := true;
end;
procedure TSuccIntFrm.OutBtnClick(Sender: TObject);
VAR index : integer;
begin
index := ItemList.ItemIndex;
if index < 0 then
begin
OutBtn.Visible := false;
exit;
end;
VarList.Items.Add(ItemList.Items.Strings[index]);
ItemList.Items.Delete(index);
end;
initialization
{$I succintunit.lrs}
end.

View File

@ -0,0 +1,128 @@
object SumYrsDepFrm: TSumYrsDepFrm
Left = 159
Height = 176
Top = 115
Width = 348
Caption = 'Sum of Years Depreciation'
ClientHeight = 176
ClientWidth = 348
OnShow = FormShow
LCLVersion = '0.9.28.2'
object Label1: TLabel
Left = 8
Height = 14
Top = 16
Width = 59
Caption = 'Initial Cost: '
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 14
Top = 48
Width = 136
Caption = 'Salvage value at end of life:'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 14
Top = 80
Width = 171
Caption = 'Number of Periods of life Expected:'
ParentColor = False
end
object Label4: TLabel
Left = 8
Height = 14
Top = 112
Width = 134
Caption = 'Period for the Depreciation:'
ParentColor = False
end
object Label5: TLabel
Left = 8
Height = 14
Top = 144
Width = 163
Caption = 'Depreciation Allowance (Answer):'
ParentColor = False
end
object CostEdit: TEdit
Left = 184
Height = 21
Top = 9
Width = 56
TabOrder = 0
Text = 'CostEdit'
end
object SalvageEdit: TEdit
Left = 184
Height = 21
Top = 41
Width = 56
TabOrder = 1
Text = 'Edit1'
end
object LifeEdit: TEdit
Left = 184
Height = 21
Top = 73
Width = 56
TabOrder = 2
Text = 'Edit1'
end
object PeriodEdit: TEdit
Left = 184
Height = 21
Top = 105
Width = 56
TabOrder = 3
Text = 'Edit1'
end
object DepreciationEdit: TEdit
Left = 184
Height = 21
Top = 137
Width = 56
TabOrder = 4
Text = 'Edit1'
end
object ResetBtn: TButton
Left = 256
Height = 29
Top = 48
Width = 78
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object ComputeBtn: TButton
Left = 256
Height = 29
Top = 88
Width = 78
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 6
end
object ReturnBtn: TButton
Left = 256
Height = 29
Top = 129
Width = 78
Caption = 'Return'
ModalResult = 1
TabOrder = 7
end
object HelpBtn: TButton
Tag = 149
Left = 256
Height = 29
Top = 8
Width = 78
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 8
end
end

Some files were not shown because too many files have changed in this diff Show More