LazStats: Inherit CanonUnit from BasicStatsReportFormUnit. Rename TCannonFrm to TCanonicalForm.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7870 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-11-14 22:04:06 +00:00
parent 1fff8a79e6
commit a79a11251f
4 changed files with 647 additions and 670 deletions

View File

@ -477,7 +477,7 @@
<Unit46>
<Filename Value="forms\analysis\correlation\canonunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CannonFrm"/>
<ComponentName Value="CanonicalForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CanonUnit"/>

View File

@ -1,468 +1,236 @@
object CannonFrm: TCannonFrm
inherited CanonicalForm: TCanonicalForm
Left = 350
Height = 379
Height = 366
Top = 137
Width = 401
Width = 727
HelpType = htKeyword
HelpKeyword = 'html/CanonicalCorrelation.htm'
AutoSize = True
Caption = 'Canonical Correlation Analysis'
ClientHeight = 379
ClientWidth = 401
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 72
Top = 258
Width = 225
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 52
ClientWidth = 221
TabOrder = 1
object CorsChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 87
Caption = 'Correlations'
TabOrder = 0
ClientHeight = 366
ClientWidth = 727
inherited ParamsPanel: TPanel
Height = 350
ClientHeight = 350
inherited CloseBtn: TButton
Top = 325
TabOrder = 11
end
object InvChk: TCheckBox
Left = 115
Height = 19
Top = 6
Width = 94
Caption = 'Matrix Inverse'
TabOrder = 1
inherited ComputeBtn: TButton
Top = 325
TabOrder = 10
end
object EigenChk: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 87
Caption = 'Eigenvectors'
TabOrder = 2
inherited ResetBtn: TButton
Top = 325
TabOrder = 9
end
object RedundChk: TCheckBox
Left = 115
Height = 19
Top = 27
Width = 94
Caption = 'Redundancies'
TabOrder = 3
inherited HelpBtn: TButton
Tag = 111
Top = 325
TabOrder = 8
end
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 192
Height = 25
Top = 346
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 254
Height = 25
Top = 346
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 4
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 338
Height = 25
Top = 346
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 5
end
object HelpBtn: TButton
Tag = 111
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 133
Height = 25
Top = 346
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 2
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 330
Width = 401
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 0
Height = 258
Top = 0
Width = 401
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 258
ClientWidth = 401
TabOrder = 0
object Label1: TLabel
AnchorSideTop.Control = Panel1
Left = 8
inherited ButtonBevel: TBevel
Top = 309
end
object GroupBox1: TGroupBox[5]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 72
Top = 237
Width = 225
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 52
ClientWidth = 221
TabOrder = 7
object CorsChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 87
Caption = 'Correlations'
TabOrder = 0
end
object InvChk: TCheckBox
Left = 115
Height = 19
Top = 6
Width = 94
Caption = 'Matrix Inverse'
TabOrder = 1
end
object EigenChk: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 87
Caption = 'Eigenvectors'
TabOrder = 2
end
object RedundChk: TCheckBox
Left = 115
Height = 19
Top = 27
Width = 94
Caption = 'Redundancies'
TabOrder = 3
end
end
object Label1: TLabel[6]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 15
Top = 8
Top = 0
Width = 100
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables:'
ParentColor = False
end
object Label2: TLabel
object Label2: TLabel[7]
AnchorSideLeft.Control = LeftList
Left = 222
AnchorSideTop.Control = ParamsPanel
Left = 166
Height = 15
Top = 8
Top = 0
Width = 103
BorderSpacing.Top = 8
Caption = 'Left-Hand Variables'
ParentColor = False
end
object Label3: TLabel
object Label3: TLabel[8]
AnchorSideLeft.Control = RightList
AnchorSideTop.Control = VarList
AnchorSideTop.Side = asrCenter
Left = 222
Left = 164
Height = 15
Top = 130
Top = 116
Width = 111
Caption = 'Right-Hand Variables'
ParentColor = False
end
object VarList: TListBox
object VarList: TListBox[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LeftIn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 225
Top = 25
Width = 170
AnchorSideBottom.Control = GroupBox1
Left = 0
Height = 212
Top = 17
Width = 126
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
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object LeftIn: TBitBtn
AnchorSideLeft.Control = Panel1
object LeftIn: TBitBtn[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 186
Height = 28
Top = 25
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
}
Left = 132
Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = LeftInClick
Spacing = 0
TabOrder = 1
end
object LeftOut: TBitBtn
AnchorSideLeft.Control = Panel1
object LeftOut: TBitBtn[11]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = LeftIn
AnchorSideTop.Side = asrBottom
Left = 186
Height = 28
Top = 57
Width = 28
Left = 132
Height = 26
Top = 47
Width = 26
BorderSpacing.Top = 4
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 = LeftOutClick
Spacing = 0
TabOrder = 2
TabOrder = 3
end
object RightIn: TBitBtn
AnchorSideLeft.Control = Panel1
object RightIn: TBitBtn[12]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = RightOut
Left = 186
Height = 28
Top = 190
Width = 28
Left = 132
Height = 26
Top = 173
Width = 26
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 4
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 = RightInClick
Spacing = 0
TabOrder = 4
end
object RightOut: TBitBtn
AnchorSideLeft.Control = Panel1
object RightOut: TBitBtn[13]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 186
Height = 28
Top = 222
Width = 28
Left = 132
Height = 26
Top = 203
Width = 26
Anchors = [akLeft, akBottom]
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 = RightOutClick
Spacing = 0
TabOrder = 5
end
object LeftList: TListBox
object LeftList: TListBox[14]
AnchorSideLeft.Control = LeftIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label3
Left = 222
Height = 89
Top = 25
Width = 171
Left = 166
Height = 87
Top = 17
Width = 125
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 16
BorderSpacing.Bottom = 12
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 3
TabOrder = 2
end
object RightList: TListBox
AnchorSideLeft.Control = LeftList
object RightList: TListBox[15]
AnchorSideLeft.Control = RightIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LeftList
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 222
Height = 103
Top = 147
Width = 171
Left = 164
Height = 96
Top = 133
Width = 127
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
ItemHeight = 0
MultiSelect = True
@ -470,4 +238,40 @@ object CannonFrm: TCannonFrm
TabOrder = 6
end
end
inherited ParamsSplitter: TSplitter
Height = 366
end
object PageControl: TPageControl[2]
Left = 314
Height = 350
Top = 8
Width = 405
ActivePage = RedundanciesPage
Align = alClient
BorderSpacing.Left = 6
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabIndex = 4
TabOrder = 2
object ResultsPage: TTabSheet
Caption = 'Results'
end
object CorrelationsPage: TTabSheet
Caption = 'Correlations'
TabVisible = False
end
object EigenVectorsPage: TTabSheet
Caption = 'Eigenvectors'
TabVisible = False
end
object MatrixInversePage: TTabSheet
Caption = 'Matrix Inverse'
TabVisible = False
end
object RedundanciesPage: TTabSheet
Caption = 'Redundancies'
TabVisible = False
end
end
end

View File

@ -7,25 +7,19 @@ unit CanonUnit;
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls,
MainUnit, OutputUnit, FunctionsLib, GraphLib, Globals, MatrixLib,
ContextHelpUnit;
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, ComCtrls,
MainUnit, FunctionsLib, Globals, MatrixLib, ReportFrameUnit, BasicStatsReportFormUnit;
type
{ TCannonFrm }
{ TCanonicalForm }
TCannonFrm = class(TForm)
Bevel1: TBevel;
HelpBtn: TButton;
Panel1: TPanel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
TCanonicalForm = class(TBasicStatsReportForm)
CorsChk: TCheckBox;
InvChk: TCheckBox;
EigenChk: TCheckBox;
PageControl: TPageControl;
RedundChk: TCheckBox;
GroupBox1: TGroupBox;
LeftIn: TBitBtn;
@ -37,158 +31,151 @@ type
Label3: TLabel;
LeftList: TListBox;
RightList: TListBox;
ResultsPage: TTabSheet;
CorrelationsPage: TTabSheet;
EigenVectorsPage: TTabSheet;
MatrixInversePage: TTabSheet;
RedundanciesPage: TTabSheet;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure LeftInClick(Sender: TObject);
procedure LeftOutClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure RightInClick(Sender: TObject);
procedure RightOutClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
private
{ private declarations }
FAutoSized: Boolean;
procedure UpdateBtnStates;
FCorrelationsReportFrame: TReportFrame;
FEigenvectorsReportFrame: TReportFrame;
FMatrixInverseReportFrame: TReportFrame;
FRedundanciesReportFrame: TReportFrame;
FCreated: Boolean;
procedure ShowCorrelations(const CorrAA, CorrBB, CorrAB: DblDyneMat;
ASize, BSize, ANumCases: Integer; const ARowLabels, AColLabels: StrDyneVec);
procedure ShowEigenvectors(const AEigenVectors: DblDyneMat;
AMatSize, ANumCases: Integer; const ALabels: StrDyneVec);
procedure ShowInverseMatrix(const InvMatrixA, InvMatrixB: DblDyneMat;
SizeA, SizeB, ANumCases: Integer; const ARowLabels, AColLabels: StrDyneVec);
procedure ShowRedundancy(const VarPropA, VarPropB, RedundA, RedundB: DblDyneVec;
ASize: Integer);
protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
public
{ public declarations }
constructor Create(AOwner: TComponent); override;
procedure Reset; override;
end;
var
CannonFrm: TCannonFrm;
CanonicalForm: TCanonicalForm;
implementation
{$R *.lfm}
uses
Math,
Utils, MathUnit;
{ TCannonFrm }
procedure TCannonFrm.ResetBtnClick(Sender: TObject);
var
i: integer;
{ TCanonicalForm }
constructor TCanonicalForm.Create(AOwner: TComponent);
begin
VarList.Clear;
LeftList.Clear;
RightList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
UpdateBtnStates;
inherited;
FReportFrame.Parent := ResultsPage;
FReportFrame.Align := alClient;
InitToolbar(FReportFrame.ReportToolbar, tpTop);
FReportFrame.ClearBorderSpacings;
FCorrelationsReportFrame := TReportFrame.Create(self);
FCorrelationsReportFrame.Parent := CorrelationsPage;
FCorrelationsReportFrame.Align := alClient;
FEigenvectorsReportFrame := TReportFrame.Create(self);
FEigenvectorsReportFrame.Parent := EigenVectorsPage;
FEigenvectorsReportFrame.Align := alClient;
FMatrixInverseReportFrame := TReportFrame.Create(self);
FMatrixInverseReportFrame.Parent := MatrixInversePage;
FMatrixInverseReportFrame.Align := alClient;
FRedundanciesReportFrame := TReportFrame.Create(self);
FRedundanciesReportFrame.Parent := RedundanciesPage;
FRedundanciesReportFrame.Align := alClient;
PageControl.ActivePageIndex := 0;
FCreated := true;
end;
procedure TCannonFrm.RightInClick(Sender: TObject);
var
i: integer;
procedure TCanonicalForm.AdjustConstraints;
begin
i := 0;
while i < VarList.Items.Count do
begin
if VarList.Selected[i] then
begin
RightList.Items.Add(VarList.Items[i]);
VarList.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
inherited;
ParamsPanel.Constraints.MinHeight :=
LeftIn.Height * 6 + GroupBox1.Height +
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
ParamsPanel.Constraints.MinWidth :=
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left;
end;
procedure TCannonFrm.RightOutClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while i < RightList.Items.Count do
begin
if RightList.Selected[i] then
begin
VarList.Items.Add(RightList.Items[i]);
RightList.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TCannonFrm.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;
w := MaxValue([Label1.Width, Label2.Width, Label3.Width]) + LeftIn.Width + 4 * VarList.BorderSpacing.Left;
if w > Width then
Constraints.MinWidth := w
else
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TCannonFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TCannonFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TCannonFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TCannonFrm.ComputeBtnClick(Sender: TObject);
procedure TCanonicalForm.Compute;
var
i, j, k, count, a_size, b_size, no_factors, novars: integer;
cellstring, gridstring: string;
s, m, n, df1, df2, q, w, pcnt_extracted, trace : double;
minroot, critical_prob, Lambda, Pillia : double;
chisqr, HLTrace, chiprob, ftestprob, Roys, f, Hroot : double;
raa, rbb, rab, rba, bigmat, first_prod, second_prod : DblDyneMat;
char_equation, raainv, rbbinv, eigenvectors, norm_a, norm_b : DblDyneMat;
raw_a, raw_b, a_cors, b_cors, eigentrans, theta, tempmat : DblDyneMat;
mean, variance, stddev, roots, root_chi, chi_prob, pv_a, pv_b : DblDyneVec;
rd_a, rd_b, pcnt_trace : DblDyneVec;
root_df, a_vars, b_vars : IntDyneVec;
raa: DblDyneMat = nil;
rbb: DblDyneMat = nil;
rab: DblDyneMat = nil;
rba: DblDyneMat = nil;
bigmat: DblDyneMat = nil;
first_prod: DblDyneMat = nil;
second_prod: DblDyneMat = nil;
char_equation: DblDyneMat = nil;
raainv: DblDyneMat = nil;
rbbinv: DblDyneMat = nil;
eigenvectors: DblDyneMat = nil;
norm_a: DblDyneMat = nil;
norm_b : DblDyneMat = nil;
raw_a: DblDyneMat = nil;
raw_b: DblDyneMat = nil;
a_cors: DblDyneMat = nil;
b_cors: DblDyneMat = nil;
eigentrans: DblDyneMat = nil;
theta: DblDyneMat = nil;
tempmat: DblDyneMat = nil;
mean: DblDyneVec = nil;
variance: DblDyneVec = nil;
stddev: DblDyneVec = nil;
roots: DblDyneVec = nil;
root_chi: DblDyneVec = nil;
chi_prob: DblDyneVec = nil;
pv_a: DblDyneVec = nil;
pv_b: DblDyneVec = nil;
rd_a: DblDyneVec = nil;
rd_b: DblDyneVec = nil;
pcnt_trace: DblDyneVec = nil;
root_df: IntDyneVec = nil;
a_vars: IntDyneVec = nil;
b_vars: IntDyneVec = nil;
selected : IntDyneVec;
RowLabels, ColLabels : StrDyneVec;
CanLabels : StrDyneVec;
title : string;
RowLabels: StrDyneVec = nil;
ColLabels: StrDyneVec = nil;
CanLabels: StrDyneVec = nil;
title: string;
NCases: integer = 0;
errorcode: boolean = false;
lReport: TStrings;
begin
if LeftList.Items.Count = 0 then
begin
MessageDlg('No left-hand variable selected.', mtError, [mbOK], 0);
exit;
end;
if RightList.Items.Count = 0 then
begin
MessageDlg('No right-hand variable selected.', mtError, [mbOK], 0);
exit;
end;
k := 0;
no_factors := 0;
pcnt_extracted := 0.0;
@ -250,13 +237,13 @@ begin
//------------ WORK STARTS HERE! -------------------------------------
// Build labels for canonical functions 1 to novars
for i := 1 to b_size do
CanLabels[i-1]:='Var. ' + IntToStr(i);
for i := 0 to b_size-1 do
CanLabels[i] := 'Var. ' + IntToStr(i+1);
// identify variables selected for left and right variables
for i := 0 to a_size - 1 do // identify left variables
begin
cellstring := LeftList.Items.Strings[i];
cellstring := LeftList.Items[i];
for j := 1 to NoVariables do
begin
gridstring := OS3MainFrm.DataGrid.Cells[j,0];
@ -271,7 +258,7 @@ begin
// identify left variables
for i := 0 to b_size - 1 do
begin
cellstring := RightList.Items.Strings[i];
cellstring := RightList.Items[i];
for j := 1 to NoVariables do
begin
gridstring := OS3MainFrm.DataGrid.Cells[j,0];
@ -283,11 +270,12 @@ begin
end;
end;
// build list of all variables selected
for i := 1 to a_size do
selected[i-1] := a_vars[i-1];
for i := 1 to b_size do
selected[i-1 + a_size] := b_vars[i-1];
// Build list of all variables selected
for i := 0 to a_size-1 do
selected[i] := a_vars[i];
for i := 0 to b_size-1 do
selected[i + a_size] := b_vars[i];
lReport := TStringList.Create;
try
@ -295,74 +283,65 @@ begin
lReport.Add('');
// Get means, standard deviations, etc. for total matrix
Correlations(novars,selected,bigmat,mean,variance,stddev,errorcode,Ncases);
count := Ncases;
Correlations(novars, selected, bigmat, mean, variance, stddev, errorcode, Ncases);
count := nCases;
if errorcode then // wp: was "if (IER = 1) then", but IER is not initialized...
begin
MessageDlg('Zero variance found for a variable-terminating', mtError, [mbOK], 0);
MessageDlg('Zero variance found for a variable. Terminating', mtError, [mbOK], 0);
exit;
end;
//partition matrix into quadrants
for i := 1 to a_size do
for j := 1 to a_size do raa[i-1,j-1]:= bigmat[i-1,j-1];
// Partition matrix into quadrants
for i := 0 to a_size-1 do
for j := 0 to a_size-1 do raa[i, j]:= bigmat[i, j];
for i := a_size + 1 to novars do
for j := a_size + 1 to novars do
rbb[i-1-a_size,j-1-a_size] := bigmat[i-1,j-1];
for i := a_size to novars-1 do
for j := a_size to novars-1 do
rbb[i-a_size, j-a_size] := bigmat[i, j];
for i := 1 to a_size do
for j := a_size + 1 to novars do
rab[i-1,j-1-a_size] := bigmat[i-1,j-1];
for i := 0 to a_size-1 do
for j := a_size to novars-1 do
rab[i, j-a_size] := bigmat[i,j];
for i := a_size + 1 to novars do
for j := 1 to a_size do
rba[i-1-a_size,j-1] := bigmat[i-1,j-1];
for i := a_size to novars-1 do
for j := 0 to a_size-1 do
rba[i-a_size, j] := bigmat[i, j];
if CorsChk.Checked then
begin
title := 'Left Correlation Matrix';
MatPrint(raa, a_size, a_size, title, RowLabels, RowLabels, NCases, lReport);
title := 'Right Correlation Matrix';
MatPrint(rbb, b_size, b_size, title, ColLabels, ColLabels, NCases, lReport);
title := 'Left-Right Correlation Matrix';
MatPrint(rab, a_size, b_size, title, RowLabels, ColLabels, NCases, lReport);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add('');
end;
CorrelationsPage.TabVisible := true;
ShowCorrelations(raa, rbb, rab, a_size, b_size, nCases, rowLabels, colLabels);
end else
CorrelationsPage.TabVisible := false;
// get inverses of left and right hand matrices raa and rbb
for i := 1 to a_size do
for j := 1 to a_size do
raainv[i-1,j-1] := raa[i-1,j-1];
// Get inverses of left and right hand matrices raa and rbb
for i := 0 to a_size-1 do
for j := 0 to a_size-1 do
raainv[i, j] := raa[i, j];
SVDinverse(raainv, a_size);
for i := 0 to b_size-1 do
for j := 0 to b_size-1 do
rbbinv[i, j] := rbb[i, j];
SVDinverse(rbbinv, b_size);
if InvChk.Checked then
begin
title := 'Inverse of Left Matrix';
MatPrint(raainv, a_size, a_size, title, RowLabels, RowLabels, NCases, lReport);
end;
MatrixInversePage.TabVisible := true;
ShowInverseMatrix(raaInv, rbbInv, a_size, b_size, nCases, RowLabels, ColLabels);
end else
MatrixInversePage.TabVisible := false;
for i := 1 to b_size do
for j := 1 to b_size do
rbbinv[i-1,j-1] := rbb[i-1,j-1];
SVDinverse(rbbinv,b_size);
if InvChk.Checked then
begin
title := 'Inverse of Right Matrix';
MatPrint(rbbinv, b_size, b_size, title, ColLabels, ColLabels, NCases, lReport);
end;
// get products of raainv x rab and the rbbinv x rba matrix
MatAxB(first_prod,rbbinv,rba,b_size,b_size,b_size,a_size,errorcode);
MatAxB(second_prod,raainv,rab,a_size,a_size,a_size,b_size,errorcode);
// Get products of raainv x rab and the rbbinv x rba matrix
MatAxB(first_prod, rbbinv, rba, b_size, b_size, b_size, a_size, errorcode);
MatAxB(second_prod, raainv, rab, a_size, a_size, a_size, b_size, errorcode);
title := 'Right Inverse x Right-Left Matrix';
MatPrint(first_prod, b_size, a_size, title, ColLabels, RowLabels, NCases, lReport);
title := 'Left Inverse x Left-Right Matrix';
MatPrint(second_prod, a_size, b_size, title, RowLabels, ColLabels, NCases, lReport);
//get characteristic equations matrix (product of last two product matrices
//The product should yeild rows and cols representing the smaller of the two sets
// Get characteristic equations matrix (product of last two product matrices)
// The product should yield rows and cols representing the smaller of the two sets
MatAxB(char_equation,first_prod,second_prod,b_size,a_size, a_size,b_size,errorcode);
title := 'Canonical Function';
MatPrint(char_equation, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
@ -371,77 +350,85 @@ begin
lReport.Add(DIVIDER);
lReport.Add('');
// now get roots and vectors of the characteristic equation using
// NonSymRoots routine
// Get roots and vectors of the characteristic equation using NonSymRoots routine
minroot := 0.0;
for i := 1 to b_size do
for i := 0 to b_size-1 do
begin
roots[i-1] := 0.0;
pcnt_trace[i-1] := 0.0;
for j := 1 to b_size do eigenvectors[i-1,j-1] := 0.0;
roots[i] := 0.0;
pcnt_trace[i] := 0.0;
for j := 0 to b_size-1 do eigenvectors[i,j] := 0.0;
end;
trace := 0.0;
no_factors := b_size;
nonsymroots(char_equation, b_size, no_factors, minroot, eigenvectors, roots,
NonSymRoots(char_equation, b_size, no_factors, minroot, eigenvectors, roots,
pcnt_trace, trace, pcnt_extracted);
lReport.Add('Trace of the matrix: %10.4f', [trace]);
lReport.Add('Percent of trace extracted: %10.4f', [pcnt_extracted]);
// Normalize smaller set weights and coumpute larger set weights
// Normalize smaller set weights and compute larger set weights
MatTrn(eigentrans, eigenvectors, b_size, b_size);
MatAxB(tempmat,eigentrans,rbb,b_size,b_size,b_size,b_size,errorcode);
MatAxB(theta,tempmat,eigenvectors,b_size,b_size,b_size,b_size,errorcode);
for j := 1 to b_size do
MatAxB(tempmat, eigentrans, rbb, b_size, b_size, b_size, b_size, errorcode);
MatAxB(theta, tempmat, eigenvectors, b_size, b_size ,b_size, b_size, errorcode);
for j := 0 to b_size-1 do
begin
q := 1.0 / sqrt(theta[j-1,j-1]);
for i := 1 to b_size do
q := 1.0 / sqrt(theta[j, j]);
for i := 0 to b_size-1 do
begin
norm_b[i-1,j-1] := eigenvectors[i-1,j-1] * q;
raw_b[i-1,j-1] := norm_b[i-1,j-1] / stddev[a_size+i-1];
norm_b[i, j] := eigenvectors[i, j] * q;
raw_b[i, j] := norm_b[i, j] / stddev[a_size+i];
end;
end;
MatAxB(norm_a,second_prod,norm_b,a_size,b_size,b_size,b_size,errorcode);
for j := 1 to b_size do
MatAxB(norm_a, second_prod, norm_b, a_size, b_size, b_size, b_size, errorcode);
for j := 0 to b_size-1 do
begin
for i := 1 to a_size do
for i := 0 to a_size-1 do
begin
norm_a[i-1,j-1] := norm_a[i-1,j-1] * (1.0 / sqrt(roots[j-1]));
raw_a[i-1,j-1] := norm_a[i-1,j-1] / stddev[i-1];
norm_a[i, j] := norm_a[i, j] * (1.0 / sqrt(roots[j]));
raw_a[i, j] := norm_a[i, j] / stddev[i];
end;
end;
// Compute the correlations between variables and canonical variables
MatAxB(a_cors,raa,norm_a,a_size,a_size,a_size,b_size,errorcode);
for j := 1 to b_size do
for j := 0 to b_size-1 do
begin
q := 0.0;
for i := 1 to a_size do q := q + norm_a[i-1,j-1] * a_cors[i-1,j-1];
for i := 0 to a_size-1 do
q := q + norm_a[i, j] * a_cors[i, j];
q := 1.0 / sqrt(q);
for i := 1 to a_size do a_cors[i-1,j-1] := a_cors[i-1,j-1] * q;
for i := 0 to a_size-1 do a_cors[i, j] := a_cors[i, j] * q;
end;
MatAxB(b_cors,rbb,norm_b,b_size,b_size,b_size,b_size,errorcode);
for j := 1 to b_size do
for j := 0 to b_size-1 do
begin
q := 0.0;
for i := 1 to b_size do q := q + norm_b[i-1,j-1] * b_cors[i-1,j-1];
for i := 0 to b_size-1 do
q := q + norm_b[i, j] * b_cors[i, j];
q := 1.0 / sqrt(q);
for i := 1 to b_size do b_cors[i-1,j-1] := b_cors[i-1,j-1] * q;
for i := 0 to b_size-1 do b_cors[i, j] := b_cors[i, j] * q;
end;
// Compute the Proportions of Variance (PVs) and Redundancy Coefficients
for j := 1 to b_size do
for j := 0 to b_size-1 do
begin
pv_a[j-1] := 0.0;
for i := 1 to a_size do pv_a[j-1] := pv_a[j-1] + (a_cors[i-1,j-1] * a_cors[i-1,j-1]);
pv_a[j-1] := pv_a[j-1] / a_size;
rd_a[j-1] := pv_a[j-1] * roots[j-1];
pv_a[j] := 0.0;
for i := 0 to a_size-1 do
pv_a[j] := pv_a[j] + sqr(a_cors[i, j]);
pv_a[j] := pv_a[j] / a_size;
rd_a[j] := pv_a[j] * roots[j];
end;
for j := 1 to b_size do
for j := 0 to b_size-1 do
begin
pv_b[j-1] := 0.0;
for i := 1 to b_size do pv_b[j-1] := pv_b[j-1] + (b_cors[i-1,j-1] * b_cors[i-1,j-1]);
pv_b[j-1] := pv_b[j-1] / b_size;
rd_b[j-1] := pv_b[j-1] * roots[j-1];
pv_b[j] := 0.0;
for i := 0 to b_size-1 do
pv_b[j] := pv_b[j] + sqr(b_cors[i, j]);
pv_b[j] := pv_b[j] / b_size;
rd_b[j] := pv_b[j] * roots[j];
end;
// Compute tests of the roots
@ -459,9 +446,9 @@ begin
end;
Roys := roots[0] / (1.0 - roots[0]);
Lambda := 1.0;
for i := 1 to b_size do
for i := 0 to b_size-1 do
begin
Hroot := roots[i-1] / (1.0 - roots[i-1]);
Hroot := roots[i] / (1.0 - roots[i]);
Lambda := Lambda * (1.0 / (1.0 + Hroot));
Pillia := Pillia + (Hroot / (1.0 + Hroot));
HLTrace := HLTrace + Hroot;
@ -470,9 +457,9 @@ begin
// Print remaining results
lReport.Add(' Canonical R Root % Trace Chi-Sqr D.F. Prob. ');
lReport.Add('-- ----------- -------- --------- --------- ---- --------');
for i := 1 to b_size do
for i := 0 to b_size-1 do
lReport.Add('%2d %11.6f %8.3f %9.3f %9.3f %4d %8.3f',
[i, sqrt(roots[i-1]), roots[i-1], pcnt_trace[i-1], root_chi[i-1], root_df[i-1], chi_prob[i-1]]
[i+1, sqrt(roots[i]), roots[i], pcnt_trace[i], root_chi[i], root_df[i], chi_prob[i]]
);
chisqr := -ln(Lambda) * (count - 1.0 - 0.5 * (a_size + b_size - 1.0));
chiprob := 1.0 - chisquaredprob(chisqr,a_size * b_size);
@ -504,17 +491,15 @@ begin
lReport.Add('Roys Largest Root F-Test %10.4f %2.0f %2.0f %12.4f', [Roys, df1, df2, ftestprob]);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
if EigenChk.Checked then
begin
title := 'Eigenvectors';
MatPrint(eigenvectors, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add('');
end;
EigenvectorsPage.TabVisible := True;
ShowEigenVectors(eigenVectors, b_size, nCases, CanLabels);
end else
EigenvectorsPage.TabVisible := False;
title := 'Standardized Right Side Weights';
MatPrint(norm_a, a_size, b_size, title, RowLabels, CanLabels, NCases, lReport);
@ -523,7 +508,7 @@ begin
MatPrint(norm_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
title := 'Raw Right Side Weights';
@ -533,7 +518,7 @@ begin
MatPrint(raw_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
title := 'Right Side Correlations with Function';
@ -542,33 +527,14 @@ begin
title := 'Left Side Correlations with Function';
MatPrint(b_cors, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add('');
if RedundChk.Checked then
begin
lReport.Add('Redundancy Analysis for Right Side Variables');
lReport.Add('');
lReport.Add(' Variance Prop. Redundancy ');
lReport.Add('---------- --------------- ---------------');
for i := 1 to b_size do
lReport.Add('%8d %15.5f %12.5f', [i, pv_a[i-1], rd_a[i-1]]);
lReport.Add('');
RedundanciesPage.TabVisible := true;
ShowRedundancy(pv_a, pv_b, rd_a, rd_b, b_size);
end else
RedundanciesPage.TabVisible := false;
lReport.Add('Redundancy Analysis for Left Side Variables');
lReport.Add('');
lReport.Add(' Variance Prop. Redundancy ');
lReport.Add('---------- --------------- ------------');
for i := 1 to b_size do
lReport.Add('%8d %15.5f %12.5f', [i, pv_b[i-1], rd_b[i-1]]);
lReport.Add('');
lReport.Add(DIVIDER);
lReport.Add('');
end;
DisplayReport(lReport);
FReportFrame.DisplayReport(lReport);
finally
lReport.Free;
@ -612,7 +578,7 @@ begin
end;
end;
procedure TCannonFrm.LeftInClick(Sender: TObject);
procedure TCanonicalForm.LeftInClick(Sender: TObject);
var
i: integer;
begin
@ -630,7 +596,7 @@ begin
UpdateBtnStates;
end;
procedure TCannonFrm.LeftOutClick(Sender: TObject);
procedure TCanonicalForm.LeftOutClick(Sender: TObject);
var
i: integer;
begin
@ -648,24 +614,228 @@ begin
UpdateBtnStates;
end;
procedure TCannonFrm.VarListSelectionChange(Sender: TObject; User: boolean);
procedure TCanonicalForm.Reset;
var
i: integer;
begin
inherited;
LeftList.Clear;
RightList.Clear;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
if FCreated then
begin
FCorrelationsReportFrame.Clear;
FEigenvectorsReportFrame.Clear;
FMatrixInverseReportFrame.Clear;
FRedundanciesReportFrame.Clear;
enD;
CorrelationsPage.TabVisible := false;
EigenVectorsPage.TabVisible := false;
MatrixInversePage.TabVisible := false;
RedundanciesPage.TabVisible := false;
UpdateBtnStates;
end;
procedure TCannonFrm.UpdateBtnStates;
procedure TCanonicalForm.RightInClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while i < VarList.Items.Count do
begin
if VarList.Selected[i] then
begin
RightList.Items.Add(VarList.Items[i]);
VarList.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TCanonicalForm.RightOutClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while i < RightList.Items.Count do
begin
if RightList.Selected[i] then
begin
VarList.Items.Add(RightList.Items[i]);
RightList.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TCanonicalForm.ShowCorrelations(const CorrAA, CorrBB, CorrAB: DblDyneMat;
ASize, BSize, ANumCases: Integer; const ARowLabels, AColLabels: StrDyneVec);
var
lReport: TStrings;
title: String;
begin
lReport := TStringList.Create;
try
title := 'LEFT CORRELATION MATRIX';
MatPrint(CorrAA, ASize, ASize, title, ARowLabels, ARowLabels, ANumCases, lReport);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
title := 'RIGHT CORRELATION MATRIX';
MatPrint(CorrBB, BSize, BSize, title, AColLabels, AColLabels, ANumCases, lReport);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
title := 'LEFT_RIGHT CORRELATION MATRIX';
MatPrint(CorrAB, ASize, BSize, title, ARowLabels, AColLabels, ANumCases, lReport);
FCorrelationsReportFrame.DisplayReport(lReport);
finally
lReport.Free;
end;
end;
procedure TCanonicalForm.ShowEigenvectors(const AEigenVectors: DblDyneMat;
AMatSize, ANumCases: Integer; const ALabels: StrDyneVec);
var
lReport: TStrings;
title: String;
begin
lReport := TStringList.Create;
try
title := 'Eigenvectors';
MatPrint(AEigenvectors, AMatSize, AMatSize, title, ALabels, ALabels, ANumCases, lReport);
FEigenvectorsReportFrame.DisplayReport(lReport);
finally
lReport.Free;
end;
end;
procedure TCanonicalForm.ShowInverseMatrix(const InvMatrixA, InvMatrixB: DblDyneMat;
SizeA, SizeB, ANumCases: Integer; const ARowLabels, AColLabels: StrDyneVec);
var
lReport: TStrings;
title: String;
begin
lReport := TStringList.Create;
try
title := 'Inverse of Left Matrix';
MatPrint(InvMatrixA, SizeA, SizeB, title, ARowLabels, ARowLabels, ANumCases, lReport);
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
title := 'Inverse of Right Matrix';
MatPrint(InvMatrixB, SizeB, SizeB, title, AColLabels, AColLabels, ANumCases, lReport);
FMatrixInverseReportFrame.DisplayReport(lReport);
finally
lReport.Free;
end;
end;
procedure TCanonicalForm.ShowRedundancy(
const VarPropA, VarPropB, RedundA, RedundB: DblDyneVec;
ASize: Integer);
var
lReport: TStrings;
i: Integer;
begin
lReport := TStringList.Create;
try
lReport.Add('Redundancy Analysis for Right Side Variables');
lReport.Add('');
lReport.Add(' Variance Prop. Redundancy ');
lReport.Add('---------- --------------- ---------------');
for i := 0 to ASize-1 do
lReport.Add('%8d %15.5f %12.5f', [i+1, VarPropA[i], RedundA[i]]);
lReport.Add('');
lReport.Add(DIVIDER_SMALL_AUTO);
lReport.Add('');
lReport.Add('Redundancy Analysis for Left Side Variables');
lReport.Add('');
lReport.Add(' Variance Prop. Redundancy ');
lReport.Add('---------- --------------- ------------');
for i := 0 to ASize-1do
lReport.Add('%8d %15.5f %12.5f', [i+1, VarPropB[i], RedundB[i]]);
FRedundanciesReportFrame.DisplayReport(lReport);
finally
lReport.Free;
end;
end;
procedure TCanonicalForm.UpdateBtnStates;
var
lSelected: Boolean;
begin
inherited;
lSelected := AnySelected(Varlist);
LeftIn.Enabled := lSelected;
RightIn.Enabled := lSelected;
LeftOut.Enabled := AnySelected(LeftList);
RightOut.Enabled := AnySelected(RightList);
if FCreated then
begin
FCorrelationsReportFrame.UpdateBtnStates;
FEigenvectorsReportFrame.UpdateBtnStates;
FMatrixInverseReportFrame.UpdateBtnStates;
FRedundanciesReportFrame.UpdateBtnStates;
enD;
end;
function TCanonicalForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
begin
Result := false;
if LeftList.Items.Count = 0 then
begin
AMsg := 'No left-hand variable selected.';
AControl := VarList;
exit;
end;
if RightList.Items.Count = 0 then
begin
AMsg := 'No right-hand variable selected.';
AControl := VarList;
exit;
end;
Result := true;
end;
procedure TCanonicalForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
initialization
{$I canonunit.lrs}
end.

View File

@ -757,38 +757,6 @@ begin
SingleLinkFrm.ShowModal;
end;
// Menu "Correlation" > "Product-Moment"
procedure TOS3MainFrm.mnuAnalysisCorrel_ProductMomentClick(Sender: TObject);
begin
if RMatForm = nil then
Application.CreateForm(TRMatForm, RMatForm);
RMatForm.Show;
end;
// Menu "Correlation" > "Partial, Semipartial"
procedure TOS3MainFrm.mnuAnalysisCorrel_PartialClick(Sender: TObject);
begin
if PartialsForm = nil then
Application.CreateForm(TPartialsForm, PartialsForm);
PartialsForm.Show;
end;
// Menu "Correlation" > "Autocorrelation"
procedure TOS3MainFrm.mnuAnalysisCorrel_AutoCorrClick(Sender: TObject);
begin
if AutoCorrFrm = nil then
Application.CreateForm(TAutoCorrFrm, AutoCorrFrm);
AutocorrFrm.ShowModal;
end;
// Menu "Correlation" > "Canonical"
procedure TOS3MainFrm.mnuAnalysisCorrel_CanonicalClick(Sender: TObject);
begin
if CannonFrm = nil then
Application.CreateForm(TCannonFrm, CannonFrm);
CannonFrm.ShowModal;
end;
// Menu "Analysis" > "Multivariate" > "MANOVA / Discriminant Function"
procedure TOS3MainFrm.mnuAnalysisMulti_MANOVAClick(Sender: TObject);
begin
@ -823,9 +791,9 @@ end;
procedure TOS3MainFrm.mnuAnalysisMulti_CanonicalClick(Sender: TObject);
begin
if CannonFrm = nil then
Application.CreateForm(TCannonFrm, CannonFrm);
CannonFrm.ShowModal;
if CanonicalForm = nil then
Application.CreateForm(TCanonicalForm, CanonicalForm);
CanonicalForm.Show;
end;
// Menu "Analysis" > "Multivariate" > "Generalized Kappa"
@ -1694,6 +1662,41 @@ begin
end;
{ "Correlation" commands }
// Menu "Correlation" > "Product-Moment"
procedure TOS3MainFrm.mnuAnalysisCorrel_ProductMomentClick(Sender: TObject);
begin
if RMatForm = nil then
Application.CreateForm(TRMatForm, RMatForm);
RMatForm.Show;
end;
// Menu "Correlation" > "Partial, Semipartial"
procedure TOS3MainFrm.mnuAnalysisCorrel_PartialClick(Sender: TObject);
begin
if PartialsForm = nil then
Application.CreateForm(TPartialsForm, PartialsForm);
PartialsForm.Show;
end;
// Menu "Correlation" > "Autocorrelation"
procedure TOS3MainFrm.mnuAnalysisCorrel_AutoCorrClick(Sender: TObject);
begin
if AutoCorrFrm = nil then
Application.CreateForm(TAutoCorrFrm, AutoCorrFrm);
AutocorrFrm.Show;
end;
// Menu "Correlation" > "Canonical"
procedure TOS3MainFrm.mnuAnalysisCorrel_CanonicalClick(Sender: TObject);
begin
if CanonicalForm = nil then
Application.CreateForm(TCanonicalForm, CanonicalForm);
CanonicalForm.Show;
end;
{ "Nonparametric" commands }
// Menu "Analysis" > "Nonparametric" > "Contingency Chi Square"