You've already forked lazarus-ccr
LazStats: Inherit RMatUnit from BasicStatsReportFormUnit. Some refactoring.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7867 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1,374 +1,264 @@
|
||||
object RMatFrm: TRMatFrm
|
||||
Left = 597
|
||||
Height = 482
|
||||
Top = 185
|
||||
Width = 409
|
||||
inherited RMatFrm: TRMatFrm
|
||||
Left = 1133
|
||||
Height = 345
|
||||
Top = 254
|
||||
Width = 840
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'html/ProductMoment.htm'
|
||||
AutoSize = True
|
||||
Caption = 'Product-Moment Correlations'
|
||||
ClientHeight = 482
|
||||
ClientWidth = 409
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 8
|
||||
ClientHeight = 345
|
||||
ClientWidth = 840
|
||||
inherited ParamsPanel: TPanel
|
||||
Height = 329
|
||||
ClientHeight = 329
|
||||
inherited CloseBtn: TButton
|
||||
Top = 304
|
||||
end
|
||||
inherited ComputeBtn: TButton
|
||||
Top = 304
|
||||
end
|
||||
inherited ResetBtn: TButton
|
||||
Top = 304
|
||||
end
|
||||
inherited HelpBtn: TButton
|
||||
Tag = 144
|
||||
Top = 304
|
||||
end
|
||||
inherited ButtonBevel: TBevel
|
||||
Top = 288
|
||||
end
|
||||
object Label1: TLabel[5]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 8
|
||||
Top = 0
|
||||
Width = 114
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Variables to Correlate:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
object Label2: TLabel[6]
|
||||
AnchorSideLeft.Control = SelList
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 235
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
Left = 171
|
||||
Height = 15
|
||||
Top = 8
|
||||
Top = 0
|
||||
Width = 96
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Selected Variables:'
|
||||
ParentColor = False
|
||||
end
|
||||
object VarList: TListBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
object VarList: TListBox[7]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AllBtn
|
||||
AnchorSideBottom.Control = GroupBox1
|
||||
Left = 8
|
||||
Height = 223
|
||||
Top = 25
|
||||
Width = 165
|
||||
AnchorSideBottom.Control = OptionsGroup
|
||||
Left = 0
|
||||
Height = 128
|
||||
Top = 17
|
||||
Width = 119
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 8
|
||||
Constraints.MinHeight = 220
|
||||
ItemHeight = 0
|
||||
MultiSelect = True
|
||||
TabOrder = 0
|
||||
OnDblClick = VarListDblClick
|
||||
OnSelectionChange = VarListSelectionChange
|
||||
TabOrder = 4
|
||||
end
|
||||
object InBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
object InBtn: TBitBtn[8]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
Left = 190
|
||||
Left = 131
|
||||
Height = 28
|
||||
Top = 29
|
||||
Width = 28
|
||||
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
|
||||
}
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = InBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 1
|
||||
TabOrder = 5
|
||||
end
|
||||
object OutBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
object OutBtn: TBitBtn[9]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
Left = 190
|
||||
Left = 131
|
||||
Height = 28
|
||||
Top = 64
|
||||
Width = 28
|
||||
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
|
||||
}
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = OutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 2
|
||||
TabOrder = 6
|
||||
end
|
||||
object AllBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
object AllBtn: TBitBtn[10]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
Left = 181
|
||||
Left = 125
|
||||
Height = 25
|
||||
Top = 120
|
||||
Width = 46
|
||||
Width = 40
|
||||
AutoSize = True
|
||||
Caption = 'ALL'
|
||||
Caption = 'All'
|
||||
OnClick = AllBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 3
|
||||
TabOrder = 7
|
||||
end
|
||||
object SelList: TListBox
|
||||
object SelList: TListBox[11]
|
||||
AnchorSideLeft.Control = AllBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = GroupBox1
|
||||
Left = 235
|
||||
Height = 223
|
||||
Top = 25
|
||||
Width = 166
|
||||
AnchorSideBottom.Control = OptionsGroup
|
||||
Left = 171
|
||||
Height = 128
|
||||
Top = 17
|
||||
Width = 112
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 0
|
||||
MultiSelect = True
|
||||
TabOrder = 4
|
||||
OnDblClick = SelListDblClick
|
||||
OnSelectionChange = SelListSelectionChange
|
||||
TabOrder = 8
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
object OptionsGroup: TGroupBox[12]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Bevel1
|
||||
Left = 8
|
||||
Height = 177
|
||||
Top = 256
|
||||
Width = 393
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AnchorSideBottom.Control = ButtonBevel
|
||||
Left = 0
|
||||
Height = 135
|
||||
Top = 153
|
||||
Width = 396
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Options:'
|
||||
ChildSizing.LeftRightSpacing = 12
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 2
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.Layout = cclTopToBottomThenLeftToRight
|
||||
ChildSizing.ControlsPerLine = 7
|
||||
ClientHeight = 157
|
||||
ClientWidth = 389
|
||||
TabOrder = 5
|
||||
object CPChkBox: TCheckBox
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 115
|
||||
ClientWidth = 392
|
||||
TabOrder = 9
|
||||
object CrossProdChk: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 6
|
||||
Width = 222
|
||||
Width = 170
|
||||
Caption = 'Show Cross-Products Matrix'
|
||||
TabOrder = 0
|
||||
end
|
||||
object CovChkBox: TCheckBox
|
||||
Left = 12
|
||||
object VarCovarChk: TCheckBox
|
||||
Left = 182
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 222
|
||||
Top = 6
|
||||
Width = 198
|
||||
Caption = 'Show Variance-Covariance Matrix'
|
||||
TabOrder = 1
|
||||
end
|
||||
object CorrsChkBox: TCheckBox
|
||||
object CorrsChk: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 48
|
||||
Width = 222
|
||||
Caption = 'Show the Intercorrelation Matrix'
|
||||
Top = 27
|
||||
Width = 170
|
||||
Caption = 'Show Intercorrelation Matrix'
|
||||
TabOrder = 2
|
||||
end
|
||||
object MeansChkBox: TCheckBox
|
||||
Left = 12
|
||||
object MeansChk: TCheckBox
|
||||
Left = 182
|
||||
Height = 19
|
||||
Top = 69
|
||||
Width = 222
|
||||
Top = 27
|
||||
Width = 198
|
||||
Caption = 'Show Means'
|
||||
TabOrder = 3
|
||||
end
|
||||
object VarChkBox: TCheckBox
|
||||
object VarsChk: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 90
|
||||
Width = 222
|
||||
Top = 48
|
||||
Width = 170
|
||||
Caption = 'Show Variances'
|
||||
TabOrder = 4
|
||||
end
|
||||
object SDChkBox: TCheckBox
|
||||
Left = 12
|
||||
object StdDevsChk: TCheckBox
|
||||
Left = 182
|
||||
Height = 19
|
||||
Top = 111
|
||||
Width = 222
|
||||
Top = 48
|
||||
Width = 198
|
||||
Caption = 'Show Standard Deviations'
|
||||
TabOrder = 5
|
||||
end
|
||||
object PairsChkBox: TCheckBox
|
||||
object PairwiseChk: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 132
|
||||
Width = 222
|
||||
Top = 69
|
||||
Width = 170
|
||||
Caption = 'Pair-Wise Calculations'
|
||||
TabOrder = 6
|
||||
end
|
||||
object AugmentChk: TCheckBox
|
||||
Left = 234
|
||||
Left = 182
|
||||
Height = 19
|
||||
Top = 6
|
||||
Width = 143
|
||||
Caption = 'Autmented'
|
||||
Top = 69
|
||||
Width = 198
|
||||
Caption = 'Augmented'
|
||||
TabOrder = 7
|
||||
end
|
||||
object GridMatChk: TCheckBox
|
||||
Left = 234
|
||||
object SaveMatrixChk: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 143
|
||||
Top = 90
|
||||
Width = 170
|
||||
Caption = 'Save Matrix to Grid'
|
||||
TabOrder = 8
|
||||
end
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 200
|
||||
Height = 25
|
||||
Top = 449
|
||||
Width = 54
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
end
|
||||
inherited ParamsSplitter: TSplitter
|
||||
Height = 345
|
||||
end
|
||||
object PageControl: TPageControl[2]
|
||||
Left = 314
|
||||
Height = 329
|
||||
Top = 8
|
||||
Width = 518
|
||||
ActivePage = PairwisePage
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 7
|
||||
TabIndex = 4
|
||||
TabOrder = 2
|
||||
object CrossProdPage: TTabSheet
|
||||
Caption = 'Cross-Products'
|
||||
TabVisible = False
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 262
|
||||
Height = 25
|
||||
Top = 449
|
||||
Width = 76
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 8
|
||||
object VarCovarPage: TTabSheet
|
||||
Caption = 'Var-/Covariance'
|
||||
TabVisible = False
|
||||
end
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 346
|
||||
Height = 25
|
||||
Top = 449
|
||||
Width = 55
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 9
|
||||
object IntercorrPage: TTabSheet
|
||||
Caption = 'Intercorrelation'
|
||||
TabVisible = False
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 144
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 141
|
||||
Height = 25
|
||||
Top = 449
|
||||
Width = 51
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Help'
|
||||
OnClick = HelpBtnClick
|
||||
TabOrder = 6
|
||||
object StatsPage: TTabSheet
|
||||
Caption = 'Mean, Var, StdDev'
|
||||
TabVisible = False
|
||||
end
|
||||
object PairwisePage: TTabSheet
|
||||
Caption = 'Pair-Wise'
|
||||
TabVisible = False
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = CloseBtn
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 433
|
||||
Width = 409
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
end
|
||||
|
@@ -1,3 +1,7 @@
|
||||
{ Test file:
|
||||
cansas.laz, select all variables
|
||||
}
|
||||
|
||||
unit RMatUnit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
@@ -5,56 +9,81 @@ unit RMatUnit;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls,
|
||||
MainUnit, Globals, MatrixLib, OutputUnit, DataProcs, FunctionsLib,
|
||||
ContextHelpUnit;
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls, ComCtrls,
|
||||
MainUnit, Globals, MatrixLib, DataProcs, ReportFrameUnit, BasicStatsReportFormUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TRMatFrm }
|
||||
|
||||
TRMatFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
GridMatChk: TCheckBox;
|
||||
HelpBtn: TButton;
|
||||
TRMatFrm = class(TBasicStatsReportForm)
|
||||
SaveMatrixChk: TCheckBox;
|
||||
InBtn: TBitBtn;
|
||||
OutBtn: TBitBtn;
|
||||
AllBtn: TBitBtn;
|
||||
AugmentChk: TCheckBox;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
CPChkBox: TCheckBox;
|
||||
CovChkBox: TCheckBox;
|
||||
CorrsChkBox: TCheckBox;
|
||||
MeansChkBox: TCheckBox;
|
||||
VarChkBox: TCheckBox;
|
||||
SDChkBox: TCheckBox;
|
||||
PairsChkBox: TCheckBox;
|
||||
GroupBox1: TGroupBox;
|
||||
CrossProdChk: TCheckBox;
|
||||
VarCovarChk: TCheckBox;
|
||||
CorrsChk: TCheckBox;
|
||||
MeansChk: TCheckBox;
|
||||
PageControl: TPageControl;
|
||||
CrossProdPage: TTabSheet;
|
||||
IntercorrPage: TTabSheet;
|
||||
StatsPage: TTabSheet;
|
||||
PairwisePage: TTabSheet;
|
||||
VarCovarPage: TTabSheet;
|
||||
VarsChk: TCheckBox;
|
||||
StdDevsChk: TCheckBox;
|
||||
PairwiseChk: TCheckBox;
|
||||
OptionsGroup: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
SelList: TListBox;
|
||||
VarList: TListBox;
|
||||
procedure AllBtnClick(Sender: TObject);
|
||||
procedure ComputeBtnClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure HelpBtnClick(Sender: TObject);
|
||||
procedure InBtnClick(Sender: TObject);
|
||||
procedure OutBtnClick(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
procedure SelListDblClick(Sender: TObject);
|
||||
procedure SelListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||
procedure VarListDblClick(Sender: TObject);
|
||||
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||
|
||||
private
|
||||
{ private declarations }
|
||||
FAutoSized: Boolean;
|
||||
FCreated: Boolean;
|
||||
|
||||
procedure CrossProducts(ANumVars, ANumCases: Integer;
|
||||
const AMatrix: DblDyneMat;
|
||||
Augmented: Boolean; const ARowLabels, AColLabels: StrDyneVec);
|
||||
|
||||
procedure InterCorrelations(ANumVars: Integer; const AColNoSelected: IntDyneVec;
|
||||
const AMatrix: DblDyneMat; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const ARowLabels, AColLabels: StrDyneVec);
|
||||
|
||||
procedure PairsCalc(NoVars: integer; const ColNoSelected: IntDyneVec;
|
||||
const Matrix: DblDyneMat; const ColLabels: StrDyneVec; AReport: TStrings);
|
||||
procedure UpdateBtnStates;
|
||||
const Matrix: DblDyneMat; const ColLabels: StrDyneVec);
|
||||
|
||||
procedure Stats(ANumVars, ANumCases: Integer; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const AColLabels: StrDyneVec);
|
||||
|
||||
procedure VarCovar(ANumVars: Integer; const AColNoSelected: IntDyneVec;
|
||||
const AMatrix: DblDyneMat; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const ARowLabels, AColLabels: StrDyneVec);
|
||||
|
||||
protected
|
||||
FCrossProdReportFrame: TReportFrame;
|
||||
FVarCovarReportFrame: TReportFrame;
|
||||
FInterCorrReportFrame: TReportFrame;
|
||||
FStatsReportFrame: TReportFrame;
|
||||
FPairwiseReportFrame: TReportFrame;
|
||||
procedure AdjustConstraints; override;
|
||||
procedure Compute; override;
|
||||
procedure SelectVisiblePage;
|
||||
procedure UpdateBtnStates; override;
|
||||
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure Reset; override;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -62,68 +91,57 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math,
|
||||
Utils, MathUnit;
|
||||
|
||||
|
||||
{ TRMatFrm }
|
||||
|
||||
procedure TRMatFrm.ResetBtnClick(Sender: TObject);
|
||||
VAR i : integer;
|
||||
constructor TRMatFrm.Create(AOwner: TComponent);
|
||||
begin
|
||||
VarList.Clear;
|
||||
SelList.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;
|
||||
inherited;
|
||||
|
||||
FCrossProdReportFrame := FReportFrame; // already created by ancestor
|
||||
FCrossProdReportFrame.Parent := CrossProdPage;
|
||||
FCrossProdReportFrame.Align := alClient;
|
||||
|
||||
FVarCovarReportFrame := TReportFrame.Create(self);
|
||||
FVarCovarReportFrame.Parent := VarCovarPage;
|
||||
FVarCovarReportFrame.Align := alClient;
|
||||
|
||||
FIntercorrReportFrame := TReportFrame.Create(self);
|
||||
FIntercorrReportFrame.Parent := IntercorrPage;
|
||||
FIntercorrReportFrame.Align := alClient;
|
||||
|
||||
FStatsReportFrame := TReportFrame.Create(self);
|
||||
FStatsReportFrame.Parent := StatsPage;
|
||||
FStatsReportFrame.Align := alClient;
|
||||
|
||||
FPairwiseReportFrame := TReportFrame.Create(self);
|
||||
FPairwiseReportFrame.Parent := PairwisePage;
|
||||
FPairwiseReportFrame.Align := alClient;
|
||||
|
||||
PageControl.ActivePageIndex := 0;
|
||||
FCreated := true;
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.FormShow(Sender: TObject);
|
||||
|
||||
procedure TRMatFrm.AdjustConstraints;
|
||||
begin
|
||||
ResetBtnClick(Self);
|
||||
inherited;
|
||||
ParamsPanel.Constraints.MinWidth := Max(
|
||||
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
|
||||
OptionsGroup.Width
|
||||
);
|
||||
ParamsPanel.Constraints.MinHeight := AllBtn.Top + AllBtn.Height +
|
||||
VarList.BorderSpacing.Bottom + OptionsGroup.Height +
|
||||
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
if FAutoSized then
|
||||
exit;
|
||||
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
HelpBtn.Constraints.MinWidth := w;
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
|
||||
Constraints.MinWidth := Width;
|
||||
Constraints.MinHeight := Height;
|
||||
|
||||
FAutoSized := true;
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Assert(OS3MainFrm <> nil);
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.HelpBtnClick(Sender: TObject);
|
||||
begin
|
||||
if ContextHelpForm = nil then
|
||||
Application.CreateForm(TContextHelpForm, ContextHelpForm);
|
||||
ContextHelpForm.HelpMessage((Sender as TButton).Tag);
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.AllBtnClick(Sender: TObject);
|
||||
var
|
||||
@@ -135,44 +153,35 @@ begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.ComputeBtnClick(Sender: TObject);
|
||||
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, Probr, N: double;
|
||||
lReport: TStrings;
|
||||
begin
|
||||
errorcode := false;
|
||||
NoVars := SelList.Items.Count;
|
||||
Augment := false;
|
||||
Ngood := 0;
|
||||
|
||||
procedure TRMatFrm.Compute;
|
||||
var
|
||||
i, j: integer;
|
||||
cellstring: string;
|
||||
NoVars: integer;
|
||||
ColNoSelected: IntDyneVec = nil;
|
||||
Matrix: DblDyneMat = nil;
|
||||
Means: DblDyneVec = nil;
|
||||
Variances: DblDyneVec = nil;
|
||||
StdDevs: DblDyneVec = nil;
|
||||
RowLabels: StrDyneVec = nil;
|
||||
ColLabels: StrDyneVec = nil;
|
||||
nGood: Integer = 0;
|
||||
begin
|
||||
NoVars := SelList.Items.Count;
|
||||
if NoVars = 0 then
|
||||
begin
|
||||
MessageDlg('No variable(s) selected.', mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
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);
|
||||
SetLength(ColNoSelected, NoVars+1);
|
||||
SetLength(Matrix, NoVars+1, NoVars+1); // 1 more for possible augmentation
|
||||
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
|
||||
@@ -188,101 +197,139 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
if PairsChkBox.Checked then
|
||||
begin
|
||||
PairsCalc(NoVars, ColNoSelected, Matrix, ColLabels, lReport);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if AugmentChk.Checked then
|
||||
begin
|
||||
Augment := true;
|
||||
ColLabels[NoVars] := 'Intercept';
|
||||
RowLabels[NoVars] := 'Intercept';
|
||||
end;
|
||||
|
||||
// get cross-products if elected
|
||||
if CPChkBox.Checked then
|
||||
// Pairwise calculations
|
||||
if PairwiseChk.Checked then
|
||||
begin
|
||||
GridXProd(NoVars, ColNoSelected, Matrix, Augment, Ngood);
|
||||
PairwisePage.TabVisible := true;
|
||||
PairsCalc(NoVars, ColNoSelected, Matrix, ColLabels);
|
||||
end else
|
||||
PairwisePage.TabVisible := false;
|
||||
|
||||
// Get cross-products if selected
|
||||
GridXProd(NoVars, ColNoSelected, Matrix, AugmentChk.Checked, nGood);
|
||||
if CrossProdChk.Checked then
|
||||
begin
|
||||
CrossProdPage.TabVisible := true;
|
||||
CrossProducts(NoVars, nGood, Matrix, AugmentChk.Checked, RowLabels, ColLabels);
|
||||
end else
|
||||
CrossProdPage.TabVisible := false;
|
||||
|
||||
// Variance/Covariance
|
||||
if VarCovarChk.Checked then
|
||||
begin
|
||||
VarCovarPage.TabVisible := true;
|
||||
VarCovar(NoVars, ColNoSelected, Matrix, Means, Variances, StdDevs, RowLabels, ColLabels);
|
||||
end else
|
||||
VarCovarPage.TabVisible := false;
|
||||
|
||||
// Intercorrelations
|
||||
if CorrsChk.Checked then
|
||||
begin
|
||||
InterCorrPage.TabVisible := true;
|
||||
InterCorrelations(NoVars, ColNoSelected, Matrix, Means, Variances, StdDevs, RowLabels, ColLabels);
|
||||
end else
|
||||
InterCorrPage.TabVisible := false;
|
||||
|
||||
// Means, variances and/or standard deviations
|
||||
if MeansChk.Checked or VarsChk.Checked or StdDevsChk.Checked then
|
||||
begin
|
||||
StatsPage.TabVisible := true;
|
||||
Stats(NoVars, nGood, Means, Variances, StdDevs, ColLabels);
|
||||
end else
|
||||
StatsPage.TabVisible := false;
|
||||
|
||||
// Results to grid
|
||||
if SaveMatrixChk.Checked then
|
||||
begin
|
||||
MatToGrid(Matrix, NoVars);
|
||||
SaveMatrixChk.Checked := false;
|
||||
end;
|
||||
|
||||
SelectVisiblePage;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.CrossProducts(ANumVars, ANumCases: Integer;
|
||||
const AMatrix: DblDyneMat; Augmented: Boolean;
|
||||
const ARowLabels, AColLabels: StrDyneVec);
|
||||
var
|
||||
lReport: TStrings;
|
||||
title: String;
|
||||
begin
|
||||
// GridXProd(ANumVars, AColNoSelected, AMatrix, Augmented, nGood);
|
||||
title := 'Cross-Products Matrix';
|
||||
if not Augment then
|
||||
MatPrint(Matrix, NoVars, NoVars, title, RowLabels, ColLabels, Ngood, lReport)
|
||||
else
|
||||
MatPrint(Matrix, NoVars+1, NoVars+1, title, RowLabels, ColLabels, Ngood, lReport);
|
||||
end;
|
||||
if Augmented then
|
||||
inc(ANumVars);
|
||||
|
||||
// get variance-covariance mat. if elected
|
||||
if CovChkBox.Checked then
|
||||
begin
|
||||
title := 'Variance-Covariance Matrix';
|
||||
GridCovar(NoVars, ColNoSelected, Matrix, Means, Variances, StdDevs, errorcode, Ngood);
|
||||
MatPrint(Matrix, NoVars, NoVars, title, RowLabels, ColLabels, Ngood, lReport);
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
MatPrint(AMatrix, ANumVars, ANumVars, title, ARowLabels, AColLabels, ANumCases, lReport);
|
||||
FCrossProdReportFrame.DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
// get correlations
|
||||
if CorrsChkBox.Checked then
|
||||
begin
|
||||
|
||||
procedure TRMatFrm.InterCorrelations(ANumVars: Integer; const AColNoSelected: IntDyneVec;
|
||||
const AMatrix: DblDyneMat; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const ARowLabels, AColLabels: StrDyneVec);
|
||||
var
|
||||
lReport: TStrings;
|
||||
title: String;
|
||||
nGood: Integer = 0;
|
||||
hasError: Boolean = false;
|
||||
i, j: Integer;
|
||||
testMat: DblDyneMat = nil;
|
||||
t, probR, N: double;
|
||||
begin
|
||||
title := 'Product-Moment Correlations Matrix';
|
||||
Correlations(NoVars, ColNoSelected, Matrix, Means, Variances, StdDevs, errorcode, Ngood);
|
||||
MatPrint(Matrix, NoVars, NoVars, title, RowLabels, ColLabels, Ngood, lReport);
|
||||
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)';
|
||||
MatPrint(TestMat, NoVars, NoVars, title, RowLabels, ColLabels, Ngood, lReport);
|
||||
end;
|
||||
Correlations(ANumVars, AColNoSelected, AMatrix, AMeans, AVars, AStdDevs, hasError, nGood);
|
||||
|
||||
if MeansChkBox.Checked then
|
||||
begin
|
||||
title := 'Means';
|
||||
DynVectorPrint(Means, NoVars, title, ColLabels, Ngood, lReport);
|
||||
end;
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
MatPrint(AMatrix, ANumVars, ANumVars, title, ARowLabels, AColLabels, nGood, lReport);
|
||||
|
||||
if VarChkBox.Checked then
|
||||
if hasError then
|
||||
begin
|
||||
title := 'Variances';
|
||||
DynVectorPrint(Variances, NoVars, title, ColLabels, Ngood, lReport);
|
||||
end;
|
||||
|
||||
if SDChkBox.Checked then
|
||||
begin
|
||||
title := 'Standard Deviations';
|
||||
DynVectorPrint(StdDevs, NoVars, title, ColLabels, Ngood, lReport);
|
||||
end;
|
||||
|
||||
if errorcode then
|
||||
lReport.Add('');
|
||||
lReport.Add('One or more correlations could not be computed due to zero variance of a variable.');
|
||||
end;
|
||||
|
||||
if GridMatChk.Checked then
|
||||
MatToGrid(Matrix,NoVars);
|
||||
N := Ngood;
|
||||
SetLength(testMat, ANumVars, ANumVars);
|
||||
for i := 1 to ANumVars do
|
||||
begin
|
||||
for j := i+1 to ANumVars do
|
||||
begin
|
||||
t := AMatrix[i-1, j-1] * (sqrt((N-2.0) / (1.0 - (AMatrix[i-1, j-1] * AMatrix[i-1, j-1]))));
|
||||
testMat[i-1,j-1] := t;
|
||||
probR := ProbT(t, N - 2);
|
||||
testMat[j-1, i-1] := probR;
|
||||
testMat[i-1, i-1] := 0.0;
|
||||
end;
|
||||
end;
|
||||
|
||||
DisplayReport(lReport);
|
||||
lReport.Add(DIVIDER_SMALL_AUTO);
|
||||
lReport.Add('');
|
||||
|
||||
title := 't-test values (upper) and probabilities of t (lower)';
|
||||
MatPrint(testMat, ANumVars, ANumVars, title, ARowLabels, AColLabels, nGood, lReport);
|
||||
|
||||
FInterCorrReportFrame.DisplayReport(lReport);
|
||||
|
||||
finally
|
||||
lReport.Free;
|
||||
ColLabels := nil;
|
||||
RowLabels := nil;
|
||||
StdDevs := nil;
|
||||
Variances := nil;
|
||||
Means := nil;
|
||||
Matrix := nil;
|
||||
ColNoSelected := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.InBtnClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
@@ -319,20 +366,24 @@ begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.PairsCalc(NoVars: integer; const ColNoSelected: IntDyneVec;
|
||||
const Matrix: DblDyneMat; const ColLabels: StrDyneVec; AReport: TStrings);
|
||||
const Matrix: DblDyneMat; const ColLabels: StrDyneVec);
|
||||
var
|
||||
lReport: TStrings;
|
||||
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;
|
||||
NMatrix: IntDyneMat = nil;
|
||||
tMatrix: DblDyneMat = nil;
|
||||
ProbMat: DblDyneMat = nil;
|
||||
startpos, endpos: integer;
|
||||
begin
|
||||
SetLength(NMatrix,NoVars,NoVars);
|
||||
SetLength(tMatrix,NoVars,NoVars);
|
||||
SetLength(ProbMat,NoVars,NoVars);
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
SetLength(NMatrix, NoVars, NoVars);
|
||||
SetLength(tMatrix, NoVars, NoVars);
|
||||
SetLength(ProbMat, NoVars, NoVars);
|
||||
|
||||
for i := 1 to NoVars - 1 do
|
||||
begin
|
||||
@@ -346,7 +397,7 @@ begin
|
||||
YCol := ColNoSelected[j-1];
|
||||
pmcorr := 0.0;
|
||||
Npairs := 0;
|
||||
AReport.Add(ColLabels[i-1] + ' vs ' + ColLabels[j-1]);
|
||||
lReport.Add(ColLabels[i-1] + ' vs ' + ColLabels[j-1]);
|
||||
|
||||
for k := 1 to NoCases do
|
||||
begin
|
||||
@@ -362,13 +413,13 @@ begin
|
||||
Npairs := NPairs + 1;
|
||||
end;
|
||||
|
||||
if CPChkBox.Checked then
|
||||
AReport.Add('CrossProducts[%d,%d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
if CrossProdChk.Checked then
|
||||
lReport.Add('CrossProducts[%d,%d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
|
||||
pmcorr := pmcorr - (XMean * YMean) / Npairs;
|
||||
pmcorr := pmcorr / (Npairs - 1);
|
||||
if CovChkBox.Checked then
|
||||
AReport.Add('Covariance[%d,%d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
if VarCovarChk.Checked then
|
||||
lReport.Add('Covariance[%d,%d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
|
||||
XVar := XVar - (XMean * XMean) / Npairs;
|
||||
XVar := XVar / (Npairs - 1);
|
||||
@@ -383,45 +434,46 @@ begin
|
||||
Matrix[j-1,i-1] := pmcorr;
|
||||
NMatrix[i-1,j-1] := Npairs;
|
||||
NMatrix[j-1,i-1] := NPairs;
|
||||
if CorrsChkBox.Checked then
|
||||
if CorrsChk.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);
|
||||
AReport.Add('r[%d, %d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
AReport.Add('t value with d.f. %d: %8.4f with Probability > t %6.4f', [Npairs - 2, z, rprob]);
|
||||
// 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);
|
||||
lReport.Add('r[%d, %d]: %6.4f, N cases: %d', [i, j, pmcorr, Npairs]);
|
||||
lReport.Add('t value with d.f. %d: %8.4f with Probability > t %6.4f', [Npairs - 2, z, rprob]);
|
||||
|
||||
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
|
||||
if MeansChk.Checked or VarsChk.Checked or StdDevsChk.Checked then
|
||||
begin
|
||||
AReport.Add('Mean X: %8.4f, Variance X: %8.4f, Std.Dev. X: %8.4f', [XMean, XVar, XSD]);
|
||||
AReport.Add('Mean Y: %8.4f, Variance Y: %8.4f, Std.Dev. Y: %8.4f', [YMean, YVar, YSD]);
|
||||
lReport.Add('Mean X: %8.4f, Variance X: %8.4f, Std.Dev. X: %8.4f', [XMean, XVar, XSD]);
|
||||
lReport.Add('Mean Y: %8.4f, Variance Y: %8.4f, Std.Dev. Y: %8.4f', [YMean, YVar, YSD]);
|
||||
end;
|
||||
AReport.Add('');
|
||||
lReport.Add('');
|
||||
end; // next j variable
|
||||
Matrix[i-1,i-1] := 1.0;
|
||||
end; // next i variable
|
||||
|
||||
Matrix[NoVars-1,NoVars-1] := 1.0;
|
||||
|
||||
AReport.Add('');
|
||||
AReport.Add(DIVIDER);
|
||||
AReport.Add('');
|
||||
lReport.Add('');
|
||||
lReport.Add(DIVIDER);
|
||||
lReport.Add('');
|
||||
|
||||
AReport.Add('Intercorrelation Matrix and Statistics');
|
||||
AReport.Add('');
|
||||
lReport.Add('Intercorrelation Matrix and Statistics');
|
||||
lReport.Add('');
|
||||
|
||||
// strout := 'Correlation Matrix Summary (Ns in lower triangle)';
|
||||
// MAT_PRINT(Matrix,NoVars,NoVars,strout,ColLabels,ColLabels,NoCases);
|
||||
// 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;
|
||||
@@ -431,12 +483,12 @@ begin
|
||||
strout := ' ';
|
||||
for j := startpos to endpos do
|
||||
strout := strout + Format(' %5d', [j]);
|
||||
AReport.Add(strout);
|
||||
lReport.Add(strout);
|
||||
|
||||
strout := format('%2d PMCorr.',[i]);
|
||||
for j := startpos to endpos do
|
||||
strout := strout + Format(' %7.4f', [Matrix[i-1,j-1]]);
|
||||
AReport.Add(strout);
|
||||
lReport.Add(strout);
|
||||
|
||||
strout := Format('%2d N Size ', [i]);
|
||||
for j := startpos to endpos do
|
||||
@@ -454,7 +506,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
AReport.Add(strout);
|
||||
lReport.Add(strout);
|
||||
|
||||
strout := Format('%2d t Value', [i]);
|
||||
for j := startpos to endpos do
|
||||
@@ -462,7 +514,7 @@ begin
|
||||
strout := strout + Format(' %7.4f', [tMatrix[i-1, j-1]])
|
||||
else
|
||||
strout := strout + ' ';
|
||||
AReport.Add(strout);
|
||||
lReport.Add(strout);
|
||||
|
||||
strout := Format('%2d Prob. t', [i]);
|
||||
for j := startpos to endpos do
|
||||
@@ -470,8 +522,8 @@ begin
|
||||
strout := strout + Format(' %7.4f', [ProbMat[i-1, j-1]])
|
||||
else
|
||||
strout := strout + ' ';
|
||||
AReport.Add(strout);
|
||||
AReport.Add('');
|
||||
lReport.Add(strout);
|
||||
lReport.Add('');
|
||||
|
||||
if endpos < NoVars then
|
||||
begin
|
||||
@@ -482,24 +534,189 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
AReport.Add('');
|
||||
AReport.Add(DIVIDER);
|
||||
AReport.Add('');
|
||||
FPairwiseReportFrame.DisplayReport(lReport);
|
||||
|
||||
ProbMat := nil;
|
||||
tMatrix := nil;
|
||||
NMatrix := nil;
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.Reset;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
VarList.Clear;
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
|
||||
SelList.Clear;
|
||||
|
||||
AugmentChk.Checked := false;
|
||||
PairwiseChk.Checked := false;
|
||||
CrossProdChk.Checked := false;
|
||||
VarCovarChk.Checked := false;
|
||||
CorrsChk.Checked := false;
|
||||
MeansChk.Checked := false;
|
||||
VarsChk.Checked := false;
|
||||
StdDevsChk.Checked := false;
|
||||
|
||||
CrossProdPage.TabVisible := CrossProdChk.Checked;
|
||||
VarCovarPage.TabVisible := VarCovarChk.Checked;
|
||||
InterCorrPage.TabVisible := CorrsChk.Checked;
|
||||
StatsPage.TabVisible := MeansChk.Checked or VarsChk.Checked or StdDevsChk.Checked;
|
||||
PairwisePage.TabVisible := PairwiseChk.Checked;
|
||||
|
||||
if FCreated then
|
||||
begin
|
||||
FCrossProdReportFrame.Clear;
|
||||
FVarCovarReportFrame.Clear;
|
||||
FIntercorrReportFrame.Clear;
|
||||
FStatsReportFrame.Clear;
|
||||
FPairwiseReportFrame.Clear;
|
||||
end;
|
||||
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.SelectVisiblePage;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if PageControl.Pages[PageControl.ActivePageIndex].TabVisible then
|
||||
exit;
|
||||
|
||||
for i := 0 to PageControl.PageCount-1 do
|
||||
if PageControl.Pages[i].TabVisible then
|
||||
begin
|
||||
PageControl.ActivePageIndex := i;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.SelListDblClick(Sender: TObject);
|
||||
var
|
||||
index: Integer;
|
||||
begin
|
||||
index := SelList.ItemIndex;
|
||||
if index > -1 then
|
||||
begin
|
||||
VarList.Items.Add(SelList.Items[index]);
|
||||
SelList.Items.Delete(index);
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.SelListSelectionChange(Sender: TObject; User: boolean);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.Stats(ANumVars, ANumCases: Integer; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const AColLabels: StrDyneVec);
|
||||
var
|
||||
lReport: TStrings;
|
||||
begin
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
if MeansChk.Checked then
|
||||
DynVectorPrint(AMeans, ANumVars, 'Means', AColLabels, ANumCases, lReport);
|
||||
|
||||
if MeansChk.Checked and (VarsChk.Checked or StdDevsChk.Checked) then
|
||||
begin
|
||||
lReport.Add(DIVIDER_SMALL_AUTO);
|
||||
lReport.Add('');
|
||||
end;
|
||||
|
||||
if VarsChk.Checked then
|
||||
DynVectorPrint(AVars, ANumVars, 'Variances', AColLabels, ANumCases, lReport);
|
||||
|
||||
if (MeansChk.Checked or VarsChk.Checked) and StdDevsChk.Checked then
|
||||
begin
|
||||
lReport.Add(DIVIDER_SMALL_AUTO);
|
||||
lReport.Add('');
|
||||
end;
|
||||
|
||||
if StdDevsChk.Checked then
|
||||
DynVectorPrint(AStdDevs, ANumVars, 'Standard Deviations', AColLabels, ANumCases, lReport);
|
||||
|
||||
FStatsReportFrame.DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.UpdateBtnStates;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
InBtn.Enabled := AnySelected(VarList);
|
||||
OutBtn.Enabled := AnySelected(SelList);
|
||||
AllBtn.Enabled := Varlist.Count > 0;
|
||||
|
||||
if not FCreated then
|
||||
exit;
|
||||
|
||||
FCrossProdReportFrame.UpdateBtnStates;
|
||||
FVarCovarReportFrame.UpdateBtnStates;
|
||||
FIntercorrReportFrame.UpdateBtnStates;
|
||||
FStatsReportFrame.UpdateBtnStates;
|
||||
FPairwiseReportFrame.UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.VarCovar(ANumVars: Integer; const AColNoSelected: IntDyneVec;
|
||||
const AMatrix: DblDyneMat; const AMeans, AVars, AStdDevs: DblDyneVec;
|
||||
const ARowLabels, AColLabels: StrDyneVec);
|
||||
var
|
||||
lReport: TStrings;
|
||||
nGood: Integer = 0;
|
||||
hasError: Boolean = false;
|
||||
begin
|
||||
GridCovar(ANumVars, AColNoSelected, AMatrix, AMeans, AVars, AStdDevs, HasError, nGood);
|
||||
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
MatPrint(AMatrix, ANumVars, ANumVars, 'Variance-Covariance Matrix', ARowLabels, AColLabels, nGood, lReport);
|
||||
|
||||
if hasError then
|
||||
begin
|
||||
lReport.Add('');
|
||||
lReport.Add('One or more correlations could not be computed due to zero variance of a variable.');
|
||||
end;
|
||||
|
||||
FVarCovarReportFrame.DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TRMatFrm.VarListDblClick(Sender: TObject);
|
||||
var
|
||||
index: Integer;
|
||||
begin
|
||||
index := VarList.ItemIndex;
|
||||
if index > -1 then
|
||||
begin
|
||||
SelList.Items.Add(VarList.Items[index]);
|
||||
Varlist.Items.Delete(index);
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRMatFrm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I rmatunit.lrs}
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user