LazStats: Massive refactoring of AutoCorUnit regarding usability.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7930 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-12-15 22:54:06 +00:00
parent f7576c62e0
commit 44d2ab4918
10 changed files with 2558 additions and 1296 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,8 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit, Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit,
OptionsUnit, MainDM, MainUnit, GridProcs, MatrixUnit, RegressionUnit; OptionsUnit, MainDM, MainUnit, GridProcs, MatrixUnit, RegressionUnit,
SmoothingUnit;
{$R LazStats.res} {$R LazStats.res}

View File

@ -1,7 +1,7 @@
inherited AutoCorrForm: TAutoCorrForm inherited AutoCorrForm: TAutoCorrForm
Left = 767 Left = 446
Height = 512 Height = 512
Top = 157 Top = 176
Width = 991 Width = 991
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/Autocorrelation.htm' HelpKeyword = 'html/Autocorrelation.htm'
@ -10,34 +10,34 @@ inherited AutoCorrForm: TAutoCorrForm
ClientWidth = 991 ClientWidth = 991
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Height = 496 Height = 496
Width = 448 Width = 400
ClientHeight = 496 ClientHeight = 496
ClientWidth = 448 ClientWidth = 400
TabOrder = 1 TabOrder = 1
inherited CloseBtn: TButton inherited CloseBtn: TButton
Left = 393 Left = 345
Top = 471 Top = 471
TabOrder = 14 TabOrder = 14
end end
inherited ComputeBtn: TButton inherited ComputeBtn: TButton
Left = 309 Left = 261
Top = 471 Top = 471
TabOrder = 13 TabOrder = 13
end end
inherited ResetBtn: TButton inherited ResetBtn: TButton
Left = 247 Left = 199
Top = 471 Top = 471
TabOrder = 12 TabOrder = 12
end end
inherited HelpBtn: TButton inherited HelpBtn: TButton
Tag = 104 Tag = 104
Left = 188 Left = 140
Top = 471 Top = 471
TabOrder = 11 TabOrder = 11
end end
inherited ButtonBevel: TBevel inherited ButtonBevel: TBevel
Top = 455 Top = 455
Width = 448 Width = 400
end end
object GroupBox1: TGroupBox[5] object GroupBox1: TGroupBox[5]
AnchorSideLeft.Control = ParamsPanel AnchorSideLeft.Control = ParamsPanel
@ -90,20 +90,19 @@ inherited AutoCorrForm: TAutoCorrForm
Left = 142 Left = 142
Height = 68 Height = 68
Top = 0 Top = 0
Width = 306 Width = 252
Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Left = 16 BorderSpacing.Left = 16
Caption = 'Include Cases:' Caption = 'Include Cases:'
ClientHeight = 48 ClientHeight = 48
ClientWidth = 302 ClientWidth = 248
TabOrder = 1 TabOrder = 1
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = FromCaseEdit AnchorSideLeft.Control = FromCaseEdit
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = OnlyCasesBtn AnchorSideTop.Control = OnlyCasesBtn
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 189 Left = 178
Height = 15 Height = 15
Top = 23 Top = 23
Width = 12 Width = 12
@ -144,7 +143,7 @@ inherited AutoCorrForm: TAutoCorrForm
Left = 128 Left = 128
Height = 23 Height = 23
Top = 19 Top = 19
Width = 57 Width = 46
Alignment = taRightJustify Alignment = taRightJustify
BorderSpacing.Left = 4 BorderSpacing.Left = 4
TabOrder = 2 TabOrder = 2
@ -155,10 +154,10 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = OnlyCasesBtn AnchorSideTop.Control = OnlyCasesBtn
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 205 Left = 194
Height = 23 Height = 23
Top = 19 Top = 19
Width = 58 Width = 46
Alignment = taRightJustify Alignment = taRightJustify
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Right = 8 BorderSpacing.Right = 8
@ -185,9 +184,9 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideRight.Control = InBtn AnchorSideRight.Control = InBtn
AnchorSideBottom.Control = GroupBox4 AnchorSideBottom.Control = GroupBox4
Left = 0 Left = 0
Height = 169 Height = 262
Top = 97 Top = 97
Width = 205 Width = 155
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -198,13 +197,15 @@ inherited AutoCorrForm: TAutoCorrForm
TabOrder = 2 TabOrder = 2
end end
object InBtn: TBitBtn[9] object InBtn: TBitBtn[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList AnchorSideTop.Control = VarList
Left = 211 AnchorSideRight.Control = DepVarEdit
Left = 161
Height = 26 Height = 26
Top = 97 Top = 97
Width = 26 Width = 26
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = InBtnClick OnClick = InBtnClick
@ -212,15 +213,17 @@ inherited AutoCorrForm: TAutoCorrForm
TabOrder = 3 TabOrder = 3
end end
object OutBtn: TBitBtn[10] object OutBtn: TBitBtn[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 211 AnchorSideRight.Control = DepVarEdit
Left = 161
Height = 26 Height = 26
Top = 127 Top = 127
Width = 26 Width = 26
Anchors = [akTop, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Right = 6
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
OnClick = OutBtnClick OnClick = OutBtnClick
@ -230,7 +233,7 @@ inherited AutoCorrForm: TAutoCorrForm
object Label4: TLabel[11] object Label4: TLabel[11]
AnchorSideLeft.Control = DepVarEdit AnchorSideLeft.Control = DepVarEdit
AnchorSideBottom.Control = DepVarEdit AnchorSideBottom.Control = DepVarEdit
Left = 243 Left = 193
Height = 15 Height = 15
Top = 101 Top = 101
Width = 88 Width = 88
@ -240,18 +243,16 @@ inherited AutoCorrForm: TAutoCorrForm
ParentColor = False ParentColor = False
end end
object DepVarEdit: TEdit[12] object DepVarEdit: TEdit[12]
AnchorSideLeft.Control = InBtn AnchorSideLeft.Control = GroupBox5
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = OutBtn AnchorSideBottom.Control = OutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 243 Left = 193
Height = 23 Height = 23
Top = 118 Top = 118
Width = 205 Width = 207
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
TabOrder = 5 TabOrder = 5
@ -261,7 +262,7 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideTop.Control = AlphaEdit AnchorSideTop.Control = AlphaEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = AlphaEdit AnchorSideRight.Control = AlphaEdit
Left = 312 Left = 264
Height = 15 Height = 15
Top = 161 Top = 161
Width = 67 Width = 67
@ -274,7 +275,7 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideTop.Control = MaxLagEdit AnchorSideTop.Control = MaxLagEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = MaxLagEdit AnchorSideRight.Control = MaxLagEdit
Left = 296 Left = 248
Height = 15 Height = 15
Top = 188 Top = 188
Width = 83 Width = 83
@ -288,7 +289,7 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 387 Left = 339
Height = 23 Height = 23
Top = 157 Top = 157
Width = 61 Width = 61
@ -303,7 +304,7 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 387 Left = 339
Height = 23 Height = 23
Top = 184 Top = 184
Width = 61 Width = 61
@ -319,23 +320,23 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 221 Left = 193
Height = 51 Height = 51
Top = 223 Top = 223
Width = 227 Width = 207
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 16 BorderSpacing.Top = 16
Caption = 'Projection Option' Caption = 'Projection Option'
ClientHeight = 31 ClientHeight = 31
ClientWidth = 223 ClientWidth = 203
TabOrder = 8 TabOrder = 8
object Label2: TLabel object Label2: TLabel
AnchorSideLeft.Control = ProjPtsEdit AnchorSideLeft.Control = ProjPtsEdit
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ProjPtsEdit AnchorSideTop.Control = ProjPtsEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 135 Left = 131
Height = 15 Height = 15
Top = 6 Top = 6
Width = 33 Width = 33
@ -361,12 +362,12 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideLeft.Control = ProjectChk AnchorSideLeft.Control = ProjectChk
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBox3 AnchorSideTop.Control = GroupBox3
Left = 85 Left = 81
Height = 23 Height = 23
Top = 2 Top = 2
Width = 42 Width = 42
Alignment = taRightJustify Alignment = taRightJustify
BorderSpacing.Left = 16 BorderSpacing.Left = 12
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
TabOrder = 1 TabOrder = 1
@ -378,75 +379,38 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonBevel AnchorSideBottom.Control = ButtonBevel
Left = 0 Left = 0
Height = 177 Height = 84
Top = 278 Top = 371
Width = 205 Width = 177
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
Caption = 'Data Smoothing:' Caption = 'Data Smoothing:'
ChildSizing.LeftRightSpacing = 12 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2 ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 157 ChildSizing.ControlsPerLine = 1
ClientWidth = 201 ClientHeight = 64
ClientWidth = 173
TabOrder = 9 TabOrder = 9
object MeanChk: TCheckBox object SmoothingParamsBtn: TButton
Left = 12 Left = 12
Height = 19 Height = 25
Top = 6 Top = 6
Width = 185 Width = 149
Caption = 'Center on Mean' AutoSize = True
TabOrder = 0 Caption = 'Parameters...'
end OnClick = SmoothingParamsBtnClick
object DifferenceChk: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 185
Caption = 'Difference Smoothing'
TabOrder = 1 TabOrder = 1
end end
object MoveAvgChk: TCheckBox object AutoRegSmoothChk: TCheckBox
Left = 12 Left = 12
Height = 19 Height = 19
Top = 48 Top = 39
Width = 185 Width = 149
Caption = 'Moving Average Smooth' BorderSpacing.Top = 8
TabOrder = 2 Caption = 'Auto-regression smooth'
end TabOrder = 0
object ExpSmoothChk: TCheckBox
Left = 12
Height = 19
Top = 69
Width = 185
Caption = 'Exponentially Smooth'
TabOrder = 3
end
object FourierSmoothChk: TCheckBox
Left = 12
Height = 19
Top = 90
Width = 185
Caption = 'Fourier Filter Smooth'
TabOrder = 4
end
object PolyChk: TCheckBox
Left = 12
Height = 19
Top = 111
Width = 185
Caption = 'Polynomial Regression Smooth'
TabOrder = 5
end
object MRegSmoothChk: TCheckBox
Left = 12
Height = 19
Top = 132
Width = 185
Caption = 'Multiple Regression Smooth'
OnChange = MRegSmoothChkChange
TabOrder = 6
end end
end end
object GroupBox5: TGroupBox[19] object GroupBox5: TGroupBox[19]
@ -457,19 +421,21 @@ inherited AutoCorrForm: TAutoCorrForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox4 AnchorSideBottom.Control = GroupBox4
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 221 Left = 193
Height = 177 Height = 135
Top = 278 Top = 320
Width = 227 Width = 207
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 16 BorderSpacing.Left = 16
BorderSpacing.Top = 16
Caption = 'Analysis / Output Options' Caption = 'Analysis / Output Options'
ChildSizing.LeftRightSpacing = 12 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2 ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 157 ClientHeight = 115
ClientWidth = 223 ClientWidth = 203
TabOrder = 10 TabOrder = 10
object PlotChk: TCheckBox object PlotChk: TCheckBox
Left = 12 Left = 12
@ -477,6 +443,8 @@ inherited AutoCorrForm: TAutoCorrForm
Top = 6 Top = 6
Width = 148 Width = 148
Caption = 'Plot correlogram' Caption = 'Plot correlogram'
Checked = True
State = cbChecked
TabOrder = 0 TabOrder = 0
end end
object StatsChk: TCheckBox object StatsChk: TCheckBox
@ -511,28 +479,19 @@ inherited AutoCorrForm: TAutoCorrForm
Caption = 'Yule-Walker coefficients' Caption = 'Yule-Walker coefficients'
TabOrder = 4 TabOrder = 4
end end
object ResidChk: TCheckBox
Left = 12
Height = 19
Top = 111
Width = 148
Caption = 'Residual plot'
Enabled = False
TabOrder = 5
end
end end
end end
inherited ParamsSplitter: TSplitter inherited ParamsSplitter: TSplitter
Left = 460 Left = 412
Height = 512 Height = 512
end end
inherited PageControl: TPageControl inherited PageControl: TPageControl
Left = 469 Left = 421
Height = 496 Height = 496
Width = 514 Width = 562
ActivePage = YuleWalkerPage ActivePage = AutoRegPage
MultiLine = True MultiLine = True
TabIndex = 4 TabIndex = 5
TabOrder = 3 TabOrder = 3
Options = [nboMultiLine] Options = [nboMultiLine]
inherited ChartPage: TTabSheet inherited ChartPage: TTabSheet
@ -540,7 +499,7 @@ inherited AutoCorrForm: TAutoCorrForm
TabVisible = False TabVisible = False
end end
object CorrelationMatrixPage: TTabSheet[2] object CorrelationMatrixPage: TTabSheet[2]
Caption = 'Correlation matrix' Caption = 'Correlation Matrix'
TabVisible = False TabVisible = False
end end
object PartialsPage: TTabSheet[3] object PartialsPage: TTabSheet[3]
@ -551,6 +510,10 @@ inherited AutoCorrForm: TAutoCorrForm
Caption = 'Yule-Walker' Caption = 'Yule-Walker'
TabVisible = False TabVisible = False
end end
object AutoRegPage: TTabSheet[5]
Caption = 'Auto-Regr. Smooth'
TabVisible = False
end
end end
object Panel2: TPanel[3] object Panel2: TPanel[3]
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner

View File

@ -5,7 +5,7 @@ unit ExpSmoothUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls; StdCtrls, ExtCtrls;
type type
@ -36,8 +36,11 @@ type
var var
ExpSmoothFrm: TExpSmoothFrm; ExpSmoothFrm: TExpSmoothFrm;
implementation implementation
{$R *.lfm}
uses uses
Math; Math;
@ -80,8 +83,5 @@ begin
end; end;
initialization
{$I expsmoothunit.lrs}
end. end.

View File

@ -0,0 +1,491 @@
inherited SmoothingForm: TSmoothingForm
Left = 603
Height = 463
Top = 292
Width = 823
Caption = 'SmoothingForm'
ClientHeight = 463
ClientWidth = 823
inherited ParamsPanel: TPanel
Height = 447
Width = 296
ClientHeight = 447
ClientWidth = 296
object OKBtn: TButton[0]
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 254
Height = 25
Top = 422
Width = 42
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'OK'
ModalResult = 1
TabOrder = 9
end
inherited CloseBtn: TButton[1]
AnchorSideRight.Control = HelpBtn
AnchorSideRight.Side = asrTop
Left = -88
Top = 422
ModalResult = 11
Visible = False
end
inherited ComputeBtn: TButton[2]
AnchorSideRight.Control = OKBtn
Left = 88
Top = 422
Anchors = [akTop]
Visible = False
end
inherited ResetBtn: TButton[3]
Left = 26
Top = 422
Visible = False
end
inherited HelpBtn: TButton[4]
Left = -33
Top = 422
Visible = False
end
inherited ButtonBevel: TBevel[5]
AnchorSideBottom.Control = OKBtn
Top = 406
Width = 296
end
object DataSmoothingChkLB: TCheckListBox[6]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Splitter1
Left = 0
Height = 129
Top = 64
Width = 296
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
Items.Strings = (
'Difference Smoothing'
'Moving Average Smoothing'
'Exponential Smoothing'
'Fourier Filter Smoothing'
'Polynomial Regression Smooth'
'Multiple Regression Smoothing'
)
ItemHeight = 17
OnSelectionChange = DataSmoothingChkLBSelectionChange
TabOrder = 4
Data = {
06000000000000000000
}
end
object Label2: TLabel[7]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
Left = 0
Height = 15
Top = 47
Width = 136
BorderSpacing.Top = 12
Caption = 'Data Smoothing Methods'
ParentColor = False
end
object MeanChk: TCheckBox[8]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 19
Top = 0
Width = 105
BorderSpacing.Bottom = 8
Caption = 'Center on Mean'
OnChange = MeanChkChange
TabOrder = 5
end
object ResidChk: TCheckBox[9]
AnchorSideLeft.Control = MeanChk
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ParamsPanel
Left = 121
Height = 19
Top = 0
Width = 88
BorderSpacing.Left = 16
Caption = 'Residual plot'
OnChange = ResidChkChange
TabOrder = 6
end
object Bevel1: TBevel[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = MeanChk
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
Left = 0
Height = 8
Top = 27
Width = 296
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
object NotebookGroup: TGroupBox[11]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Splitter1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 188
Top = 218
Width = 296
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 12
Caption = 'NotebookGroup'
ClientHeight = 168
ClientWidth = 292
TabOrder = 7
object Notebook: TNotebook
AnchorSideLeft.Control = NotebookGroup
AnchorSideTop.Control = NotebookGroup
AnchorSideRight.Control = NotebookGroup
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = NotebookGroup
AnchorSideBottom.Side = asrBottom
Left = 12
Height = 156
Top = 4
Width = 268
PageIndex = 0
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 12
BorderSpacing.Top = 4
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
TabOrder = 0
object DifferencePage: TPage
object Label8: TLabel
AnchorSideTop.Side = asrCenter
Left = 13
Height = 15
Top = 4
Width = 108
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Difference for lag of:'
ParentColor = False
end
object Label9: TLabel
AnchorSideLeft.Control = DifferencePage
AnchorSideTop.Side = asrCenter
Left = 0
Height = 15
Top = 31
Width = 121
BorderSpacing.Right = 8
Caption = 'No. of times to repeat: '
ParentColor = False
end
object LagEdit: TSpinEdit
AnchorSideLeft.Control = Label8
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DifferencePage
Left = 129
Height = 23
Top = 0
Width = 66
Alignment = taRightJustify
MaxValue = 65535
OnChange = LagEditChange
TabOrder = 0
end
object DiffOrderEdit: TSpinEdit
AnchorSideLeft.Control = Label9
AnchorSideLeft.Side = asrBottom
Left = 129
Height = 23
Top = 28
Width = 66
Alignment = taRightJustify
MaxValue = 65535
MinValue = 1
OnChange = DiffOrderEditChange
TabOrder = 1
Value = 1
end
end
object MovingAvgPage: TPage
object Label3: TLabel
AnchorSideLeft.Control = MovingAvgPage
AnchorSideTop.Control = WeightOrder
AnchorSideTop.Side = asrCenter
Left = 0
Height = 15
Top = 4
Width = 36
BorderSpacing.Right = 8
Caption = 'Order: '
ParentColor = False
end
object WeightsGrid: TStringGrid
AnchorSideLeft.Control = MovingAvgPage
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MovingAvgPage
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = MovingAvgPage
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 124
Top = 32
Width = 260
Anchors = [akTop, akLeft, akRight, akBottom]
AutoAdvance = aaDown
AutoFillColumns = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
ColCount = 3
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goEditing, goThumbTracking, goSmoothScroll, goFixedColSizing]
RowCount = 2
TabOrder = 0
OnEditingDone = WeightsGridEditingDone
OnPrepareCanvas = WeightsGridPrepareCanvas
OnSelectEditor = WeightsGridSelectEditor
ColWidths = (
78
91
91
)
Cells = (
3
0
0
'Weight #'
1
0
'Weight Value'
2
0
'Normalized'
)
end
object WeightOrder: TSpinEdit
AnchorSideLeft.Control = Label3
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = MovingAvgPage
Left = 44
Height = 23
Top = 0
Width = 68
Alignment = taRightJustify
OnChange = WeightOrderChange
OnEditingDone = WeightOrderEditingDone
TabOrder = 1
end
end
object ExpPage: TPage
object Label5: TLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = AlphaEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = AlphaEdit
Left = 56
Height = 15
Top = 12
Width = 31
Anchors = [akTop, akRight]
BorderSpacing.Left = 16
BorderSpacing.Right = 8
Caption = 'Alpha'
ParentColor = False
end
object AlphaScroll: TScrollBar
AnchorSideLeft.Control = ExpPage
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ExpPage
AnchorSideRight.Side = asrBottom
Left = 16
Height = 23
Top = 39
Width = 236
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 16
BorderSpacing.Top = 12
BorderSpacing.Right = 16
PageSize = 0
Position = 99
TabOrder = 0
OnChange = AlphaScrollChange
end
object Label6: TLabel
AnchorSideLeft.Control = AlphaScroll
AnchorSideTop.Control = AlphaScroll
AnchorSideTop.Side = asrBottom
Left = 24
Height = 15
Top = 66
Width = 15
BorderSpacing.Left = 8
BorderSpacing.Top = 4
Caption = '0.0'
ParentColor = False
end
object Label7: TLabel
AnchorSideTop.Control = AlphaScroll
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AlphaScroll
AnchorSideRight.Side = asrBottom
Left = 229
Height = 15
Top = 66
Width = 15
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 8
Caption = '1.0'
ParentColor = False
end
object AlphaEdit: TFloatSpinEdit
AnchorSideLeft.Control = ExpPage
AnchorSideLeft.Side = asrCenter
Left = 95
Height = 23
Top = 8
Width = 78
Alignment = taRightJustify
Increment = 0.01
MaxValue = 1
OnChange = AlphaEditChange
TabOrder = 1
Value = 0.01
end
end
object FourierPage: TPage
object Label4: TLabel
AnchorSideLeft.Control = FourierPage
AnchorSideTop.Control = StrengthEdit
AnchorSideTop.Side = asrCenter
Left = 0
Height = 15
Top = 16
Width = 76
BorderSpacing.Right = 8
Caption = 'Filter strength:'
ParentColor = False
end
object StrengthEdit: TSpinEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FourierPage
AnchorSideRight.Side = asrBottom
Left = 84
Height = 23
Top = 12
Width = 68
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 12
OnChange = StrengthEditChange
OnEditingDone = StrengthEditEditingDone
TabOrder = 0
end
end
object PolyPage: TPage
AnchorSideTop.Side = asrBottom
object Label1: TLabel
AnchorSideLeft.Control = PolyPage
AnchorSideTop.Side = asrCenter
Left = 0
Height = 15
Top = 4
Width = 97
BorderSpacing.Right = 8
Caption = 'Polynomial order :'
ParentColor = False
end
object PolyOrderEdit: TSpinEdit
AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
Left = 105
Height = 23
Top = 0
Width = 50
Alignment = taRightJustify
MinValue = 1
OnChange = PolyOrderEditChange
TabOrder = 0
Value = 1
end
end
object MRegPage: TPage
end
end
end
object Splitter1: TSplitter[12]
AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
Cursor = crVSplit
Left = 0
Height = 5
Top = 201
Width = 296
Align = alNone
ResizeAnchor = akBottom
end
object CancelBtn: TButton[13]
AnchorSideTop.Control = OKBtn
AnchorSideRight.Control = OKBtn
Left = 184
Height = 25
Top = 422
Width = 62
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Cancel'
ModalResult = 2
TabOrder = 10
end
end
inherited ParamsSplitter: TSplitter
Left = 308
Height = 463
end
object ButtonBevel2: TBevel[2]
AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 8
Height = 8
Top = 406
Width = 296
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object OriginalDataChartSource: TUserDefinedChartSource[3]
OnGetChartDataItem = OriginalDataChartSourceGetChartDataItem
Left = 429
Top = 68
end
object SmoothedDataChartSource: TUserDefinedChartSource[4]
OnGetChartDataItem = SmoothedDataChartSourceGetChartDataItem
Left = 430
Top = 122
end
object ResidualsChartSource: TUserDefinedChartSource[5]
OnGetChartDataItem = ResidualsChartSourceGetChartDataItem
Left = 433
Top = 182
end
end

File diff suppressed because it is too large Load Diff

View File

@ -400,8 +400,10 @@ end;
{ Cumulative probability of the F distribution for given F value and with { Cumulative probability of the F distribution for given F value and with
DF1 and DF2 degrees of freedom } DF1 and DF2 degrees of freedom }
function ProbF(F, DF1, DF2: Double): Double; function ProbF(F, DF1, DF2: Double): Double;
{
var var
b1, b2: Double; b1, b2: Double;
}
begin begin
if f <= 0.0 then if f <= 0.0 then
Result := 1.0 Result := 1.0

View File

@ -11,15 +11,15 @@ uses
Globals; Globals;
type type
TDblVector = DblDyneVec; TDblVector = DblDyneVec; // array of double
TDblMatrix = DblDyneMat; TDblMatrix = DblDyneMat; // array of array of double
TDblCube = DblDyneCube; TDblCube = DblDyneCube; // array of array of array of double
TDblQuad = DblDyneQuad; TDblQuad = DblDyneQuad; // array of array of array of array of double
TIntVector = IntDyneVec; TIntVector = IntDyneVec; // array of integer
TIntMatrix = IntDyneMat; TIntMatrix = IntDyneMat; // array of array of integer
TIntCube = IntDyneCube; TIntCube = IntDyneCube; // array of array of array of integer
TIntQuad = IntDyneQuad; TIntQuad = IntDyneQuad; // array of array of array of array of integer
EMatrix = class(Exception); EMatrix = class(Exception);
@ -136,6 +136,8 @@ implementation
uses uses
Math; Math;
const
TWO_PI = 2.0 * pi; // redeclaration to avoid dependence on MathUnit
operator + (A, B: TDblVector): TDblVector; operator + (A, B: TDblVector): TDblVector;
var var

View File

@ -178,14 +178,14 @@ begin
// Product of transposed augmented with augmented matrix // Product of transposed augmented with augmented matrix
XT_X := XT * X; XT_X := XT * X;
AResults.XT_X := Matcopy(XT_X); AResults.XT_X := MatCopy(XT_X);
// Product of inverse of XT_X with XT_Y yields the coefficients. Intercept is last. // Product of inverse of XT_X with XT_Y yields the coefficients. Intercept is last.
inv_XT_X := MatInverse(XT_X); inv_XT_X := MatInverse(XT_X);
AResults.Coeffs := inv_XT_X * XT_Y; AResults.Coeffs := inv_XT_X * XT_Y;
// THe XT_X matrix contains the sum of squares (diagonal elements), sum of // THe XT_X matrix contains the sum of squares (diagonal elements), sum of
// cross-products (off-diagonal elements and the sum the variable values // cross-products (off-diagonal elements and the sum of the variable values
// (augmented column). // (augmented column).
SetLength(AResults.Means, mx+1); SetLength(AResults.Means, mx+1);
SetLength(AResults.Variances, mx+1); SetLength(AResults.Variances, mx+1);
@ -206,7 +206,10 @@ begin
for j := 0 to mx-1 do for j := 0 to mx-1 do
begin begin
VarCovar[i, j] := (XT_X[i, j] - XT_X[i, mx] * XT_X[j, mx] / nx) / (nx - 1); VarCovar[i, j] := (XT_X[i, j] - XT_X[i, mx] * XT_X[j, mx] / nx) / (nx - 1);
Correlations[i, j] := VarCovar[i, j] / (StdDevs[i] * StdDevs[j]); if StdDevs[i] <> 0 then
Correlations[i, j] := VarCovar[i, j] / (StdDevs[i] * StdDevs[j])
else
Correlations[i, j] := 0.0;
end; end;
end; end;