You've already forked lazarus-ccr
LazStats: Inherit RunsTestUnit from TBasicStatsReportForm. Replace output edit controls by a report memo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7816 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -66,3 +66,4 @@ correlation, means, standard deviations and confidence interval for each correla
|
||||
162=This procedure plots the frequency of cases in each of the groups in a group variable. The group variable should be defined as an integer variable.\n\nSelect the variable and type of plot and click the Compute button for the results.
|
||||
163=The Resistant Line procedure creates three equal groups by sorting on the X variable and obtaining the median value of each group.\n\nThe 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 to which the data fit a straight line. Enter the X and Y variables to be analyzed and click the compute button.
|
||||
164=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.
|
||||
165=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.
|
||||
|
@ -1177,7 +1177,7 @@
|
||||
<Unit134>
|
||||
<Filename Value="forms\analysis\nonparametric\runstestunit.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="runstestform"/>
|
||||
<ComponentName Value="RunsTestForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="RunsTestUnit"/>
|
||||
|
@ -1,456 +1,142 @@
|
||||
object runstestform: Trunstestform
|
||||
Left = 1138
|
||||
Height = 438
|
||||
Top = 277
|
||||
Width = 376
|
||||
inherited RunsTestForm: TRunsTestForm
|
||||
Left = 660
|
||||
Height = 355
|
||||
Top = 233
|
||||
Width = 748
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'html/RunsTestforNormality.htm'
|
||||
AutoSize = True
|
||||
Caption = 'Test for Randomness'
|
||||
ClientHeight = 438
|
||||
ClientWidth = 376
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnShow = ResetBtnClick
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Memo1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 54
|
||||
Width = 100
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 16
|
||||
Caption = 'Available Variables:'
|
||||
ParentColor = False
|
||||
ClientHeight = 355
|
||||
ClientWidth = 748
|
||||
inherited ParamsPanel: TPanel
|
||||
Height = 339
|
||||
Width = 297
|
||||
ClientHeight = 339
|
||||
ClientWidth = 297
|
||||
inherited CloseBtn: TButton
|
||||
Left = 242
|
||||
Top = 314
|
||||
TabOrder = 7
|
||||
end
|
||||
inherited ComputeBtn: TButton
|
||||
Left = 158
|
||||
Top = 314
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited ResetBtn: TButton
|
||||
Left = 96
|
||||
Top = 314
|
||||
TabOrder = 5
|
||||
end
|
||||
inherited HelpBtn: TButton
|
||||
Tag = 165
|
||||
Left = 37
|
||||
Top = 314
|
||||
TabOrder = 4
|
||||
end
|
||||
inherited ButtonBevel: TBevel
|
||||
Top = 298
|
||||
Width = 297
|
||||
end
|
||||
object Label1: TLabel[5]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 97
|
||||
Caption = 'Available Variables'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel[6]
|
||||
AnchorSideLeft.Control = TestVarEdit
|
||||
AnchorSideBottom.Control = TestVarEdit
|
||||
Left = 167
|
||||
Height = 15
|
||||
Top = 21
|
||||
Width = 105
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Test Randomness of'
|
||||
ParentColor = False
|
||||
end
|
||||
object VarList: TListBox[7]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = InBtn
|
||||
AnchorSideBottom.Control = ButtonBevel
|
||||
Left = 0
|
||||
Height = 281
|
||||
Top = 17
|
||||
Width = 129
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 6
|
||||
ItemHeight = 0
|
||||
MultiSelect = True
|
||||
OnDblClick = VarListDblClick
|
||||
OnSelectionChange = VarListSelectionChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object InBtn: TBitBtn[8]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = VarList
|
||||
Left = 135
|
||||
Height = 26
|
||||
Top = 17
|
||||
Width = 26
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = InBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 1
|
||||
end
|
||||
object OutBtn: TBitBtn[9]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = InBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 135
|
||||
Height = 26
|
||||
Top = 47
|
||||
Width = 26
|
||||
BorderSpacing.Top = 4
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = OutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 2
|
||||
end
|
||||
object TestVarEdit: TEdit[10]
|
||||
AnchorSideLeft.Control = InBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = OutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 167
|
||||
Height = 23
|
||||
Top = 38
|
||||
Width = 130
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 3
|
||||
Text = 'TestVarEdit'
|
||||
end
|
||||
end
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = TestVarEdit
|
||||
AnchorSideBottom.Control = TestVarEdit
|
||||
Left = 210
|
||||
Height = 15
|
||||
Top = 79
|
||||
Width = 108
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Test Randomness of:'
|
||||
ParentColor = False
|
||||
inherited ParamsSplitter: TSplitter
|
||||
Left = 309
|
||||
Height = 355
|
||||
end
|
||||
object VarList: TListBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = InBtn
|
||||
AnchorSideBottom.Control = ProbEdit
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 287
|
||||
Top = 71
|
||||
Width = 158
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
ItemHeight = 0
|
||||
MultiSelect = True
|
||||
OnSelectionChange = VarListSelectionChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object InBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = VarList
|
||||
Left = 174
|
||||
Height = 28
|
||||
Top = 71
|
||||
Width = 28
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = InBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 1
|
||||
end
|
||||
object OutBtn: TBitBtn
|
||||
AnchorSideLeft.Control = InBtn
|
||||
AnchorSideTop.Control = InBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 174
|
||||
Height = 28
|
||||
Top = 103
|
||||
Width = 28
|
||||
BorderSpacing.Top = 4
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = OutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 2
|
||||
end
|
||||
object TestVarEdit: TEdit
|
||||
AnchorSideLeft.Control = InBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = OutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 210
|
||||
Height = 23
|
||||
Top = 96
|
||||
Width = 158
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 3
|
||||
Text = 'TestVarEdit'
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideTop.Control = MeanEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = MeanEdit
|
||||
Left = 244
|
||||
Height = 15
|
||||
Top = 177
|
||||
Width = 33
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Mean:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideLeft.Control = InBtn
|
||||
AnchorSideTop.Control = StdDevEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = StdDevEdit
|
||||
Left = 174
|
||||
Height = 15
|
||||
Top = 204
|
||||
Width = 103
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Standard Deviation:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label5: TLabel
|
||||
AnchorSideTop.Control = NUpEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NUpEdit
|
||||
Left = 185
|
||||
Height = 15
|
||||
Top = 231
|
||||
Width = 92
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'N Values > Mean:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label6: TLabel
|
||||
AnchorSideTop.Control = NDownEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NDownEdit
|
||||
Left = 185
|
||||
Height = 15
|
||||
Top = 258
|
||||
Width = 92
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'N Values < Mean:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label7: TLabel
|
||||
AnchorSideTop.Control = NRunsEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NRunsEdit
|
||||
Left = 187
|
||||
Height = 15
|
||||
Top = 285
|
||||
Width = 90
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Number of Runs:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label8: TLabel
|
||||
AnchorSideTop.Control = StatEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = StatEdit
|
||||
Left = 210
|
||||
Height = 15
|
||||
Top = 312
|
||||
Width = 67
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Test Statistic:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label9: TLabel
|
||||
AnchorSideTop.Control = ProbEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ProbEdit
|
||||
Left = 217
|
||||
Height = 15
|
||||
Top = 339
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Probability:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label10: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = ConclusionEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 370
|
||||
Width = 63
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Conclusion:'
|
||||
ParentColor = False
|
||||
end
|
||||
object MeanEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = StdDevEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 173
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 4
|
||||
Text = 'MeanEdit'
|
||||
end
|
||||
object StdDevEdit: TEdit
|
||||
AnchorSideLeft.Control = Label4
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = NUpEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 200
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 5
|
||||
Text = 'StdDevEdit'
|
||||
end
|
||||
object NUpEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = NDownEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 227
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 6
|
||||
Text = 'NUpEdit'
|
||||
end
|
||||
object NDownEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = NRunsEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 254
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 7
|
||||
Text = 'NDownEdit'
|
||||
end
|
||||
object NRunsEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = StatEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 281
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 8
|
||||
Text = 'NRunsEdit'
|
||||
end
|
||||
object StatEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideRight.Control = StdDevEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ProbEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 308
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Bottom = 4
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 9
|
||||
Text = 'StatEdit'
|
||||
end
|
||||
object ProbEdit: TEdit
|
||||
AnchorSideLeft.Control = StdDevEdit
|
||||
AnchorSideRight.Control = StdDevEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ConclusionEdit
|
||||
Left = 285
|
||||
Height = 23
|
||||
Top = 335
|
||||
Width = 83
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Bottom = 8
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 10
|
||||
Text = 'ProbEdit'
|
||||
end
|
||||
object ConclusionEdit: TEdit
|
||||
AnchorSideLeft.Control = Label10
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Bevel1
|
||||
Left = 79
|
||||
Height = 23
|
||||
Top = 366
|
||||
Width = 289
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 11
|
||||
Text = 'ConclusionEdit'
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 167
|
||||
Height = 25
|
||||
Top = 405
|
||||
Width = 54
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 12
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 229
|
||||
Height = 25
|
||||
Top = 405
|
||||
Width = 76
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 13
|
||||
end
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 313
|
||||
Height = 25
|
||||
Top = 405
|
||||
Width = 55
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 14
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = CloseBtn
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 389
|
||||
Width = 376
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
object Bevel2: TBevel[2]
|
||||
Left = 3
|
||||
Height = 21
|
||||
Top = 414
|
||||
Width = 15
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Memo1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 30
|
||||
Top = 8
|
||||
Width = 360
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = '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.'
|
||||
ParentColor = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
|
@ -7,95 +7,70 @@ unit RunsTestUnit;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls,
|
||||
MainUnit, Globals, DataProcs;
|
||||
MainUnit, Globals, BasicStatsReportFormUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TRunstestform }
|
||||
{ TRunsTestForm }
|
||||
|
||||
Trunstestform = class(TForm)
|
||||
TRunsTestForm = class(TBasicStatsReportForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
ComputeBtn: TButton;
|
||||
MeanEdit: TEdit;
|
||||
Memo1: TLabel;
|
||||
ResetBtn: TButton;
|
||||
CloseBtn: 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;
|
||||
VarList: TListBox;
|
||||
procedure ComputeBtnClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure InBtnClick(Sender: TObject);
|
||||
procedure OutBtnClick(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure VarListDblClick(Sender: TObject);
|
||||
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||
private
|
||||
{ private declarations }
|
||||
FAutoSized: Boolean;
|
||||
procedure UpdateBtnStates;
|
||||
|
||||
protected
|
||||
procedure AdjustConstraints; override;
|
||||
procedure Compute; override;
|
||||
procedure UpdateBtnStates; override;
|
||||
public
|
||||
{ public declarations }
|
||||
procedure Reset; override;
|
||||
end;
|
||||
|
||||
var
|
||||
runstestform: Trunstestform;
|
||||
RunsTestForm: TRunsTestForm;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math, Utils;
|
||||
Math,
|
||||
Utils, GridProcs, MatrixUnit;
|
||||
|
||||
{ Trunstestform }
|
||||
|
||||
procedure Trunstestform.ResetBtnClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
{ TRunsTestForm }
|
||||
|
||||
procedure TRunsTestForm.AdjustConstraints;
|
||||
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 := '';
|
||||
UpdateBtnStates;
|
||||
inherited;
|
||||
|
||||
ParamsPanel.Constraints.MinWidth := 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left;
|
||||
ParamsPanel.Constraints.MinHeight := OutBtn.Top + OutBtn.Height +
|
||||
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||
end;
|
||||
|
||||
procedure Trunstestform.ComputeBtnClick(Sender: TObject);
|
||||
|
||||
procedure TRunsTestForm.Compute;
|
||||
var
|
||||
a, i, col, N, N1, N2, NLess, Nmore, R: integer;
|
||||
Mean, ExpMean, SD1, SD2, SD3, SD4, SD, z1, z2, z, t, p1, p: double;
|
||||
strvalue: string;
|
||||
values: DblDyneVec;
|
||||
mean, expMean, SD1, SD2, SD3, SD4, SD, z1, z2, z, t, p1, p: double;
|
||||
values: DblDyneVec = nil;
|
||||
lReport: TStrings;
|
||||
begin
|
||||
col := 0;
|
||||
N := 0;
|
||||
N1 := 0;
|
||||
N2 := 0;
|
||||
@ -103,35 +78,25 @@ begin
|
||||
Nmore := 0;
|
||||
R := 1;
|
||||
Mean := 0.0;
|
||||
for i := 1 to NoVariables do
|
||||
|
||||
col := GetVariableIndex(OS3MainFrm.DataGrid, TestVarEdit.Text);
|
||||
if col = -1 then
|
||||
begin
|
||||
strvalue := Trim(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
if TestVarEdit.Text = strvalue then col := i;
|
||||
end;
|
||||
if col = 0 then
|
||||
begin
|
||||
MessageDlg('No variable was selected.', mtError, [mbOK], 0);
|
||||
ErrorMsg('No variable was selected.');
|
||||
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;
|
||||
values := CollectVecValues(OS3MainFrm.DataGrid, col);
|
||||
N := Length(Values);
|
||||
|
||||
if N <= 10 then
|
||||
begin
|
||||
MessageDlg('Insufficient data. You must have at least 11 values.', mtError, [mbOK], 0);
|
||||
ErrorMsg('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;
|
||||
mean := VecMean(values);
|
||||
|
||||
// run through each value and compare with the mean
|
||||
for i := 0 to N-1 do
|
||||
@ -145,12 +110,12 @@ begin
|
||||
while a > 0 do
|
||||
begin
|
||||
a := a - 1;
|
||||
if Values[a] <> Mean then break;
|
||||
if values[a] <> mean then break;
|
||||
end;
|
||||
if Values[a] < Mean then
|
||||
if values[a] < mean then
|
||||
begin
|
||||
R := R + 1;
|
||||
NLess := NLess + 1;
|
||||
nLess := nLess + 1;
|
||||
end;
|
||||
end
|
||||
else // check to see if it is less than the mean
|
||||
@ -161,19 +126,19 @@ begin
|
||||
while a > 0 do
|
||||
begin
|
||||
a := a - 1;
|
||||
if Values[a] <> Mean then break;
|
||||
if values[a] <> mean then break;
|
||||
end;
|
||||
if Values[a] > Mean then
|
||||
if values[a] > mean then
|
||||
begin
|
||||
R := R + 1;
|
||||
Nmore := Nmore + 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
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// compute the expected mean and variance of R
|
||||
ExpMean := 1.0 + ((2 * N1 * N2) / (N1 + N2)); // mean mu
|
||||
// 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;
|
||||
@ -181,7 +146,7 @@ begin
|
||||
SD := sqrt(SD4);
|
||||
|
||||
// calculating P Value
|
||||
z1 := (R - ExpMean) / SD;
|
||||
z1 := (R - expMean) / SD;
|
||||
z2 := abs(z1);
|
||||
z := z2;
|
||||
if z > 0 then
|
||||
@ -195,58 +160,47 @@ begin
|
||||
);
|
||||
p := 1.0 - p1 / 2.0;
|
||||
if z > 0.0 then
|
||||
t := 1.0 - p
|
||||
p := 1.0 - p
|
||||
else
|
||||
t := 1.0 - (1.0 - p); // this is P value
|
||||
p := 1.0 - (1.0 - p);
|
||||
|
||||
// show results
|
||||
MeanEdit.Text := Format('%.3f', [Mean]);
|
||||
StdDevEdit.Text := Format('%.3f', [SD]);
|
||||
NUpEdit.Text := IntToStr(N1);
|
||||
NDownEdit.Text := IntToStr(N2);
|
||||
NRunsEdit.Text := IntToStr(R);
|
||||
StatEdit.Text := Format('%.3f', [z]);
|
||||
ProbEdit.Text := Format('%.3f', [z]);
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
lReport.Add('RUNS TEST FOR RANDOMNESS');
|
||||
lReport.Add('');
|
||||
lReport.Add('Variable: %22s', [TestVarEdit.Text]);
|
||||
lReport.Add('');
|
||||
lReport.Add('Mean: %12.3f', [mean]);
|
||||
lReport.Add('Standard deviation: %12.3f', [SD]);
|
||||
lReport.Add('N values > mean: %12d', [N1]);
|
||||
lReport.Add('N values < mean: %12d', [N2]);
|
||||
lReport.Add('Number of runs: %12d', [R]);
|
||||
lReport.Add('Test statistic: %12.3f', [z]);
|
||||
lReport.Add('Probability: %12.3f', [p]);
|
||||
lReport.Add('');
|
||||
lReport.Add('Conclusion:');
|
||||
|
||||
// determine the conclusion
|
||||
if t < 0.01 then
|
||||
ConclusionEdit.Text := 'Very strong evidence against randomness (trend or seasonality'
|
||||
else if (t < 0.05) and (t >= 0.01) then
|
||||
ConclusionEdit.Text := 'Moderate evidence against randomness'
|
||||
else if (t < 0.10) and (t >= 0.05) then
|
||||
ConclusionEdit.Text := 'Suggestive evidence against normality'
|
||||
else if t >= 0.10 then
|
||||
ConclusionEdit.Text := 'Little or no real evidence against randomness'
|
||||
else
|
||||
ConclusionEdit.Text := 'Strong evidence against randomness (trend or seasonality exists)';
|
||||
// determine the conclusion
|
||||
if p < 0.01 then
|
||||
lReport.Add('Very strong evidence against randomness (trend or seasonality')
|
||||
else if (p < 0.05) and (p >= 0.01) then
|
||||
lReport.Add('Moderate evidence against randomness')
|
||||
else if (p < 0.10) and (p >= 0.05) then
|
||||
lReport.Add('Suggestive evidence against normality')
|
||||
else if p >= 0.10 then
|
||||
lReport.Add('Little or no real evidence against randomness')
|
||||
else
|
||||
lReport.Add('Strong evidence against randomness (trend or seasonality exists)');;
|
||||
|
||||
Values := nil;
|
||||
FReportFrame.DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Trunstestform.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
if FAutoSized then
|
||||
exit;
|
||||
|
||||
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
|
||||
Constraints.MinWidth := Width;
|
||||
Constraints.MinHeight := Height;
|
||||
|
||||
FAutoSized := true;
|
||||
end;
|
||||
|
||||
procedure Trunstestform.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Assert(OS3Mainfrm <> nil);
|
||||
end;
|
||||
|
||||
procedure Trunstestform.InBtnClick(Sender: TObject);
|
||||
procedure TRunsTestForm.InBtnClick(Sender: TObject);
|
||||
var
|
||||
index: integer;
|
||||
begin
|
||||
@ -259,7 +213,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Trunstestform.OutBtnClick(Sender: TObject);
|
||||
|
||||
procedure TRunsTestForm.OutBtnClick(Sender: TObject);
|
||||
begin
|
||||
if TestVarEdit.Text <> '' then
|
||||
begin
|
||||
@ -269,19 +224,48 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRunsTestForm.Reset;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
TestVarEdit.Clear;
|
||||
VarList.Clear;
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRunsTestForm.UpdateBtnStates;
|
||||
begin
|
||||
inherited;
|
||||
InBtn.Enabled := AnySelected(VarList) and (TestVarEdit.Text = '');
|
||||
OutBtn.Enabled := TestVarEdit.Text <> '';
|
||||
end;
|
||||
|
||||
procedure Trunstestform.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
|
||||
procedure TRunsTestForm.VarListDblClick(Sender: TObject);
|
||||
var
|
||||
index: Integer;
|
||||
begin
|
||||
index := VarList.ItemIndex;
|
||||
if (index > -1) then begin
|
||||
if (TestVarEdit.Text <> '') then
|
||||
VarList.Items.Add(TestVarEdit.Text);
|
||||
TestVarEdit.Text := VarList.Items[index];
|
||||
VarList.Items.Delete(index);
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRunsTestForm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I runstestunit.lrs}
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user