You've already forked lazarus-ccr
LazStats: Inherit HyperGeoUnit from BasicStatsReportFormUnit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7889 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1342,7 +1342,7 @@ procedure TOS3MainFrm.mnuSimHyperGeomProbClick(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
if HyperGeoForm = nil then
|
if HyperGeoForm = nil then
|
||||||
Application.CreateForm(THyperGeoForm, HyperGeoForm);
|
Application.CreateForm(THyperGeoForm, HyperGeoForm);
|
||||||
HyperGeoForm.ShowModal;
|
HyperGeoForm.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Simulations" > "z for a given cum. Probability"
|
// Menu "Simulations" > "z for a given cum. Probability"
|
||||||
|
@ -1,276 +1,303 @@
|
|||||||
object HyperGeoForm: THyperGeoForm
|
inherited HyperGeoForm: THyperGeoForm
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 303
|
Left = 303
|
||||||
Height = 310
|
Height = 310
|
||||||
Top = 156
|
Top = 156
|
||||||
Width = 339
|
Width = 693
|
||||||
Anchors = [akTop]
|
Anchors = [akTop]
|
||||||
AutoSize = True
|
|
||||||
BorderStyle = bsSingle
|
|
||||||
Caption = 'Hypergeometric Probabilities'
|
Caption = 'Hypergeometric Probabilities'
|
||||||
ClientHeight = 310
|
ClientHeight = 310
|
||||||
ClientWidth = 339
|
ClientWidth = 693
|
||||||
OnActivate = FormActivate
|
inherited ParamsPanel: TPanel
|
||||||
OnCreate = FormCreate
|
Height = 294
|
||||||
OnShow = ResetBtnClick
|
ClientHeight = 294
|
||||||
Position = poMainFormCenter
|
inherited CloseBtn: TButton
|
||||||
LCLVersion = '2.1.0.0'
|
Top = 269
|
||||||
object Label1: TLabel
|
TabOrder = 12
|
||||||
|
end
|
||||||
|
inherited ComputeBtn: TButton
|
||||||
|
Top = 269
|
||||||
|
TabOrder = 11
|
||||||
|
end
|
||||||
|
inherited ResetBtn: TButton
|
||||||
|
Top = 269
|
||||||
|
TabOrder = 10
|
||||||
|
end
|
||||||
|
inherited HelpBtn: TButton
|
||||||
|
Top = 269
|
||||||
|
TabOrder = 9
|
||||||
|
end
|
||||||
|
inherited ButtonBevel: TBevel
|
||||||
|
Top = 253
|
||||||
|
end
|
||||||
|
object SampSizeLabel: TLabel[5]
|
||||||
AnchorSideTop.Control = SampSizeEdit
|
AnchorSideTop.Control = SampSizeEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 134
|
Left = 116
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 12
|
Top = 4
|
||||||
Width = 68
|
Width = 68
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Sample Size: '
|
Caption = 'Sample Size: '
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object SampObsLabel: TLabel[6]
|
||||||
AnchorSideTop.Control = SampObsEdit
|
AnchorSideTop.Control = SampObsEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 50
|
Left = 32
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 39
|
Top = 31
|
||||||
Width = 152
|
Width = 152
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Number observed in sample:'
|
Caption = 'Number observed in sample:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object PopObsLabel: TLabel[7]
|
||||||
AnchorSideTop.Control = PopObsEdit
|
AnchorSideTop.Control = PopObsEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 118
|
Left = 12
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 93
|
Top = 85
|
||||||
Width = 84
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
Caption = 'Population Size:'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object Label4: TLabel
|
|
||||||
AnchorSideTop.Control = PopSizeEdit
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = Label8
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 30
|
|
||||||
Height = 15
|
|
||||||
Top = 66
|
|
||||||
Width = 172
|
Width = 172
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Number observed in population:'
|
Caption = 'Number observed in population:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label5: TLabel
|
object PopSizeLabel: TLabel[8]
|
||||||
|
AnchorSideTop.Control = PopSizeEdit
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = Label8
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 103
|
||||||
|
Height = 15
|
||||||
|
Top = 58
|
||||||
|
Width = 81
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Population Size'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object SampSizeEdit: TEdit[9]
|
||||||
|
AnchorSideLeft.Control = ProbGEEdit
|
||||||
|
AnchorSideTop.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 0
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'SampSizeEdit'
|
||||||
|
end
|
||||||
|
object SampObsEdit: TEdit[10]
|
||||||
|
AnchorSideLeft.Control = SampSizeEdit
|
||||||
|
AnchorSideTop.Control = SampSizeEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 27
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
TabOrder = 1
|
||||||
|
Text = 'SampObsEdit'
|
||||||
|
end
|
||||||
|
object PopSizeEdit: TEdit[11]
|
||||||
|
AnchorSideLeft.Control = SampSizeEdit
|
||||||
|
AnchorSideTop.Control = SampObsEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 54
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
TabOrder = 2
|
||||||
|
Text = 'PopSizeEdit'
|
||||||
|
end
|
||||||
|
object PopObsEdit: TEdit[12]
|
||||||
|
AnchorSideLeft.Control = SampSizeEdit
|
||||||
|
AnchorSideTop.Control = PopSizeEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 81
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
TabOrder = 3
|
||||||
|
Text = 'PopObsEdit'
|
||||||
|
end
|
||||||
|
object Label5: TLabel[13]
|
||||||
AnchorSideTop.Control = ProbXEdit
|
AnchorSideTop.Control = ProbXEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 118
|
Left = 100
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 132
|
Top = 124
|
||||||
Width = 84
|
Width = 84
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Probability of X:'
|
Caption = 'Probability of X:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label6: TLabel
|
object Label6: TLabel[14]
|
||||||
AnchorSideTop.Control = ProbGTEdit
|
AnchorSideTop.Control = ProbGTEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 65
|
Left = 47
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 159
|
Top = 151
|
||||||
Width = 137
|
Width = 137
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Probability greater than X:'
|
Caption = 'Probability greater than X:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label7: TLabel
|
object Label7: TLabel[15]
|
||||||
AnchorSideTop.Control = ProbLEEdit
|
AnchorSideTop.Control = ProbLEEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 50
|
Left = 32
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 186
|
Top = 178
|
||||||
Width = 152
|
Width = 152
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Probability less or equal to X:'
|
Caption = 'Probability less or equal to X:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label8: TLabel
|
object Label8: TLabel[16]
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = ProbGEEdit
|
AnchorSideTop.Control = ProbGEEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 32
|
AnchorSideRight.Control = ProbGEEdit
|
||||||
|
Left = 14
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 213
|
Top = 205
|
||||||
Width = 170
|
Width = 170
|
||||||
BorderSpacing.Left = 32
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Left = 16
|
||||||
Caption = 'Probability greater or equal to X:'
|
Caption = 'Probability greater or equal to X:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label9: TLabel
|
object Label9: TLabel[17]
|
||||||
AnchorSideTop.Control = ProbLTEdit
|
AnchorSideTop.Control = ProbLTEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label8
|
AnchorSideRight.Control = Label8
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 83
|
Left = 65
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 240
|
Top = 232
|
||||||
Width = 119
|
Width = 119
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Probability less than X:'
|
Caption = 'Probability less than X:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object ResetBtn: TButton
|
object ProbXEdit: TEdit[18]
|
||||||
AnchorSideTop.Control = ReturnBtn
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
Left = 65
|
|
||||||
Height = 25
|
|
||||||
Top = 276
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 16
|
|
||||||
BorderSpacing.Right = 12
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object ComputeBtn: TButton
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideLeft.Side = asrCenter
|
|
||||||
AnchorSideTop.Control = ReturnBtn
|
|
||||||
Left = 131
|
|
||||||
Height = 25
|
|
||||||
Top = 276
|
|
||||||
Width = 76
|
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Compute'
|
|
||||||
OnClick = ComputeBtnClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object ReturnBtn: TButton
|
|
||||||
AnchorSideLeft.Control = ComputeBtn
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = Bevel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 219
|
|
||||||
Height = 25
|
|
||||||
Top = 276
|
|
||||||
Width = 61
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 12
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 16
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Return'
|
|
||||||
ModalResult = 1
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object SampSizeEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = ProbGEEdit
|
|
||||||
AnchorSideTop.Control = Owner
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 8
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
TabOrder = 3
|
|
||||||
Text = 'SampSizeEdit'
|
|
||||||
end
|
|
||||||
object SampObsEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = SampSizeEdit
|
|
||||||
AnchorSideTop.Control = SampSizeEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 35
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
TabOrder = 4
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object PopSizeEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = SampSizeEdit
|
|
||||||
AnchorSideTop.Control = SampObsEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 62
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
TabOrder = 5
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object PopObsEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = SampSizeEdit
|
|
||||||
AnchorSideTop.Control = PopSizeEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 89
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
TabOrder = 6
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object ProbXEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = SampSizeEdit
|
AnchorSideLeft.Control = SampSizeEdit
|
||||||
AnchorSideTop.Control = PopObsEdit
|
AnchorSideTop.Control = PopObsEdit
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = ProbLEEdit
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 210
|
Left = 192
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 128
|
Top = 120
|
||||||
Width = 82
|
Width = 99
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 16
|
||||||
Font.Style = [fsBold]
|
Font.Style = [fsBold]
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 7
|
TabOrder = 4
|
||||||
Text = 'Edit1'
|
Text = 'ProbXEdit'
|
||||||
end
|
end
|
||||||
object ProbGTEdit: TEdit
|
object ProbGTEdit: TEdit[19]
|
||||||
AnchorSideLeft.Control = SampSizeEdit
|
AnchorSideLeft.Control = SampSizeEdit
|
||||||
AnchorSideTop.Control = ProbXEdit
|
AnchorSideTop.Control = ProbXEdit
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 210
|
Left = 192
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 155
|
Top = 147
|
||||||
Width = 82
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentFont = False
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 5
|
||||||
|
Text = 'ProbGTEdit'
|
||||||
|
end
|
||||||
|
object ProbLEEdit: TEdit[20]
|
||||||
|
AnchorSideLeft.Control = ProbGEEdit
|
||||||
|
AnchorSideTop.Control = ProbGTEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 174
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentFont = False
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 6
|
||||||
|
Text = 'ProbLEEdit'
|
||||||
|
end
|
||||||
|
object ProbGEEdit: TEdit[21]
|
||||||
|
AnchorSideLeft.Control = Label8
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = ProbLEEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 201
|
||||||
|
Width = 99
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentFont = False
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 7
|
||||||
|
Text = 'ProbGEEdit'
|
||||||
|
end
|
||||||
|
object ProbLTEdit: TEdit[22]
|
||||||
|
AnchorSideLeft.Control = ProbGEEdit
|
||||||
|
AnchorSideTop.Control = ProbGEEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 192
|
||||||
|
Height = 23
|
||||||
|
Top = 228
|
||||||
|
Width = 99
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
@ -278,78 +305,10 @@ object HyperGeoForm: THyperGeoForm
|
|||||||
ParentFont = False
|
ParentFont = False
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
Text = 'Edit1'
|
Text = 'ProbLTEdit'
|
||||||
end
|
end
|
||||||
object ProbLEEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = ProbGEEdit
|
|
||||||
AnchorSideTop.Control = ProbGTEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 182
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
Font.Style = [fsBold]
|
|
||||||
ParentFont = False
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 9
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
end
|
||||||
object ProbGEEdit: TEdit
|
inherited ParamsSplitter: TSplitter
|
||||||
AnchorSideLeft.Control = Label8
|
Height = 310
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = ProbLEEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = SampSizeEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 209
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
BorderSpacing.Right = 32
|
|
||||||
Font.Style = [fsBold]
|
|
||||||
ParentFont = False
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 10
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object ProbLTEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = ProbGEEdit
|
|
||||||
AnchorSideTop.Control = ProbGEEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = ProbGEEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 210
|
|
||||||
Height = 23
|
|
||||||
Top = 236
|
|
||||||
Width = 82
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
Font.Style = [fsBold]
|
|
||||||
ParentFont = False
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 11
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object Bevel1: TBevel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = ProbLTEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 0
|
|
||||||
Height = 9
|
|
||||||
Top = 259
|
|
||||||
Width = 339
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,19 +5,14 @@ unit HyperGeoUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, ExtCtrls,
|
||||||
StdCtrls, ExtCtrls,
|
FunctionsLib, BasicStatsReportFormUnit;
|
||||||
FunctionsLib, OutputUnit;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ THyperGeoForm }
|
{ THyperGeoForm }
|
||||||
|
|
||||||
THyperGeoForm = class(TForm)
|
THyperGeoForm = class(TBasicStatsReportForm)
|
||||||
Bevel1: TBevel;
|
|
||||||
ResetBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
ReturnBtn: TButton;
|
|
||||||
SampSizeEdit: TEdit;
|
SampSizeEdit: TEdit;
|
||||||
SampObsEdit: TEdit;
|
SampObsEdit: TEdit;
|
||||||
PopSizeEdit: TEdit;
|
PopSizeEdit: TEdit;
|
||||||
@ -27,39 +22,157 @@ type
|
|||||||
ProbLEEdit: TEdit;
|
ProbLEEdit: TEdit;
|
||||||
ProbGEEdit: TEdit;
|
ProbGEEdit: TEdit;
|
||||||
ProbLTEdit: TEdit;
|
ProbLTEdit: TEdit;
|
||||||
Label1: TLabel;
|
SampSizeLabel: TLabel;
|
||||||
Label2: TLabel;
|
SampObsLabel: TLabel;
|
||||||
Label3: TLabel;
|
PopObsLabel: TLabel;
|
||||||
Label4: TLabel;
|
PopSizeLabel: TLabel;
|
||||||
Label5: TLabel;
|
Label5: TLabel;
|
||||||
Label6: TLabel;
|
Label6: TLabel;
|
||||||
Label7: TLabel;
|
Label7: TLabel;
|
||||||
Label8: TLabel;
|
Label8: TLabel;
|
||||||
Label9: TLabel;
|
Label9: TLabel;
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
|
||||||
procedure FormActivate(Sender: TObject);
|
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
|
||||||
procedure FisherTable(A,B,C,D, p, SumP : double);
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
|
procedure FisherTable(A,B,C,D, p, SumP: double; AReport: TStrings);
|
||||||
|
|
||||||
|
protected
|
||||||
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
|
||||||
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
procedure Reset; override;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
HyperGeoForm: THyperGeoForm;
|
HyperGeoForm: THyperGeoForm;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math;
|
||||||
|
|
||||||
|
|
||||||
{ THyperGeoForm }
|
{ THyperGeoForm }
|
||||||
|
|
||||||
procedure THyperGeoForm.ResetBtnClick(Sender: TObject);
|
procedure THyperGeoForm.AdjustConstraints;
|
||||||
begin
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
ParamsPanel.Constraints.MinHeight := ProbLTEdit.Top + ProbLTEdit.Height +
|
||||||
|
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||||
|
ParamsPanel.Constraints.MinWidth := Max(
|
||||||
|
Max(PopSizeLabel.Width, Label8.Width) + Label8.BorderSpacing.Left + ProbGEEdit.BorderSpacing.Left + ProbGEEdit.Width,
|
||||||
|
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left
|
||||||
|
);;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure THyperGeoForm.Compute;
|
||||||
|
var
|
||||||
|
SampObs, PopObs, SampSize, PopSize: double;
|
||||||
|
A, B, C, D, APlusB, CPlusD: double;
|
||||||
|
ProbX, Prob, SumProb, ProbGE, ProbGT, ProbLT, ProbLE: double;
|
||||||
|
done: boolean;
|
||||||
|
lReport: TStrings;
|
||||||
|
begin
|
||||||
|
lReport := TStringList.Create;
|
||||||
|
try
|
||||||
|
lReport.Add('HYPERGEOMETRIC DISTRIBUTION CALCULATIONS');
|
||||||
|
lReport.Add('Accumulating Values of the distribution');
|
||||||
|
lReport.Add('');
|
||||||
|
|
||||||
|
label5.Enabled := true;
|
||||||
|
label6.Enabled := true;
|
||||||
|
label7.Enabled := true;
|
||||||
|
label8.Enabled := true;
|
||||||
|
label9.Enabled := true;
|
||||||
|
ProbXEdit.Enabled := true;
|
||||||
|
ProbGEEdit.Enabled := true;
|
||||||
|
ProbLTEdit.Enabled := true;
|
||||||
|
ProbLEEdit.Enabled := true;
|
||||||
|
ProbGTEdit.Enabled := true;
|
||||||
|
|
||||||
|
SampObs := StrToFloat(SampObsEdit.Text);
|
||||||
|
PopObs := StrToFloat(PopObsEdit.Text);
|
||||||
|
SampSize := StrToFloat(SampSizeEdit.Text);
|
||||||
|
PopSize := StrToFloat(PopSizeEdit.Text);
|
||||||
|
|
||||||
|
done := false;
|
||||||
|
SumProb := 0.0;
|
||||||
|
|
||||||
|
A := SampObs;
|
||||||
|
B := SampSize - A;
|
||||||
|
C := PopObs;
|
||||||
|
D := PopSize - C;
|
||||||
|
APlusB := A + B;
|
||||||
|
CPlusD := C + D;
|
||||||
|
|
||||||
|
ProbX := combos(A,C) * combos(B,D) / combos(APlusB,CPlusD);
|
||||||
|
ProbXEdit.Text := Format('%.4f', [ProbX]);
|
||||||
|
SumProb := SumProb + ProbX;
|
||||||
|
FisherTable(A,B,C,D,ProbX,SumProb, lReport);
|
||||||
|
|
||||||
|
// get more extreme probabilities
|
||||||
|
while not done do
|
||||||
|
begin
|
||||||
|
if A = APlusB then
|
||||||
|
done := true
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
A := A + 1;
|
||||||
|
B := B - 1;
|
||||||
|
if (A < 0) or (B < 0) or (C < 0) or (D < 0) then done := true;
|
||||||
|
end;
|
||||||
|
if not done then
|
||||||
|
begin
|
||||||
|
Prob := combos(A,C) * combos(B,D) / combos(APlusB,CPlusD);
|
||||||
|
SumProb := SumProb + Prob;
|
||||||
|
FisherTable(A,B,C,D,Prob,SumProb, lReport);
|
||||||
|
lReport.Add('');
|
||||||
|
end;
|
||||||
|
end; // end while not done
|
||||||
|
|
||||||
|
ProbGE := SumProb;
|
||||||
|
ProbGT := SumProb - ProbX;
|
||||||
|
ProbLT := 1.0 - ProbGE;
|
||||||
|
ProbLE := ProbLT + ProbX;
|
||||||
|
ProbGEEdit.Text := Format('%.4f', [ProbGE]);
|
||||||
|
ProbLEEdit.Text := Format('%.4f', [ProbLE]);
|
||||||
|
ProbGTEdit.Text := Format('%.4f', [ProbGT]);
|
||||||
|
ProbLTEdit.Text := Format('%.4f', [ProbLT]);
|
||||||
|
|
||||||
|
FReportFrame.DisplayReport(lReport);
|
||||||
|
finally
|
||||||
|
lReport.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure THyperGeoForm.FisherTable(A,B,C,D, p, SumP: double; AReport: TStrings);
|
||||||
|
begin
|
||||||
|
AReport.Add('Table for Hypergeometric Probabilities');
|
||||||
|
AReport.Add('----------------------------------');
|
||||||
|
AReport.Add(' Row Column ');
|
||||||
|
AReport.Add(' 1 2 ');
|
||||||
|
AReport.Add(' --- ---------- -----------');
|
||||||
|
AReport.Add(' 1 %8.0f %8.0f', [A, B]);
|
||||||
|
AReport.Add(' 2 %8.0f %8.0f', [C, D]);
|
||||||
|
AReport.Add('----------------------------------');
|
||||||
|
AReport.Add('Probability: %8.4f', [p]);
|
||||||
|
AReport.Add('Cumulative Probability: %8.4f', [SumP]);
|
||||||
|
AReport.Add('');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure THyperGeoForm.Reset;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
SampSizeEdit.Text := '';
|
SampSizeEdit.Text := '';
|
||||||
SampObsEdit.Text := '';
|
SampObsEdit.Text := '';
|
||||||
PopSizeEdit.Text := '';
|
PopSizeEdit.Text := '';
|
||||||
@ -81,122 +194,43 @@ begin
|
|||||||
ProbGTEdit.Enabled := false;
|
ProbGTEdit.Enabled := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THyperGeoForm.ComputeBtnClick(Sender: TObject);
|
|
||||||
VAR
|
|
||||||
SampObs, PopObs, SampSize, PopSize, N : double;
|
|
||||||
A, B, C, D, APlusC, BPlusD, APlusB, CPlusD : double;
|
|
||||||
ProbX, Prob, SumProb, ProbGE, ProbGT, ProbLT, ProbLE : double;
|
|
||||||
done : boolean;
|
|
||||||
outvalue : string;
|
|
||||||
begin
|
|
||||||
done := false;
|
|
||||||
SumProb := 0.0;
|
|
||||||
label5.Enabled := true;
|
|
||||||
label6.Enabled := true;
|
|
||||||
label7.Enabled := true;
|
|
||||||
label8.Enabled := true;
|
|
||||||
label9.Enabled := true;
|
|
||||||
ProbXEdit.Enabled := true;
|
|
||||||
ProbGEEdit.Enabled := true;
|
|
||||||
ProbLTEdit.Enabled := true;
|
|
||||||
ProbLEEdit.Enabled := true;
|
|
||||||
ProbGTEdit.Enabled := true;
|
|
||||||
SampObs := StrToFloat(SampObsEdit.Text);
|
|
||||||
PopObs := StrToFloat(PopObsEdit.Text);
|
|
||||||
SampSize := StrToFloat(SampSizeEdit.Text);
|
|
||||||
PopSize := StrToFloat(PopSizeEdit.Text);
|
|
||||||
A := SampObs;
|
|
||||||
B := SampSize - A;
|
|
||||||
C := PopObs;
|
|
||||||
D := PopSize - C;
|
|
||||||
APlusC := A + C;
|
|
||||||
BPlusD := B + D;
|
|
||||||
APlusB := A + B;
|
|
||||||
CPlusD := C + D;
|
|
||||||
N := A + B + C + D;
|
|
||||||
|
|
||||||
// largest := 1;
|
function THyperGeoForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||||
OutputFrm.RichEdit.Clear;
|
|
||||||
OutputFrm.RichEdit.Lines.Add('Hypergeometric Distribution Calculations');
|
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
OutputFrm.RichEdit.Lines.Add('Accumulating Values of the distribution');
|
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
ProbX := combos(A,C) * combos(B,D) / combos(APlusB,CPlusD);
|
|
||||||
outvalue := format('%6.4f',[ProbX]);
|
|
||||||
ProbXEdit.Text := outvalue;
|
|
||||||
SumProb := SumProb + ProbX;
|
|
||||||
FisherTable(A,B,C,D,ProbX,SumProb);
|
|
||||||
|
|
||||||
// get more extreme probabilities
|
|
||||||
while not done do
|
|
||||||
begin
|
|
||||||
if A = APlusB then done := true
|
|
||||||
else begin
|
|
||||||
A := A + 1;
|
|
||||||
B := B - 1;
|
|
||||||
if (A < 0) or (B < 0) or (C < 0) or (D < 0) then done := true;
|
|
||||||
end;
|
|
||||||
if not done then
|
|
||||||
begin
|
|
||||||
Prob := combos(A,C) * combos(B,D) / combos(APlusB,CPlusD);
|
|
||||||
SumProb := SumProb + Prob;
|
|
||||||
FisherTable(A,B,C,D,Prob,SumProb);
|
|
||||||
end;
|
|
||||||
end; // end while not done
|
|
||||||
OutputFrm.ShowModal;
|
|
||||||
ProbGE := SumProb;
|
|
||||||
ProbGT := SumProb - ProbX;
|
|
||||||
ProbLT := 1.0 - ProbGE;
|
|
||||||
ProbLE := ProbLT + ProbX;
|
|
||||||
outvalue := format('%6.4f',[ProbGE]);
|
|
||||||
ProbGEEdit.Text := outvalue;
|
|
||||||
outvalue := format('%6.4f',[ProbLE]);
|
|
||||||
ProbLEEdit.Text := outvalue;
|
|
||||||
outvalue := format('%6.4f',[ProbGT]);
|
|
||||||
ProbGTEdit.Text := outvalue;
|
|
||||||
outvalue := format('%6.4f',[ProbLT]);
|
|
||||||
ProbLTEdit.Text := outvalue;
|
|
||||||
OutputFrm.RichEdit.Clear;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure THyperGeoForm.FisherTable(A,B,C,D, p, SumP : double);
|
|
||||||
VAR
|
|
||||||
outline : string;
|
|
||||||
begin
|
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
OutputFrm.RichEdit.Lines.Add('Table for Hypergeometric Probabilities');
|
|
||||||
OutputFrm.RichEdit.Lines.Add(' Column');
|
|
||||||
OutputFrm.RichEdit.Lines.Add('Row 1 2');
|
|
||||||
outline := format(' 1 %10.0f %10.0f',[A,B]);
|
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
|
||||||
outline := format(' 2 %10.0f %10.0f',[C,D]);
|
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
|
||||||
outline := format('Probability = %6.4f',[p]);
|
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
outline := format('Cumulative Probability = %6.4f',[SumP]);
|
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
|
||||||
OutputFrm.RichEdit.Lines.Add('');
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure THyperGeoForm.FormActivate(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
w: Integer;
|
n: Integer;
|
||||||
begin
|
begin
|
||||||
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
Result := false;
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
|
||||||
ComputeBtn.Constraints.MinWidth := w;
|
|
||||||
ReturnBtn.Constraints.MinWidth := w;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure THyperGeoForm.FormCreate(Sender: TObject);
|
if (SampSizeEdit.Text = '') or not TryStrToInt(SampSizeEdit.Text, n) or (n <= 0) then
|
||||||
begin
|
begin
|
||||||
if OutputFrm = nil then
|
AMsg := 'Valid positive integer number required.';
|
||||||
Application.CreateForm(TOutputFrm, OutputFrm);
|
AControl := SampSizeEdit;
|
||||||
end;
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
if (SampObsEdit.Text = '') or not TryStrToInt(SampObsEdit.Text, n) or (n <= 0) then
|
||||||
{$I hypergeounit.lrs}
|
begin
|
||||||
|
AMsg := 'Valid positive integer number required.';
|
||||||
|
AControl := SampObsEdit;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (PopSizeEdit.Text = '') or not TryStrToInt(PopSizeEdit.Text, n) or (n <= 0) then
|
||||||
|
begin
|
||||||
|
AMsg := 'Valid positive integer number required.';
|
||||||
|
AControl := PopSizeEdit;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (PopObsEdit.Text = '') or not TryStrToInt(PopObsEdit.Text, n) or (n <= 0) then
|
||||||
|
begin
|
||||||
|
AMsg := 'Valid positive integer number required.';
|
||||||
|
AControl := PopObsEdit;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := true;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user