LazStats: Inherit the remaining regression forms from TBasicStatsReportForm.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7791 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-22 10:24:24 +00:00
parent 5d5f326ad6
commit e04a433d41
18 changed files with 3263 additions and 3492 deletions

View File

@@ -497,7 +497,7 @@
<Unit49> <Unit49>
<Filename Value="forms\analysis\multiple_regression\blkmregunit.pas"/> <Filename Value="forms\analysis\multiple_regression\blkmregunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="BlkMregFrm"/> <ComponentName Value="BlkMregForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="BlkMRegUnit"/> <UnitName Value="BlkMRegUnit"/>
@@ -513,7 +513,7 @@
<Unit51> <Unit51>
<Filename Value="forms\analysis\multiple_regression\bestregunit.pas"/> <Filename Value="forms\analysis\multiple_regression\bestregunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="BestRegFrm"/> <ComponentName Value="BestRegForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="BestRegUnit"/> <UnitName Value="BestRegUnit"/>
@@ -521,7 +521,7 @@
<Unit52> <Unit52>
<Filename Value="forms\analysis\multiple_regression\simultregunit.pas"/> <Filename Value="forms\analysis\multiple_regression\simultregunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="SimultFrm"/> <ComponentName Value="SimultForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="SimultRegUnit"/> <UnitName Value="SimultRegUnit"/>
@@ -529,7 +529,7 @@
<Unit53> <Unit53>
<Filename Value="forms\analysis\multiple_regression\coxregunit.pas"/> <Filename Value="forms\analysis\multiple_regression\coxregunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="CoxRegFrm"/> <ComponentName Value="CoxRegForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="CoxRegUnit"/> <UnitName Value="CoxRegUnit"/>
@@ -537,7 +537,7 @@
<Unit54> <Unit54>
<Filename Value="forms\analysis\multiple_regression\logregunit.pas"/> <Filename Value="forms\analysis\multiple_regression\logregunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="LogRegFrm"/> <ComponentName Value="LogRegForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="LogRegUnit"/> <UnitName Value="LogRegUnit"/>
@@ -545,7 +545,7 @@
<Unit55> <Unit55>
<Filename Value="forms\analysis\multiple_regression\linprounit.pas"/> <Filename Value="forms\analysis\multiple_regression\linprounit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="LinProFrm"/> <ComponentName Value="LinProForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="LinProUnit"/> <UnitName Value="LinProUnit"/>
@@ -905,7 +905,7 @@
<Unit100> <Unit100>
<Filename Value="forms\analysis\multiple_regression\twoslsunit.pas"/> <Filename Value="forms\analysis\multiple_regression\twoslsunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="TwoSLSFrm"/> <ComponentName Value="TwoSLSForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TwoSLSUnit"/> <UnitName Value="TwoSLSUnit"/>

View File

@@ -1,398 +1,351 @@
object BestRegFrm: TBestRegFrm inherited BestRegForm: TBestRegForm
Left = 869 Left = 525
Height = 433 Height = 433
Top = 266 Top = 233
Width = 474 Width = 843
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/BestCombinationMultipleRegressio.htm' HelpKeyword = 'html/BestCombinationMultipleRegressio.htm'
AutoSize = True
Caption = 'Best Combination Multiple Regression' Caption = 'Best Combination Multiple Regression'
ClientHeight = 433 ClientHeight = 433
ClientWidth = 474 ClientWidth = 843
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 417
OnShow = FormShow Width = 467
Position = poMainFormCenter ClientHeight = 417
LCLVersion = '2.1.0.0' ClientWidth = 467
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 412
AnchorSideTop.Control = Owner Top = 392
Left = 8
Height = 15
Top = 8
Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = BlockList
AnchorSideTop.Control = InBtn
Left = 268
Height = 15
Top = 105
Width = 93
Caption = 'Selected Variables'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = DepVar
AnchorSideBottom.Control = DepVar
Left = 268
Height = 15
Top = 33
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = InProb
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 8
Height = 15
Top = 224
Width = 185
BorderSpacing.Left = 8
BorderSpacing.Top = 16
BorderSpacing.Right = 8
Caption = 'Minimum Probability for Inclusion:'
ParentColor = False
WordWrap = True
end
object VarList: TListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = InProb
Left = 8
Height = 187
Top = 25
Width = 198
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 6
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom
Left = 223
Height = 28
Top = 105
Width = 28
BorderSpacing.Top = 20
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 1
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 223
Height = 28
Top = 137
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 2
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 214
Height = 25
Top = 185
Width = 46
AutoSize = True
BorderSpacing.Top = 20
Caption = 'ALL'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 3
end
object BlockList: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 268
Height = 90
Top = 122
Width = 198
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 4
end
object DepInBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 223
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 5
end
object DepOutBtn: TBitBtn
AnchorSideLeft.Control = DepInBtn
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 223
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 6
end
object DepVar: TEdit
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 268
Height = 23
Top = 50
Width = 198
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
TabOrder = 7
Text = 'DepVar'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 135
Top = 249
Width = 459
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 455
TabOrder = 8
object CPChkBox: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 223
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end end
object CovChkBox: TCheckBox inherited ComputeBtn: TButton
Left = 12 Left = 328
Height = 19 Top = 392
Top = 27
Width = 223
Caption = 'Show Deviation Cross-Products Matrix'
TabOrder = 1
end end
object CorrsChkBox: TCheckBox inherited ResetBtn: TButton
Left = 12 Left = 266
Height = 19 Top = 392
Top = 48
Width = 223
Caption = 'Show Intercorrelations Matrix'
TabOrder = 2
end end
object MeansChkBox: TCheckBox inherited HelpBtn: TButton
Left = 12 Left = 207
Height = 19 Top = 392
Top = 69
Width = 223
Caption = 'Show Means'
TabOrder = 3
end end
object VarChkBox: TCheckBox inherited ButtonBevel: TBevel
Left = 12 Top = 376
Height = 19 Width = 467
Top = 90 end
Width = 223 object Label1: TLabel[5]
Caption = 'Show Variances' AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 15
Top = 0
Width = 97
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel[6]
AnchorSideLeft.Control = BlockList
AnchorSideTop.Control = InBtn
Left = 259
Height = 15
Top = 93
Width = 93
Caption = 'Selected Variables'
ParentColor = False
end
object Label3: TLabel[7]
AnchorSideLeft.Control = DepVarEdit
AnchorSideBottom.Control = DepVarEdit
Left = 259
Height = 15
Top = 21
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object Label4: TLabel[8]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = InProbEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 0
Height = 15
Top = 214
Width = 185
BorderSpacing.Top = 16
BorderSpacing.Right = 8
Caption = 'Minimum Probability for Inclusion:'
ParentColor = False
WordWrap = True
end
object VarList: TListBox[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = InProbEdit
Left = 0
Height = 185
Top = 17
Width = 207
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 4 TabOrder = 4
end end
object SDChkBox: TCheckBox object InBtn: TBitBtn[10]
Left = 235 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 6 AnchorSideTop.Control = DepOutBtn
Width = 208 AnchorSideTop.Side = asrBottom
Caption = 'Show Standard Deviations' Left = 219
Height = 26
Top = 93
Width = 28
BorderSpacing.Top = 20
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object MatSaveChkBox: TCheckBox object OutBtn: TBitBtn[11]
Left = 235 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = InBtn
Width = 208 AnchorSideTop.Side = asrBottom
Caption = 'Save Correlation Matrix' Left = 219
Height = 26
Top = 123
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 6 TabOrder = 6
end end
object PredictChkBox: TCheckBox object AllBtn: TBitBtn[12]
Left = 235 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 48 AnchorSideTop.Control = OutBtn
Width = 208 AnchorSideTop.Side = asrBottom
Caption = 'Predictions, residuals, C.I''s to grid' Left = 213
Height = 25
Top = 169
Width = 40
AutoSize = True
BorderSpacing.Top = 20
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 7 TabOrder = 7
end end
object MatInChkBox: TCheckBox object BlockList: TListBox[13]
Left = 235 AnchorSideLeft.Control = AllBtn
Height = 19 AnchorSideLeft.Side = asrBottom
Top = 69 AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 259
Height = 92
Top = 110
Width = 208 Width = 208
Caption = 'Enter Data from a Matrix' Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
ItemHeight = 0
MultiSelect = True
OnDblClick = BlockListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 8 TabOrder = 8
end end
object ComboShowChkBox: TCheckBox object DepInBtn: TBitBtn[14]
Left = 235 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 90 AnchorSideTop.Control = VarList
Width = 208 Left = 219
Caption = 'Show Results for each Combination' Height = 26
Top = 17
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 9 TabOrder = 9
end end
object DepOutBtn: TBitBtn[15]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 219
Height = 26
Top = 47
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 10
end
object DepVarEdit: TEdit[16]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 259
Height = 23
Top = 38
Width = 208
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 12
TabOrder = 11
Text = 'DepVarEdit'
end
object GroupBox1: TGroupBox[17]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 135
Top = 241
Width = 459
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 455
TabOrder = 12
object CPChkBox: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 223
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 223
Caption = 'Show Deviation Cross-Products Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 12
Height = 19
Top = 48
Width = 223
Caption = 'Show Intercorrelations Matrix'
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 12
Height = 19
Top = 69
Width = 223
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 12
Height = 19
Top = 90
Width = 223
Caption = 'Show Variances'
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 235
Height = 19
Top = 6
Width = 208
Caption = 'Show Standard Deviations'
TabOrder = 5
end
object MatSaveChkBox: TCheckBox
Left = 235
Height = 19
Top = 27
Width = 208
Caption = 'Save Correlation Matrix'
TabOrder = 6
end
object PredictChkBox: TCheckBox
Left = 235
Height = 19
Top = 48
Width = 208
Caption = 'Predictions, residuals, C.I''s to grid'
TabOrder = 7
end
object MatInChkBox: TCheckBox
Left = 235
Height = 19
Top = 69
Width = 208
Caption = 'Enter Data from a Matrix'
TabOrder = 8
end
object ComboShowChkBox: TCheckBox
Left = 235
Height = 19
Top = 90
Width = 208
Caption = 'Show Results for each Combination'
TabOrder = 9
end
end
object InProbEdit: TEdit[18]
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 193
Height = 23
Top = 210
Width = 59
Alignment = taRightJustify
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
TabOrder = 13
Text = 'InProbEdit'
end
end end
object InProb: TEdit inherited ParamsSplitter: TSplitter
AnchorSideLeft.Control = Label4 Left = 479
AnchorSideLeft.Side = asrBottom Height = 433
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 201
Height = 23
Top = 220
Width = 59
Alignment = taRightJustify
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 6
TabOrder = 9
Text = 'InProb'
end end
object ResetBtn: TButton object OpenDialog1: TOpenDialog[2]
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 265
Height = 25
Top = 400
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 10
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 327
Height = 25
Top = 400
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 11
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 411
Height = 25
Top = 400
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 12
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 384
Width = 474
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object OpenDialog1: TOpenDialog
Left = 56 Left = 56
Top = 40 Top = 40
end end
object SaveDialog1: TSaveDialog object SaveDialog1: TSaveDialog[3]
Left = 56 Left = 56
Top = 104 Top = 104
end end

View File

@@ -5,17 +5,16 @@ unit BestRegUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
Globals, MainUnit, MatrixLib, OutputUnit, FunctionsLib, DataProcs; Globals, MainUnit, MatrixLib, FunctionsLib, DataProcs, BasicStatsReportFormUnit;
type type
{ TBestRegFrm } { TBestRegForm }
TBestRegFrm = class(TForm) TBestRegForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
CPChkBox: TCheckBox; CPChkBox: TCheckBox;
ComboShowChkBox: TCheckBox; ComboShowChkBox: TCheckBox;
CovChkBox: TCheckBox; CovChkBox: TCheckBox;
@@ -31,11 +30,8 @@ type
AllBtn: TBitBtn; AllBtn: TBitBtn;
DepInBtn: TBitBtn; DepInBtn: TBitBtn;
DepOutBtn: TBitBtn; DepOutBtn: TBitBtn;
ResetBtn: TButton; DepVarEdit: TEdit;
ComputeBtn: TButton; InProbEdit: TEdit;
CloseBtn: TButton;
DepVar: TEdit;
InProb: TEdit;
GroupBox1: TGroupBox; GroupBox1: TGroupBox;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
@@ -47,21 +43,16 @@ type
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject); procedure BlockListDblClick(Sender: TObject);
procedure DepInBtnClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject);
procedure DepOutBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
private private
{ private declarations } { private declarations }
FAutoSized: boolean;
pred_labels : StrDyneVec; pred_labels : StrDyneVec;
y_ptr, v : integer; y_ptr, v : integer;
ii, jj : integer; ii, jj : integer;
@@ -119,53 +110,183 @@ type
procedure BestSetStats(AReport: TStrings); procedure BestSetStats(AReport: TStrings);
procedure BumpOne; procedure BumpOne;
procedure StartSet; procedure StartSet;
procedure Reset; procedure ResetVars;
procedure UpdateBtnStates; protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
public public
{ public declarations } constructor Create(AOwner: TComponent); override;
procedure Reset; override;
end; end;
var var
BestRegFrm: TBestRegFrm; BestRegForm: TBestRegForm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils, MathUnit; Utils, MathUnit;
{ TBestRegFrm }
procedure TBestRegFrm.ResetBtnClick(Sender: TObject); { TBestRegForm }
var
i: integer; constructor TBestRegForm.Create(AOwner: TComponent);
begin begin
BlockList.Clear; inherited;
InProbEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
end;
procedure TBestRegForm.AdjustConstraints;
begin
inherited;
ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
Groupbox1.Width);
ParamsPanel.Constraints.MinHeight := InProbEdit.Top + InProbEdit.Height +
InProbEdit.BorderSpacing.Top + GroupBox1.Height + ButtonBevel.Height +
CloseBtn.BorderSpacing.Top + CloseBtn.Height;
end;
procedure TBestRegForm.AllBtnClick(Sender: TObject);
var
index: integer;
begin
for index := 0 to VarList.Items.Count-1 do
BlockList.Items.Add(VarList.Items[index]);
VarList.Clear; VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
DepVar.Text := '';
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBestRegFrm.FormShow(Sender: TObject);
procedure TBestRegForm.BestSetStats(AReport: TStrings);
var
i, j: integer;
outline: string;
begin begin
ResetBtnClick(self); AReport.Add('');
AReport.Add('Variables entered in step %d', [sets]);
for i := 1 to sets do
begin
ii := max_set[i-1];
selected[i-1] := max_set[i-1];
AReport.Add('%2d %s',[max_set[i-1],ColLabels[ii-1]]);
end;
AReport.Add('');
Regress(AReport);
AReport.Add('Squared Multiple Correlation: %.4f', [mult_r2]);
AReport.Add('Dependent variable: %s', [ColLabels[y_ptr-1]]);
AReport.Add('');
AReport.Add('ANOVA for Regression Effects: ');
AReport.Add('SOURCE df SS MS F Prob');
df_reg := sets;
df_res := round(NCases) - sets - 1;
df_tot := round(NCases) - 1;
ms_reg := ss_reg / df_reg;
ss_res := ( 1.0 - mult_R2) * ss_total ;
ms_res := ss_res / df_res ;
f_test := ms_reg / ms_res ;
prob_f := ProbF(f_test, df_reg,df_res);
{ Get variance of b coefficients }
AReport.Add('Regression %3d %14.4f %14.4f %14.4f %14.4f', [df_reg, ss_reg, ms_reg, f_test, prob_f]);
AReport.Add('Residual %3d %14.4f %14.4f', [df_res, ss_res, ms_res]);
AReport.Add('Total %3d %14.4f', [df_tot, ss_total]);
AReport.Add('');
AReport.Add('Variables in the equation');
AReport.Add('VARIABLE b s.e. b Beta t prob. t');
for i := 1 to sets do
for j := 1 to sets do
ind_mat[i-1,j-1] := ind_mat[i-1,j-1] * ms_res ;
for i := 1 to sets do
begin
ii := selected[i-1];
pred_labels[i-1] := ColLabels[ii-1];
outline := Format('%16s %10.5f ',[ColLabels[ii-1],raw_b[i-1]]);
seb := sqrt(ind_mat[i-1,i-1]);
t := raw_b[i-1] / seb ;
f_test := t * t ;
prob_f := probf(f_test,1,df_res);
beta := raw_b[i-1] * stddev[ii-1] / stddev[y_ptr-1] ;
outline := outline + Format('%8.4f %8.4f %6.3f %6.4f', [seb,beta,t,prob_f]);
AReport.Add(outline);
end;
AReport.Add('(Intercept) %10.5f',[b_zero]);
AReport.Add('');
{ MAT_PRINT(sets,ind_mat,pred_labels,'Variance-covariance matrix of b s');}
{ Now see if the gain was significant over last step }
df1 := sets - last_set ;
f_test := ((mult_R2 - last_R2 ) / df1 ) / ( (1.0 - mult_R2) / df_res) ;
prob_f := probf(f_test, df1,df_res);
if prob_f > stop_prob then more_to_do := FALSE ;
R2_diff := mult_R2 - last_R2 ;
AReport.Add('Increase in squared R for this step: %8.6f', [R2_diff]);
AReport.Add('F: %.4f with D.F. %d and %d with Probability %.4f', [f_test, df1, df_res, prob_f]);
AReport.Add('');
AReport.Add('----------------------------------------------------------');
last_set := sets;
last_R2 := mult_R2;
end; end;
procedure TBestRegFrm.ComputeBtnClick(Sender: TObject);
procedure TBestRegForm.BlockListDblClick(Sender: TObject);
var
index: Integer;
begin
index := BlockList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(BlockList.Items[index]);
BlockList.Items.Delete(index);
UpdatebtnStates;
end;
end;
procedure TBestRegForm.BumpOne;
begin
if selected[first_pt-1] < no_predictors then
selected[first_pt-1] := selected[first_pt-1] + 1
else
begin
all_done := false;
while not all_done do
begin
first_pt := first_pt -1;
if first_pt < 1 then
all_done := true
else
begin
selected[first_pt-1] := selected[first_pt-1] + 1;
if selected[first_pt-1] < selected[first_pt] then
begin
ResetVars();
first_pt := pointer;
all_done := true;
end else
selected[first_pt-1] := selected[first_pt-1] - 1;
end;
end;
end;
end;
procedure TBestRegForm.Compute;
var var
i, j: integer; i, j: integer;
title: string; title: string;
@@ -177,16 +298,16 @@ var
constant: double; constant: double;
lReport: TStrings; lReport: TStrings;
begin begin
if InProb.Text = '' then if InProbEdit.Text = '' then
begin begin
InProb.SetFocus; InProbEdit.SetFocus;
MessageDlg('Probability for inclusion not specified.', mtError, [mbOK], 0); MessageDlg('Probability for inclusion not specified.', mtError, [mbOK], 0);
exit; exit;
end; end;
if not TryStrToFloat(InProb.Text, stop_prob) then // probability to include a block if not TryStrToFloat(InProbEdit.Text, stop_prob) then // probability to include a block
begin begin
InProb.SetFocus; InProbEdit.SetFocus;
MessageDlg('No number given for probability.', mtError, [mbOk], 0); MessageDlg('No number given for probability.', mtError, [mbOk], 0);
exit; exit;
end; end;
@@ -271,7 +392,7 @@ begin
DepVarCol := NoVars; DepVarCol := NoVars;
y_ptr := NoVars; y_ptr := NoVars;
DepVar.Text := RowLabels[NoVars]; DepVarEdit.Text := RowLabels[NoVars];
{ convert correlations to deviation cross-products } { convert correlations to deviation cross-products }
for i := 1 to NoVars do for i := 1 to NoVars do
@@ -304,7 +425,7 @@ begin
end; end;
{ get dependendent variable column } { get dependendent variable column }
if DepVar.Text = '' then if DepVarEdit.Text = '' then
begin begin
MessageDlg('No dependent variable selected.', mtError, [mbOK], 0); MessageDlg('No dependent variable selected.', mtError, [mbOK], 0);
exit; exit;
@@ -314,7 +435,7 @@ begin
y_ptr := NoVars; y_ptr := NoVars;
for j := 1 to NoVariables do for j := 1 to NoVariables do
begin begin
if DepVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then if DepVarEdit.Text = OS3MainFrm.DataGrid.Cells[j,0] then
begin begin
DepVarCol := j; DepVarCol := j;
ColNoSelected[NoVars-1] := j; ColNoSelected[NoVars-1] := j;
@@ -470,29 +591,58 @@ begin
end; end;
end; end;
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
pred_labels := nil;
Max_Set := nil;
Selected := nil;
ColNoSelected := nil;
IndepIndex := nil;
ColLabels := nil;
RowLabels := nil;
raw_b := nil;
xycross := nil;
variance := nil;
stddev := nil;
mean := nil;
sumx := nil;
ind_mat := nil;
cross_prod := nil;
end; end;
end; end;
procedure TBestRegFrm.Init;
procedure TBestRegForm.DepInBtnClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (DepVarEdit.Text = '') then
begin
DepVarEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
procedure TBestRegForm.DepOutBtnClick(Sender: TObject);
begin
if DepVarEdit.Text <> '' then
begin
VarList.Items.Add(DepVarEdit.Text);
DepVarEdit.Text := '';
end;
UpdateBtnStates;
end;
procedure TBestRegForm.InBtnClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while i < VarList.Items.Count do
begin
if VarList.Selected[i] then
begin
BlockList.Items.Add(VarList.Items[i]);
VarList.Items.Delete(i);
i := 0;
end else
inc(i);
end;
UpdateBtnStates;
end;
procedure TBestRegForm.Init;
var var
i, j: integer; i, j: integer;
begin begin
@@ -507,7 +657,27 @@ begin
end; end;
end; end;
procedure TBestRegFrm.Regress(AReport: TStrings);
procedure TBestRegForm.OutBtnClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while i < BlockList.Items.Count do
begin
if BlockList.Selected[i] then
begin
VarList.Items.Add(BlockList.Items[i]);
BlockList.Items.Delete(i);
i := 0;
end else
inc(i);
end;
UpdateBtnStates;
end;
procedure TBestRegForm.Regress(AReport: TStrings);
var var
i, j: integer; i, j: integer;
begin begin
@@ -564,122 +734,33 @@ begin
end; end;
end; end;
procedure TBestRegFrm.BestSetStats(AReport: TStrings);
var
i, j: integer;
outline: string;
begin
AReport.Add('');
AReport.Add('Variables entered in step %d', [sets]);
for i := 1 to sets do
begin
ii := max_set[i-1];
selected[i-1] := max_set[i-1];
AReport.Add('%2d %s',[max_set[i-1],ColLabels[ii-1]]);
end;
AReport.Add('');
Regress(AReport); procedure TBestRegForm.Reset;
AReport.Add('Squared Multiple Correlation: %.4f', [mult_r2]);
AReport.Add('Dependent variable: %s', [ColLabels[y_ptr-1]]);
AReport.Add('');
AReport.Add('ANOVA for Regression Effects: ');
AReport.Add('SOURCE df SS MS F Prob');
df_reg := sets;
df_res := round(NCases) - sets - 1;
df_tot := round(NCases) - 1;
ms_reg := ss_reg / df_reg;
ss_res := ( 1.0 - mult_R2) * ss_total ;
ms_res := ss_res / df_res ;
f_test := ms_reg / ms_res ;
prob_f := ProbF(f_test, df_reg,df_res);
{ Get variance of b coefficients }
AReport.Add('Regression %3d %14.4f %14.4f %14.4f %14.4f', [df_reg, ss_reg, ms_reg, f_test, prob_f]);
AReport.Add('Residual %3d %14.4f %14.4f', [df_res, ss_res, ms_res]);
AReport.Add('Total %3d %14.4f', [df_tot, ss_total]);
AReport.Add('');
AReport.Add('Variables in the equation');
AReport.Add('VARIABLE b s.e. b Beta t prob. t');
for i := 1 to sets do
for j := 1 to sets do
ind_mat[i-1,j-1] := ind_mat[i-1,j-1] * ms_res ;
for i := 1 to sets do
begin
ii := selected[i-1];
pred_labels[i-1] := ColLabels[ii-1];
outline := Format('%16s %10.5f ',[ColLabels[ii-1],raw_b[i-1]]);
seb := sqrt(ind_mat[i-1,i-1]);
t := raw_b[i-1] / seb ;
f_test := t * t ;
prob_f := probf(f_test,1,df_res);
beta := raw_b[i-1] * stddev[ii-1] / stddev[y_ptr-1] ;
outline := outline + Format('%8.4f %8.4f %6.3f %6.4f', [seb,beta,t,prob_f]);
AReport.Add(outline);
end;
AReport.Add('(Intercept) %10.5f',[b_zero]);
AReport.Add('');
{ MAT_PRINT(sets,ind_mat,pred_labels,'Variance-covariance matrix of b s');}
{ Now see if the gain was significant over last step }
df1 := sets - last_set ;
f_test := ((mult_R2 - last_R2 ) / df1 ) / ( (1.0 - mult_R2) / df_res) ;
prob_f := probf(f_test, df1,df_res);
if prob_f > stop_prob then more_to_do := FALSE ;
R2_diff := mult_R2 - last_R2 ;
AReport.Add('Increase in squared R for this step: %8.6f', [R2_diff]);
AReport.Add('F: %.4f with D.F. %d and %d with Probability %.4f', [f_test, df1, df_res, prob_f]);
AReport.Add('');
AReport.Add('----------------------------------------------------------');
last_set := sets;
last_R2 := mult_R2;
end;
procedure TBestRegFrm.BumpOne;
begin
if selected[first_pt-1] < no_predictors then
selected[first_pt-1] := selected[first_pt-1] + 1
else
begin
all_done := false;
while not all_done do
begin
first_pt := first_pt -1;
if first_pt < 1 then
all_done := true
else
begin
selected[first_pt-1] := selected[first_pt-1] + 1;
if selected[first_pt-1] < selected[first_pt] then
begin
Reset();
first_pt := pointer;
all_done := true;
end else
selected[first_pt-1] := selected[first_pt-1] - 1;
end;
end;
end;
end;
procedure TBestRegFrm.StartSet;
var var
i: integer; i: integer;
begin begin
end_of_set := false; inherited;
for i := 1 to sets do
selected[i-1] := i; DepVarEdit.Clear;
first_pt := sets; BlockList.Clear;
pointer := sets; VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := false;
MeansChkBox.Checked := false;
VarChkBox.Checked := false;
SDChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
UpdateBtnStates;
end; end;
procedure TBestRegFrm.Reset;
procedure TBestRegForm.ResetVars;
var var
i: integer; i: integer;
begin begin
@@ -691,117 +772,53 @@ begin
selected[i-1] := selected[i-2] + 1; selected[i-1] := selected[i-2] + 1;
end; end;
procedure TBestRegFrm.InBtnClick(Sender: TObject);
procedure TBestRegForm.StartSet;
var var
i: integer; i: integer;
begin begin
i := 0; end_of_set := false;
while i < VarList.Items.Count do for i := 1 to sets do
begin selected[i-1] := i;
if VarList.Selected[i] then first_pt := sets;
begin pointer := sets;
BlockList.Items.Add(VarList.Items[i]);
VarList.Items.Delete(i);
i := 0;
end else
inc(i);
end;
UpdateBtnStates;
end; end;
procedure TBestRegFrm.OutBtnClick(Sender: TObject);
var
i: integer; procedure TBestRegForm.UpdateBtnStates;
begin begin
i := 0; inherited;
while i < BlockList.Items.Count do
begin
if BlockList.Selected[i] then
begin
VarList.Items.Add(BlockList.Items[i]);
BlockList.Items.Delete(i);
i := 0;
end else
inc(i);
end;
UpdateBtnStates;
end;
procedure TBestRegFrm.AllBtnClick(Sender: TObject);
var
index: integer;
begin
for index := 0 to VarList.Items.Count-1 do
BlockList.Items.Add(VarList.Items[index]);
VarList.Clear;
UpdateBtnStates;
end;
procedure TBestRegFrm.DepInBtnClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (DepVar.Text = '') then
begin
DepVar.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
procedure TBestRegFrm.DepOutBtnClick(Sender: TObject);
begin
if DepVar.Text <> '' then
begin
VarList.Items.Add(DepVar.Text);
DepVar.Text := '';
end;
UpdateBtnStates;
end;
procedure TBestRegFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
VarList.Constraints.MinHeight := AllBtn.Top + AllBtn.Height - VarList.Top;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TBestRegFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
end;
procedure TBestRegFrm.UpdateBtnStates;
begin
InBtn.Enabled := AnySelected(VarList); InBtn.Enabled := AnySelected(VarList);
OutBtn.Enabled := AnySelected(BlockList); OutBtn.Enabled := AnySelected(BlockList);
DepInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVar.Text <= ''); DepInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVarEdit.Text <= '');
DepOutBtn.Enabled := DepVar.Text <> ''; DepOutBtn.Enabled := DepVarEdit.Text <> '';
end; end;
procedure TBestRegFrm.VarListSelectionChange(Sender: TObject; User: boolean);
procedure TBestRegForm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if DepVarEdit.Text = '' then
DepVarEdit.Text := VarList.Items[index]
else
BlockList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TBestRegForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
initialization
{$I bestregunit.lrs}
end. end.

View File

@@ -1,446 +1,401 @@
object BlkMregFrm: TBlkMregFrm inherited BlkMregForm: TBlkMregForm
Left = 503 Left = 520
Height = 451 Height = 415
Top = 292 Top = 224
Width = 465 Width = 962
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/BlockEntryMultipleRegression.htm' HelpKeyword = 'html/BlockEntryMultipleRegression.htm'
AutoSize = True
Caption = 'Block Entry Multiple Regression' Caption = 'Block Entry Multiple Regression'
ClientHeight = 451 ClientHeight = 415
ClientWidth = 465 ClientWidth = 962
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 399
OnShow = FormShow Width = 442
Position = poMainFormCenter ClientHeight = 399
LCLVersion = '2.1.0.0' ClientWidth = 442
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 387
AnchorSideTop.Control = Bevel3 Top = 374
AnchorSideTop.Side = asrBottom TabOrder = 15
Left = 8
Height = 15
Top = 48
Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = DepVar
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = DepVar
Left = 263
Height = 15
Top = 77
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = BlockList
Left = 263
Height = 15
Top = 144
Width = 166
Caption = 'Independent Var.s for this block'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = BlockNoEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BlockNoEdit
Left = 8
Height = 15
Top = 12
Width = 54
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Block No. '
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = NextBlkBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = InProb
Left = 218
Height = 15
Top = 13
Width = 187
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 8
Caption = 'Minimum Prob. to enter block:'
ParentColor = False
WordWrap = True
end
object VarList: TListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = GroupBox1
Left = 8
Height = 220
Top = 65
Width = 193
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Constraints.MinHeight = 220
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 3
end
object DepInBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 217
Height = 28
Top = 69
Width = 28
Anchors = [akTop]
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 4
end
object DepOutBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 218
Height = 28
Top = 101
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 5
end
object InBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = OutBtn
Left = 218
Height = 28
Top = 174
Width = 28
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 4
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 7
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = BlockList
AnchorSideTop.Side = asrCenter
Left = 218
Height = 28
Top = 206
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 8
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 209
Height = 25
Top = 244
Width = 46
AutoSize = True
BorderSpacing.Top = 10
Caption = 'ALL'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 9
end
object DepVar: TEdit
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 263
Height = 23
Top = 94
Width = 194
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 6
Text = 'DepVar'
end
object BlockList: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 263
Height = 119
Top = 161
Width = 194
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 10
end
object BlockNoEdit: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = NextBlkBtn
Left = 70
Height = 23
Top = 8
Width = 37
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
TabOrder = 0
Text = 'BlockNoEdit'
end
object NextBlkBtn: TButton
AnchorSideLeft.Control = BlockNoEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BlockNoEdit
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 127
Height = 25
Top = 8
Width = 83
AutoSize = True
BorderSpacing.Left = 20
BorderSpacing.Right = 8
Caption = 'Next Block'
OnClick = NextBlkBtnClick
TabOrder = 1
end
object InProb: TEdit
AnchorSideTop.Control = NextBlkBtn
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 413
Height = 23
Top = 9
Width = 44
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
TabOrder = 2
Text = 'InProb'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 114
Top = 288
Width = 449
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 20
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 4
ClientHeight = 94
ClientWidth = 445
TabOrder = 11
object CPChkBox: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 198
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end end
object CovChkBox: TCheckBox inherited ComputeBtn: TButton
Left = 16 Left = 303
Height = 19 Top = 374
Top = 27 TabOrder = 14
Width = 198 end
Caption = 'Show Variance-Covariance Matrix' inherited ResetBtn: TButton
Left = 241
Top = 374
TabOrder = 13
end
inherited HelpBtn: TButton
Left = 182
Top = 374
TabOrder = 12
end
inherited ButtonBevel: TBevel
Top = 358
Width = 442
end
object Label4: TLabel[5]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = BlockNoEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BlockNoEdit
Left = 0
Height = 15
Top = 5
Width = 54
BorderSpacing.Right = 8
Caption = 'Block No. '
ParentColor = False
end
object Label5: TLabel[6]
AnchorSideLeft.Control = NextBlkBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = InProb
Left = 227
Height = 15
Top = 5
Width = 163
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Minimum Prob. to enter block:'
ParentColor = False
WordWrap = True
end
object BlockNoEdit: TEdit[7]
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = NextBlkBtn
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = NextBlkBtn
Left = 62
Height = 23
Top = 1
Width = 37
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Right = 8
TabOrder = 0
Text = 'BlockNoEdit'
end
object NextBlkBtn: TButton[8]
AnchorSideLeft.Control = BlockNoEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ParamsPanel
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 119
Height = 25
Top = 0
Width = 83
AutoSize = True
BorderSpacing.Left = 20
BorderSpacing.Right = 8
Caption = 'Next Block'
OnClick = NextBlkBtnClick
TabOrder = 1 TabOrder = 1
end end
object CorrsChkBox: TCheckBox object InProb: TEdit[9]
Left = 16 AnchorSideTop.Control = NextBlkBtn
Height = 19 AnchorSideTop.Side = asrCenter
Top = 48 AnchorSideRight.Control = ParamsPanel
Width = 198 AnchorSideRight.Side = asrBottom
Caption = 'Show Intercorrelation Matrix' Left = 398
Height = 23
Top = 1
Width = 44
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 8
TabOrder = 2 TabOrder = 2
Text = 'InProb'
end end
object MeansChkBox: TCheckBox object Label1: TLabel[10]
Left = 16 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideTop.Control = Bevel3
Top = 69 AnchorSideTop.Side = asrBottom
Width = 198 Left = 0
Caption = 'Show Means' Height = 15
Top = 40
Width = 97
BorderSpacing.Top = 8
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel[11]
AnchorSideLeft.Control = DepVarEdit
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = DepVarEdit
Left = 247
Height = 15
Top = 65
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object Label3: TLabel[12]
AnchorSideLeft.Control = BlockList
Left = 247
Height = 15
Top = 144
Width = 166
Caption = 'Independent Var.s for this block'
ParentColor = False
end
object VarList: TListBox[13]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = OptionsGroup
Left = 0
Height = 179
Top = 57
Width = 195
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 3 TabOrder = 3
end end
object VarChkBox: TCheckBox object DepInBtn: TBitBtn[14]
Left = 234 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 6 AnchorSideTop.Control = VarList
Width = 195 Left = 208
Caption = 'Show Variances' Height = 26
Top = 61
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 4 TabOrder = 4
end end
object SDChkBox: TCheckBox object DepOutBtn: TBitBtn[15]
Left = 234 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = DepInBtn
Width = 195 AnchorSideTop.Side = asrBottom
Caption = 'Show Standard Deviations' Left = 208
Height = 26
Top = 91
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object MatSaveChkBox: TCheckBox object InBtn: TBitBtn[16]
Left = 234 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 48 AnchorSideTop.Control = DepOutBtn
Width = 195 AnchorSideTop.Side = asrBottom
Caption = 'Save Correlation Matrix' Left = 208
TabOrder = 6 Height = 26
end Top = 149
object PredictChkBox: TCheckBox Width = 26
Left = 234 BorderSpacing.Top = 32
Height = 19 BorderSpacing.Bottom = 4
Top = 69 Images = MainDataModule.ImageList
Width = 195 ImageIndex = 1
Caption = 'Predictions,residuals,C.I.''s to Grid' OnClick = InBtnClick
Spacing = 0
TabOrder = 7 TabOrder = 7
end end
object OutBtn: TBitBtn[17]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 208
Height = 26
Top = 179
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 8
end
object AllBtn: TBitBtn[18]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 201
Height = 25
Top = 209
Width = 40
AutoSize = True
BorderSpacing.Top = 4
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 9
end
object DepVarEdit: TEdit[19]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 247
Height = 23
Top = 82
Width = 195
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 6
Text = 'DepVarEdit'
end
object BlockList: TListBox[20]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 247
Height = 75
Top = 161
Width = 195
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
ItemHeight = 0
MultiSelect = True
OnDblClick = BlockListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 10
end
object OptionsGroup: TGroupBox[21]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 114
Top = 244
Width = 449
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 20
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 4
ClientHeight = 94
ClientWidth = 445
TabOrder = 11
object CPChkBox: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 198
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 16
Height = 19
Top = 27
Width = 198
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 16
Height = 19
Top = 48
Width = 198
Caption = 'Show Intercorrelation Matrix'
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 16
Height = 19
Top = 69
Width = 198
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 234
Height = 19
Top = 6
Width = 195
Caption = 'Show Variances'
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 234
Height = 19
Top = 27
Width = 195
Caption = 'Show Standard Deviations'
TabOrder = 5
end
object MatSaveChkBox: TCheckBox
Left = 234
Height = 19
Top = 48
Width = 195
Caption = 'Save Correlation Matrix'
TabOrder = 6
end
object PredictChkBox: TCheckBox
Left = 234
Height = 19
Top = 69
Width = 195
Caption = 'Predictions,residuals,C.I.''s to Grid'
TabOrder = 7
end
end
object Bevel3: TBevel[22]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 12
Top = 20
Width = 442
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
end end
object ResetBtn: TButton inherited ParamsSplitter: TSplitter
AnchorSideRight.Control = ComputeBtn Left = 454
AnchorSideBottom.Control = Owner Height = 415
AnchorSideBottom.Side = asrBottom
Left = 256
Height = 25
Top = 418
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 12
end end
object ComputeBtn: TButton object SaveDialog1: TSaveDialog[2]
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 318
Height = 25
Top = 418
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 13
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 402
Height = 25
Top = 418
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 14
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 402
Width = 465
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object Bevel3: TBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 12
Top = 28
Width = 465
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
object SaveDialog1: TSaveDialog
Left = 72 Left = 72
Top = 112 Top = 112
end end

View File

@@ -9,22 +9,16 @@ unit BlkMRegUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls,
StdCtrls, Buttons, ExtCtrls, Globals, MainUnit, MatrixLib, FunctionsLib, DataProcs, DictionaryUnit, BasicStatsReportFormUnit;
Globals, MainUnit, MatrixLib, OutputUnit, FunctionsLib,
DataProcs, DictionaryUnit;
type type
{ TBlkMregFrm } { TBlkMregForm }
TBlkMregFrm = class(TForm) TBlkMregForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
Bevel3: TBevel; Bevel3: TBevel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
CPChkBox: TCheckBox; CPChkBox: TCheckBox;
CovChkBox: TCheckBox; CovChkBox: TCheckBox;
CorrsChkBox: TCheckBox; CorrsChkBox: TCheckBox;
@@ -34,7 +28,7 @@ type
SDChkBox: TCheckBox; SDChkBox: TCheckBox;
MatSaveChkBox: TCheckBox; MatSaveChkBox: TCheckBox;
PredictChkBox: TCheckBox; PredictChkBox: TCheckBox;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
InProb: TEdit; InProb: TEdit;
Label5: TLabel; Label5: TLabel;
NextBlkBtn: TButton; NextBlkBtn: TButton;
@@ -45,107 +39,77 @@ type
Label4: TLabel; Label4: TLabel;
OutBtn: TBitBtn; OutBtn: TBitBtn;
AllBtn: TBitBtn; AllBtn: TBitBtn;
DepVar: TEdit; DepVarEdit: TEdit;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
BlockList: TListBox; BlockList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject); procedure BlockListDblClick(Sender: TObject);
procedure DepInBtnClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject);
procedure DepOutBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure NextBlkBtnClick(Sender: TObject); procedure NextBlkBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
private private
{ private declarations }
FAutoSized: Boolean;
BlkVarCols : IntDyneMat; BlkVarCols : IntDyneMat;
NoBlocks : integer; NoBlocks : integer;
VarsInBlk : IntDyneVec; VarsInBlk : IntDyneVec;
NoVars : integer; NoVars : integer;
procedure UpdateBtnStates;
function Valid(out AMsg: String; out AControl: TWinControl): Boolean; protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
public public
{ public declarations } constructor Create(AOwner: TComponent); override;
procedure Reset; override;
end; end;
var var
BlkMregFrm: TBlkMregFrm; BlkMregForm: TBlkMregForm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils, MathUnit; Utils, MathUnit;
{ TBlkMregFrm }
procedure TBlkMregFrm.ResetBtnClick(Sender: TObject); { TBlkMregForm }
var
i: integer; constructor TBlkMregForm.Create(AOwner: TComponent);
begin begin
BlockList.Items.Clear; inherited;
VarList.Items.Clear;
BlockNoEdit.Text := '1';
NoBlocks := 1;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
// HeteroChk.Checked := false;
NoVars := 0;
DepVar.Text := '';
InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
SetLength(BlkVarCols,NoVariables,NoVariables);
SetLength(VarsInBlk,NoVariables);
end;
procedure TBlkMregFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TBlkMregFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil); Assert(OS3MainFrm <> nil);
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm); if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
end; end;
procedure TBlkMregFrm.FormShow(Sender: TObject);
procedure TBlkMregForm.AdjustConstraints;
begin 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 + ButtonBevel.Height +
CloseBtn.BorderSpacing.Top + CloseBtn.Height;
end; end;
procedure TBlkMregFrm.AllBtnClick(Sender: TObject);
procedure TBlkMregForm.AllBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@@ -155,7 +119,22 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBlkMregFrm.ComputeBtnClick(Sender: TObject);
procedure TBlkMregForm.BlockListDblClick(Sender: TObject);
var
index: Integer;
begin
index := BlockList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(BlockList.Items[index]);
BlockList.Items.Delete(index);
UpdatebtnStates;
end;
end;
procedure TBlkMregForm.Compute;
var var
i, j, k, errorcode: integer; i, j, k, errorcode: integer;
NoIndepVars, DepVarCol, NEntered, StepNo : integer; NoIndepVars, DepVarCol, NEntered, StepNo : integer;
@@ -182,13 +161,6 @@ var
C: TWinControl; C: TWinControl;
lReport: TStrings; lReport: TStrings;
begin begin
if not Valid(msg, C) then
begin
C.SetFocus;
MessageDlg(msg, mtError, [mbOK], 0);
exit;
end;
SetLength(corrs,NoVariables+1,NoVariables+1); SetLength(corrs,NoVariables+1,NoVariables+1);
SetLength(IndepInverse,NoVariables,NoVariables); SetLength(IndepInverse,NoVariables,NoVariables);
SetLength(Means,NoVariables); SetLength(Means,NoVariables);
@@ -211,7 +183,7 @@ begin
errorcode := 0; errorcode := 0;
{ get dependendent variable column } { get dependendent variable column }
if DepVar.Text = '' then if DepVarEdit.Text = '' then
begin begin
MessageDlg('No Dependent variable selected.', mtError, [mbOK], 0); MessageDlg('No Dependent variable selected.', mtError, [mbOK], 0);
exit; exit;
@@ -226,7 +198,7 @@ begin
DepVarCol := 0; DepVarCol := 0;
NoVars := NoVars + 1; NoVars := NoVars + 1;
for j := 1 to NoVariables do for j := 1 to NoVariables do
if DepVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then DepVarCol := j; if DepVarEdit.Text = OS3MainFrm.DataGrid.Cells[j,0] then DepVarCol := j;
R2 := 0.0; R2 := 0.0;
OldR2 := 0.0; OldR2 := 0.0;
@@ -300,7 +272,7 @@ begin
if errorcode > 0 then if errorcode > 0 then
begin begin
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
MessageDlg('A selected variable has no variability-run aborted.', mtError,[mbOK], 0); MessageDlg('A selected variable has no variability-run aborted.', mtError,[mbOK], 0);
exit; exit;
end; end;
@@ -424,7 +396,7 @@ begin
lReport.Add(''); lReport.Add('');
end; end;
} }
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
if MatSaveChkBox.Checked then if MatSaveChkBox.Checked then
begin begin
@@ -439,46 +411,36 @@ begin
finally finally
lReport.Free; lReport.Free;
ColEntered := nil;
Candidate := nil;
BetaWeights := nil;
IndColLabels := nil;
IndRowLabels := nil;
IndepIndex := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
IndepInverse := nil;
corrs := nil;
VarsInBlk := nil;
BlkVarCols := nil;
end; end;
end; end;
procedure TBlkMregFrm.DepInBtnClick(Sender: TObject);
procedure TBlkMregForm.DepInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
index := VarList.ItemIndex; index := VarList.ItemIndex;
if (index > -1) and (DepVar.Text = '') then if (index > -1) and (DepVarEdit.Text = '') then
begin begin
DepVar.Text := VarList.Items[index]; DepVarEdit.Text := VarList.Items[index];
VarList.Items.Delete(index); VarList.Items.Delete(index);
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBlkMregFrm.DepOutBtnClick(Sender: TObject);
procedure TBlkMregForm.DepOutBtnClick(Sender: TObject);
begin begin
if DepVar.Text <> '' then if DepVarEdit.Text <> '' then
begin begin
VarList.Items.Add(DepVar.Text); VarList.Items.Add(DepVarEdit.Text);
DepVar.Text := ''; DepVarEdit.Text := '';
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBlkMregFrm.InBtnClick(Sender: TObject);
procedure TBlkMregForm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@@ -496,7 +458,8 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBlkMregFrm.NextBlkBtnClick(Sender: TObject);
procedure TBlkMregForm.NextBlkBtnClick(Sender: TObject);
var var
blkno, i, j, count: integer; blkno, i, j, count: integer;
cellstring: string; cellstring: string;
@@ -530,7 +493,8 @@ begin
//BlockList.Clear; //BlockList.Clear;
end; end;
procedure TBlkMregFrm.OutBtnClick(Sender: TObject);
procedure TBlkMregForm.OutBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@@ -548,21 +512,56 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBlkMregFrm.UpdateBtnStates;
procedure TBlkMregForm.Reset;
var
i: integer;
begin
inherited;
BlockList.Items.Clear;
VarList.Items.Clear;
BlockNoEdit.Text := '1';
NoBlocks := 1;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := false;
MeansChkBox.Checked := false;
VarChkBox.Checked := false;
SDChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
NoVars := 0;
DepVarEdit.Text := '';
InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
SetLength(BlkVarCols, NoVariables, NoVariables);
SetLength(VarsInBlk, NoVariables);
end;
procedure TBlkMregForm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
begin begin
lSelected := AnySelected(VarList); inherited;
DepInBtn.Enabled := lSelected and (DepVar.Text = '');
InBtn.Enabled := lSelected;
DepOutBtn.Enabled := (DepVar.Text <> ''); lSelected := AnySelected(VarList);
OutBtn.Enabled := AnySelected(BlockList); DepInBtn.Enabled := lSelected and (DepVarEdit.Text = '');
InBtn.Enabled := lSelected;
AllBtn.Enabled := VarList.Items.Count > 0; DepOutBtn.Enabled := (DepVarEdit.Text <> '');
OutBtn.Enabled := AnySelected(BlockList);
AllBtn.Enabled := VarList.Items.Count > 0;
end; end;
function TBlkMregFrm.Valid(out AMsg: String; out AControl: TWinControl): Boolean;
function TBlkMregForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
var var
n: Integer; n: Integer;
x: Double; x: Double;
@@ -610,14 +609,29 @@ begin
Result := true; Result := true;
end; end;
procedure TBlkMregFrm.VarListSelectionChange(Sender: TObject; User: boolean);
procedure TBlkMregForm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if DepVarEdit.Text = '' then
DepVarEdit.Text := VarList.Items[index]
else
BlockList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TBlkMregForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
initialization
{$I blkmregunit.lrs}
end. end.

View File

@@ -1,409 +1,316 @@
object CoxRegFrm: TCoxRegFrm inherited CoxRegForm: TCoxRegForm
Left = 457 Left = 457
Height = 401 Height = 393
Top = 291 Top = 291
Width = 424 Width = 480
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/CoxProportionalHazardsSurvivalRe.htm' HelpKeyword = 'html/CoxProportionalHazardsSurvivalRe.htm'
AutoSize = True
Caption = 'Cox Proportional Hazards Survival Regression' Caption = 'Cox Proportional Hazards Survival Regression'
ClientHeight = 401 ClientHeight = 393
ClientWidth = 424 ClientWidth = 480
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 377
OnShow = FormShow ClientHeight = 377
Position = poMainFormCenter inherited CloseBtn: TButton
LCLVersion = '2.1.0.0' Top = 352
object Label1: TLabel end
AnchorSideLeft.Control = Owner inherited ComputeBtn: TButton
AnchorSideTop.Control = Owner Top = 352
Left = 8 end
Height = 15 inherited ResetBtn: TButton
Top = 9 Top = 352
Width = 89 end
BorderSpacing.Left = 8 inherited HelpBtn: TButton
BorderSpacing.Top = 9 Top = 352
Caption = 'Avaialbe Variable' end
ParentColor = False inherited ButtonBevel: TBevel
end Top = 336
object Label2: TLabel end
AnchorSideLeft.Control = BlockList object Label1: TLabel[5]
AnchorSideTop.Control = Owner AnchorSideLeft.Control = ParamsPanel
Left = 234 AnchorSideTop.Control = ParamsPanel
Height = 15 Left = 0
Top = 8 Height = 15
Width = 116 Top = 0
BorderSpacing.Top = 8 Width = 94
Caption = 'Independent Variables' Caption = 'Availabe Variables'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label2: TLabel[6]
AnchorSideLeft.Control = DepVar AnchorSideLeft.Control = BlockList
AnchorSideBottom.Control = DepVar AnchorSideTop.Control = ParamsPanel
Left = 234 Left = 164
Height = 15 Height = 15
Top = 108 Top = 8
Width = 114 Width = 116
Anchors = [akLeft, akBottom] BorderSpacing.Top = 8
BorderSpacing.Bottom = 2 Caption = 'Independent Variables'
Caption = 'Survival Time Variable' ParentColor = False
ParentColor = False end
end object Label3: TLabel[7]
object Label4: TLabel AnchorSideLeft.Control = DepVar
AnchorSideLeft.Control = StatusEdit AnchorSideBottom.Control = DepVar
AnchorSideBottom.Control = StatusEdit Left = 166
Left = 234 Height = 15
Height = 15 Top = 80
Top = 195 Width = 114
Width = 120 Anchors = [akLeft, akBottom]
Anchors = [akLeft, akBottom] BorderSpacing.Bottom = 2
BorderSpacing.Bottom = 2 Caption = 'Survival Time Variable'
Caption = 'Survival Status Variable' ParentColor = False
ParentColor = False end
end object Label4: TLabel[8]
object Label5: TLabel AnchorSideLeft.Control = StatusEdit
AnchorSideLeft.Control = GroupBox1 AnchorSideBottom.Control = StatusEdit
AnchorSideLeft.Side = asrBottom Left = 166
AnchorSideTop.Control = GroupBox1 Height = 15
AnchorSideTop.Side = asrCenter Top = 148
Left = 219 Width = 120
Height = 15 Anchors = [akLeft, akBottom]
Top = 296 BorderSpacing.Bottom = 2
Width = 117 Caption = 'Survival Status Variable'
BorderSpacing.Left = 40 ParentColor = False
Caption = 'Maximum Interations:' end
ParentColor = False object Label5: TLabel[9]
end AnchorSideLeft.Control = ParamsPanel
object VarList: TListBox AnchorSideTop.Control = MaxItsEdit
AnchorSideLeft.Control = Owner AnchorSideTop.Side = asrCenter
AnchorSideTop.Control = Label1 Left = 0
AnchorSideTop.Side = asrBottom Height = 15
AnchorSideRight.Control = InBtn Top = 212
AnchorSideBottom.Control = GroupBox1 Width = 117
Left = 8 Caption = 'Maximum Interations:'
Height = 221 ParentColor = False
Top = 26 end
Width = 182 object VarList: TListBox[10]
Anchors = [akTop, akLeft, akRight, akBottom] AnchorSideLeft.Control = ParamsPanel
BorderSpacing.Left = 8 AnchorSideTop.Control = Label1
BorderSpacing.Top = 2 AnchorSideTop.Side = asrBottom
BorderSpacing.Right = 8 AnchorSideRight.Control = InBtn
BorderSpacing.Bottom = 8 AnchorSideBottom.Control = MaxItsEdit
Constraints.MinHeight = 220 Left = 0
ItemHeight = 0 Height = 183
MultiSelect = True Top = 17
OnSelectionChange = VarListSelectionChange Width = 126
TabOrder = 0 Anchors = [akTop, akLeft, akRight, akBottom]
end BorderSpacing.Top = 2
object InBtn: TBitBtn BorderSpacing.Right = 6
AnchorSideLeft.Control = Owner BorderSpacing.Bottom = 8
AnchorSideLeft.Side = asrCenter ItemHeight = 0
AnchorSideTop.Control = VarList MultiSelect = True
Left = 198 OnDblClick = VarListDblClick
Height = 28 OnSelectionChange = VarListSelectionChange
Top = 26 TabOrder = 4
Width = 28 end
Glyph.Data = { object InBtn: TBitBtn[11]
36040000424D3604000000000000360000002800000010000000100000000100 AnchorSideLeft.Control = ParamsPanel
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF AnchorSideLeft.Side = asrCenter
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF AnchorSideTop.Control = VarList
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Left = 132
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Height = 26
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Top = 17
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Width = 26
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Images = MainDataModule.ImageList
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF ImageIndex = 1
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF OnClick = InBtnClick
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Spacing = 0
FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF TabOrder = 5
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF end
FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE object OutBtn: TBitBtn[12]
6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 AnchorSideLeft.Control = ParamsPanel
3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 AnchorSideLeft.Side = asrCenter
71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 AnchorSideTop.Control = InBtn
89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 AnchorSideTop.Side = asrBottom
74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA Left = 132
90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 Height = 26
74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 Top = 47
4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF Width = 26
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF BorderSpacing.Top = 4
FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Images = MainDataModule.ImageList
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF ImageIndex = 0
FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF OnClick = OutBtnClick
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF Spacing = 0
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF TabOrder = 6
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF end
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF object DepInBtn: TBitBtn[13]
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF AnchorSideLeft.Control = ParamsPanel
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF AnchorSideLeft.Side = asrCenter
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF AnchorSideTop.Control = Label3
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 Left = 132
} Height = 26
Images = MainDataModule.ImageList Top = 80
ImageIndex = 1 Width = 26
OnClick = InBtnClick Images = MainDataModule.ImageList
Spacing = 0 ImageIndex = 1
TabOrder = 1 OnClick = DepInBtnClick
end Spacing = 0
object OutBtn: TBitBtn TabOrder = 7
AnchorSideLeft.Control = Owner end
AnchorSideLeft.Side = asrCenter object DepOutBtn: TBitBtn[14]
AnchorSideTop.Control = InBtn AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom AnchorSideLeft.Side = asrCenter
Left = 198 AnchorSideTop.Control = DepInBtn
Height = 28 AnchorSideTop.Side = asrBottom
Top = 58 Left = 132
Width = 28 Height = 26
BorderSpacing.Top = 4 Top = 110
Images = MainDataModule.ImageList Width = 26
ImageIndex = 0 BorderSpacing.Top = 4
OnClick = OutBtnClick Images = MainDataModule.ImageList
Spacing = 0 ImageIndex = 0
TabOrder = 2 OnClick = DepOutBtnClick
end Spacing = 0
object DepInBtn: TBitBtn TabOrder = 8
AnchorSideLeft.Control = Owner end
AnchorSideLeft.Side = asrCenter object StatusInBtn: TBitBtn[15]
AnchorSideTop.Control = Label3 AnchorSideLeft.Control = ParamsPanel
Left = 198 AnchorSideLeft.Side = asrCenter
Height = 28 AnchorSideBottom.Control = StatusOutBtn
Top = 108 Left = 132
Width = 28 Height = 26
Images = MainDataModule.ImageList Top = 144
ImageIndex = 1 Width = 26
OnClick = DepInBtnClick Anchors = [akLeft, akBottom]
Spacing = 0 BorderSpacing.Bottom = 4
TabOrder = 4 Images = MainDataModule.ImageList
end ImageIndex = 1
object DepOutBtn: TBitBtn OnClick = StatusInBtnClick
AnchorSideLeft.Control = Owner Spacing = 0
AnchorSideLeft.Side = asrCenter TabOrder = 9
AnchorSideTop.Control = DepInBtn end
AnchorSideTop.Side = asrBottom object StatusOutBtn: TBitBtn[16]
Left = 198 AnchorSideLeft.Control = ParamsPanel
Height = 28 AnchorSideLeft.Side = asrCenter
Top = 140 AnchorSideTop.Side = asrBottom
Width = 28 AnchorSideBottom.Control = VarList
BorderSpacing.Top = 4 AnchorSideBottom.Side = asrBottom
Images = MainDataModule.ImageList Left = 132
ImageIndex = 0 Height = 26
OnClick = DepOutBtnClick Top = 174
Spacing = 0 Width = 26
TabOrder = 5 Anchors = [akLeft, akBottom]
end Images = MainDataModule.ImageList
object StatusInBtn: TBitBtn ImageIndex = 0
AnchorSideLeft.Control = Owner OnClick = StatusOutBtnClick
AnchorSideLeft.Side = asrCenter Spacing = 0
AnchorSideBottom.Control = StatusOutBtn TabOrder = 10
Left = 198 end
Height = 28 object BlockList: TListBox[17]
Top = 187 AnchorSideLeft.Control = InBtn
Width = 28 AnchorSideLeft.Side = asrBottom
Anchors = [akLeft, akBottom] AnchorSideTop.Control = Label2
BorderSpacing.Bottom = 4 AnchorSideTop.Side = asrBottom
Images = MainDataModule.ImageList AnchorSideRight.Control = ParamsPanel
ImageIndex = 1 AnchorSideRight.Side = asrBottom
OnClick = StatusInBtnClick AnchorSideBottom.Control = Label3
Spacing = 0 Left = 164
TabOrder = 7 Height = 39
end Top = 25
object StatusOutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 198
Height = 28
Top = 219
Width = 28
Anchors = [akLeft, akBottom]
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = StatusOutBtnClick
Spacing = 0
TabOrder = 8
end
object BlockList: TListBox
AnchorSideLeft.Control = InBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label3
Left = 234
Height = 67
Top = 25
Width = 182
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 16
ItemHeight = 0
OnSelectionChange = VarListSelectionChange
TabOrder = 3
end
object DepVar: TEdit
AnchorSideLeft.Control = InBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VarList
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 234
Height = 23
Top = 125
Width = 182
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 6
Text = 'DepVar'
end
object StatusEdit: TEdit
AnchorSideLeft.Control = DepInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = StatusOutBtn
AnchorSideBottom.Side = asrBottom
Left = 234
Height = 23
Top = 212
Width = 182
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 9
Text = 'StatusEdit'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 97
Top = 255
Width = 171
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 77
ClientWidth = 167
TabOrder = 10
object DescChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 127 Width = 127
Caption = 'Descriptive Statistics' Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 0 BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Bottom = 16
ItemHeight = 0
OnDblClick = BlockListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 11
end end
object ProbsChk: TCheckBox object DepVar: TEdit[18]
Left = 12 AnchorSideLeft.Control = InBtn
Height = 19 AnchorSideLeft.Side = asrBottom
Top = 29 AnchorSideTop.Control = VarList
Width = 143 AnchorSideTop.Side = asrCenter
Caption = 'Base Survival Functions' AnchorSideRight.Control = ParamsPanel
TabOrder = 1 AnchorSideRight.Side = asrBottom
Left = 166
Height = 23
Top = 97
Width = 125
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
ReadOnly = True
TabOrder = 12
Text = 'DepVar'
end end
object ItersChk: TCheckBox object StatusEdit: TEdit[19]
Left = 12 AnchorSideLeft.Control = DepInBtn
Height = 19 AnchorSideLeft.Side = asrBottom
Top = 52 AnchorSideRight.Control = ParamsPanel
Width = 101 AnchorSideRight.Side = asrBottom
Caption = 'Show Iterations' AnchorSideBottom.Control = StatusOutBtn
TabOrder = 2 AnchorSideBottom.Side = asrBottom
Left = 166
Height = 23
Top = 165
Width = 125
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 13
Text = 'StatusEdit'
end
object GroupBox1: TGroupBox[20]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 97
Top = 239
Width = 171
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 77
ClientWidth = 167
TabOrder = 14
object DescChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 127
Caption = 'Descriptive Statistics'
TabOrder = 0
end
object ProbsChk: TCheckBox
Left = 12
Height = 19
Top = 29
Width = 143
Caption = 'Base Survival Functions'
TabOrder = 1
end
object ItersChk: TCheckBox
Left = 12
Height = 19
Top = 52
Width = 101
Caption = 'Show Iterations'
TabOrder = 2
end
end
object MaxItsEdit: TEdit[21]
AnchorSideLeft.Control = Label5
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 125
Height = 23
Top = 208
Width = 42
Alignment = taRightJustify
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabOrder = 15
Text = 'MaxItsEdit'
end end
end end
object MaxItsEdit: TEdit inherited ParamsSplitter: TSplitter
AnchorSideLeft.Control = Label5 Height = 393
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrCenter
Left = 344
Height = 23
Top = 292
Width = 42
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Right = 8
TabOrder = 11
Text = 'MaxItsEdit'
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 215
Height = 25
Top = 368
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 12
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 277
Height = 25
Top = 368
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 13
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 361
Height = 25
Top = 368
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 14
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 352
Width = 424
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end end
end end

View File

@@ -5,26 +5,22 @@ unit CoxRegUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
Globals, MainUnit, OutputUnit; Globals, MainUnit, BasicStatsReportFormUnit;
type type
{ TCoxRegFrm } { TCoxRegForm }
TCoxRegFrm = class(TForm) TCoxRegForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
InBtn: TBitBtn; InBtn: TBitBtn;
OutBtn: TBitBtn; OutBtn: TBitBtn;
DepInBtn: TBitBtn; DepInBtn: TBitBtn;
DepOutBtn: TBitBtn; DepOutBtn: TBitBtn;
StatusInBtn: TBitBtn; StatusInBtn: TBitBtn;
StatusOutBtn: TBitBtn; StatusOutBtn: TBitBtn;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
DescChk: TCheckBox; DescChk: TCheckBox;
MaxItsEdit: TEdit; MaxItsEdit: TEdit;
Label5: TLabel; Label5: TLabel;
@@ -39,131 +35,98 @@ type
Label3: TLabel; Label3: TLabel;
Label4: TLabel; Label4: TLabel;
VarList: TListBox; VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject); procedure BlockListDblClick(Sender: TObject);
procedure DepInBtnClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject);
procedure DepOutBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure StatusInBtnClick(Sender: TObject); procedure StatusInBtnClick(Sender: TObject);
procedure StatusOutBtnClick(Sender: TObject); procedure StatusOutBtnClick(Sender: TObject);
function ChiSq(x : double; n : integer) : double; function ChiSq(x : double; n : integer) : double;
function Norm(z : double): double; function Norm(z : double): double;
function ix(j, k, nCols : integer): integer; function ix(j, k, nCols : integer): integer;
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
private private
{ private declarations } { private declarations }
FAutoSized: Boolean;
procedure UpdateBtnStates; protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
public public
{ public declarations } procedure Reset; override;
end; end;
var var
CoxRegFrm: TCoxRegFrm; CoxRegForm: TCoxRegForm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils; Utils;
{ TCoxRegFrm } { TCoxRegForm }
procedure TCoxRegFrm.ResetBtnClick(Sender: TObject); procedure TCoxRegForm.AdjustConstraints;
begin
inherited;
ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
GroupBox1.Width);
ParamsPanel.Constraints.MinHeight := InBtn.Top + 6*InBtn.Height + 7*OutBtn.BorderSpacing.Top +
VarList.BorderSpacing.Bottom + MaxItsEdit.Height + MaxItsEdit.BorderSpacing.Bottom +
GroupBox1.Height + ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
end;
procedure TCoxRegForm.BlockListDblClick(Sender: TObject);
var var
i: integer; index: Integer;
begin begin
BlockList.Clear; index := BlockList.ItemIndex;
VarList.Clear; if index > -1 then
for i := 1 to NoVariables do begin
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); VarList.Items.Add(BlockList.Items[index]);
ProbsChk.Checked := true; BlockList.Items.Delete(index);
DescChk.Checked := true; UpdateBtnStates;
DepVar.Text := ''; end;
StatusEdit.Text := '';
MaxItsEdit.Text := '20';
end; end;
procedure TCoxRegFrm.StatusInBtnClick(Sender: TObject);
function TCoxRegForm.ChiSq(x: double; n: integer): double;
var var
index: integer; p, t, a: double;
k: integer;
begin begin
index := VarList.ItemIndex; p := exp(-0.5 * x);
if (index > -1) and (StatusEdit.Text = '') then if n mod 2 = 1 then
p := p * sqrt(2 * x / Pi);
k := n;
while K >= 2 do
begin begin
StatusEdit.Text := VarList.Items[index]; p := p * x / k;
VarList.Items.Delete(index); k := k - 2;
end; end;
UpdateBtnStates;
end;
procedure TCoxRegFrm.StatusOutBtnClick(Sender: TObject); t := p;
begin a := n;
if (StatusEdit.Text <> '') then while t > 0.000001 * p do
begin begin
VarList.Items.Add(StatusEdit.Text); a := a + 2;
StatusEdit.Text := ''; t := t * x / a;
p := p + t;
end; end;
UpdateBtnStates; Result := (1 - p);
end; end;
procedure TCoxRegFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]); procedure TCoxRegForm.Compute;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TCoxRegFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TCoxRegFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TCoxRegFrm.DepInBtnClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (DepVar.Text = '') then
begin
DepVar.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
procedure TCoxRegFrm.DepOutBtnClick(Sender: TObject);
begin
if DepVar.Text <> '' then
begin
VarList.Items.Add(DepVar.Text);
DepVar.Text := '';
end;
UpdateBtnStates;
end;
procedure TCoxRegFrm.ComputeBtnClick(Sender: TObject);
var var
i, j, k : integer; i, j, k : integer;
indx : integer; indx : integer;
@@ -524,30 +487,40 @@ begin
end; end;
end; end;
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
SurvT := nil;
Stat := nil;
Alpha := nil;
x := nil;
b := nil;
a := nil;
s1 := nil;
s2 := nil;
s := nil;
Av := nil;
SD := nil;
SE := nil;
RowLabels := nil;
ColLabels := nil;
ColNoSelected := nil;
end; end;
end; end;
procedure TCoxRegFrm.InBtnClick(Sender: TObject);
procedure TCoxRegForm.DepInBtnClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (DepVar.Text = '') then
begin
DepVar.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
procedure TCoxRegForm.DepOutBtnClick(Sender: TObject);
begin
if DepVar.Text <> '' then
begin
VarList.Items.Add(DepVar.Text);
DepVar.Text := '';
end;
UpdateBtnStates;
end;
procedure TCoxRegForm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@@ -565,66 +538,87 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCoxRegFrm.OutBtnClick(Sender: TObject);
function TCoxRegForm.ix(j, k, nCols : integer): integer;
begin
Result := j*nCols + k;
end;
function TCoxRegForm.Norm(z: double): double;
begin
Result := ChiSq(z*z, 1);
end;
procedure TCoxRegForm.OutBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
i := 0; i := 0;
while i < BlockList.Items.Count do while i < BlockList.Items.Count do
begin begin
if BlockList.Selected[i] then if BlockList.Selected[i] then
begin
VarList.Items.Add(BlockList.Items[i]);
BlockList.Items.Delete(i);
i := 0;
end else
i := i + 1;
UpdateBtnStates;
end;
end;
procedure TCoxRegForm.Reset;
var
i: integer;
begin
inherited;
BlockList.Clear;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
ProbsChk.Checked := true;
DescChk.Checked := true;
DepVar.Text := '';
StatusEdit.Text := '';
MaxItsEdit.Text := '20';
end;
procedure TCoxRegForm.StatusInBtnClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (StatusEdit.Text = '') then
begin begin
VarList.Items.Add(BlockList.Items[i]); StatusEdit.Text := VarList.Items[index];
BlockList.Items.Delete(i); VarList.Items.Delete(index);
i := 0;
end else
i := i + 1;
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
function TCoxRegFrm.ChiSq(x: double; n: integer): double;
var
p, t, a: double;
k: integer;
begin
p := exp(-0.5 * x);
if n mod 2 = 1 then
p := p * sqrt(2 * x / Pi);
k := n; procedure TCoxRegForm.StatusOutBtnClick(Sender: TObject);
while K >= 2 do begin
if (StatusEdit.Text <> '') then
begin begin
p := p * x / k; VarList.Items.Add(StatusEdit.Text);
k := k - 2; StatusEdit.Text := '';
end; end;
UpdateBtnStates;
t := p;
a := n;
while t > 0.000001 * p do
begin
a := a + 2;
t := t * x / a;
p := p + t;
end;
Result := (1 - p);
end; end;
function TCoxRegFrm.Norm(z: double): double;
begin
Result := ChiSq(z*z, 1);
end;
//-------------------------------------------------------------------
function TCoxRegFrm.ix(j, k, nCols : integer): integer; procedure TCoxRegForm.UpdateBtnStates;
begin
Result := j*nCols + k;
end;
procedure TCoxRegFrm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
begin begin
inherited;
lSelected := AnySelected(VarList); lSelected := AnySelected(VarList);
InBtn.Enabled := lSelected; InBtn.Enabled := lSelected;
DepInBtn.Enabled := lSelected and (DepVar.Text = ''); DepInBtn.Enabled := lSelected and (DepVar.Text = '');
@@ -635,14 +629,27 @@ begin
StatusOutBtn.Enabled := StatusEdit.Text <> ''; StatusOutBtn.Enabled := StatusEdit.Text <> '';
end; end;
procedure TCoxRegFrm.VarListSelectionChange(Sender: TObject; User: boolean);
procedure TCoxRegForm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
BlockList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TCoxRegForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
initialization
{$I coxregunit.lrs}
end. end.

View File

@@ -1,4 +1,4 @@
object LinProFrm: TLinProFrm object LinProForm: TLinProForm
Left = 445 Left = 445
Height = 507 Height = 507
Top = 263 Top = 263
@@ -613,11 +613,11 @@ object LinProFrm: TLinProFrm
TabOrder = 3 TabOrder = 3
end end
object OpenDialog1: TOpenDialog object OpenDialog1: TOpenDialog
left = 696 Left = 696
top = 136 Top = 136
end end
object SaveDialog1: TSaveDialog object SaveDialog1: TSaveDialog
left = 600 Left = 600
top = 120 Top = 120
end end
end end

View File

@@ -11,9 +11,9 @@ uses
type type
{ TLinProFrm } { TLinProForm }
TLinProFrm = class(TForm) TLinProForm = class(TForm)
Bevel1: TBevel; Bevel1: TBevel;
ExitBtn: TButton; ExitBtn: TButton;
Panel1: TPanel; Panel1: TPanel;
@@ -98,16 +98,16 @@ type
end; end;
var var
LinProFrm: TLinProFrm; LinProForm: TLinProForm;
implementation implementation
uses uses
Math; Math;
{ TLinProFrm } { TLinProForm }
procedure TLinProFrm.ResetBtnClick(Sender: TObject); procedure TLinProForm.ResetBtnClick(Sender: TObject);
begin begin
NoVarsEdit.Text := '0'; NoVarsEdit.Text := '0';
NoMaxEdit.Text := ''; NoMaxEdit.Text := '';
@@ -139,7 +139,7 @@ begin
ResultsEdit.Text := ''; ResultsEdit.Text := '';
end; end;
procedure TLinProFrm.SaveBtnClick(Sender: TObject); procedure TLinProForm.SaveBtnClick(Sender: TObject);
var var
F : TextFile; F : TextFile;
i, j : integer; i, j : integer;
@@ -170,7 +170,7 @@ begin
end; end;
end; end;
procedure TLinProFrm.FormActivate(Sender: TObject); procedure TLinProForm.FormActivate(Sender: TObject);
var var
w: Integer; w: Integer;
begin begin
@@ -188,17 +188,17 @@ begin
FAutoSized := true; FAutoSized := true;
end; end;
procedure TLinProFrm.FormCreate(Sender: TObject); procedure TLinProForm.FormCreate(Sender: TObject);
begin begin
if OutputFrm = nil then Application.CreateForm(TOutputFrm, OutputFrm); if OutputFrm = nil then Application.CreateForm(TOutputFrm, OutputFrm);
end; end;
procedure TLinProFrm.FormShow(Sender: TObject); procedure TLinProForm.FormShow(Sender: TObject);
begin begin
ResetBtnClick(Self); ResetBtnClick(Self);
end; end;
procedure TLinProFrm.LoadBtnClick(Sender: TObject); procedure TLinProForm.LoadBtnClick(Sender: TObject);
var var
i, j : integer; i, j : integer;
FName : string; FName : string;
@@ -283,7 +283,7 @@ begin
ComputeBtn.SetFocus; ComputeBtn.SetFocus;
end; end;
procedure TLinProFrm.CancelBtnClick(Sender: TObject); procedure TLinProForm.CancelBtnClick(Sender: TObject);
begin begin
Coefficients := nil; Coefficients := nil;
EqlConstraints := nil; EqlConstraints := nil;
@@ -293,7 +293,7 @@ begin
Close; Close;
end; end;
procedure TLinProFrm.ComputeBtnClick(Sender: TObject); procedure TLinProForm.ComputeBtnClick(Sender: TObject);
var var
m1, m2, m3, m, mp, n, np, nm1m2 : integer; m1, m2, m3, m, mp, n, np, nm1m2 : integer;
i,icase,j : integer; i,icase,j : integer;
@@ -415,7 +415,7 @@ begin
izrov := nil; izrov := nil;
end; end;
procedure TLinProFrm.ExitBtnClick(Sender: TObject); procedure TLinProForm.ExitBtnClick(Sender: TObject);
begin begin
Coefficients := nil; Coefficients := nil;
EqlConstraints := nil; EqlConstraints := nil;
@@ -425,7 +425,7 @@ begin
Close; Close;
end; end;
procedure TLinProFrm.NoEqualEditExit(Sender: TObject); procedure TLinProForm.NoEqualEditExit(Sender: TObject);
VAR value : integer; VAR value : integer;
begin begin
value := StrToInt(NoEqualEdit.Text); value := StrToInt(NoEqualEdit.Text);
@@ -438,12 +438,12 @@ begin
SetLength(Coefficients,NoCoefs+1,NoVars+1); SetLength(Coefficients,NoCoefs+1,NoVars+1);
end; end;
procedure TLinProFrm.NoEqualEditKeyPress(Sender: TObject; var Key: char); procedure TLinProForm.NoEqualEditKeyPress(Sender: TObject; var Key: char);
begin begin
if ord(Key) = 13 then ObjectiveGrid.SetFocus; if ord(Key) = 13 then ObjectiveGrid.SetFocus;
end; end;
procedure TLinProFrm.NoMaxEditExit(Sender: TObject); procedure TLinProForm.NoMaxEditExit(Sender: TObject);
VAR value : integer; VAR value : integer;
begin begin
value := StrToInt(NoMaxEdit.Text); value := StrToInt(NoMaxEdit.Text);
@@ -454,12 +454,12 @@ begin
SetLength(MaxConstraints,NoMax + 1); SetLength(MaxConstraints,NoMax + 1);
end; end;
procedure TLinProFrm.NoMaxEditKeyPress(Sender: TObject; var Key: char); procedure TLinProForm.NoMaxEditKeyPress(Sender: TObject; var Key: char);
begin begin
if ord(Key) = 13 then NoMinEdit.SetFocus; if ord(Key) = 13 then NoMinEdit.SetFocus;
end; end;
procedure TLinProFrm.NoMinEditExit(Sender: TObject); procedure TLinProForm.NoMinEditExit(Sender: TObject);
VAR value : integer; VAR value : integer;
begin begin
value := StrToInt(NoMinEdit.Text); value := StrToInt(NoMinEdit.Text);
@@ -470,12 +470,12 @@ begin
SetLength(MinConstraints,NoMin + 1); SetLength(MinConstraints,NoMin + 1);
end; end;
procedure TLinProFrm.NoMinEditKeyPress(Sender: TObject; var Key: char); procedure TLinProForm.NoMinEditKeyPress(Sender: TObject; var Key: char);
begin begin
if ord(Key) = 13 then NoEqualEdit.SetFocus; if ord(Key) = 13 then NoEqualEdit.SetFocus;
end; end;
procedure TLinProFrm.NoVarsEditExit(Sender: TObject); procedure TLinProForm.NoVarsEditExit(Sender: TObject);
var value : integer; var value : integer;
begin begin
value := StrToInt(NoVarsEdit.Text); value := StrToInt(NoVarsEdit.Text);
@@ -488,12 +488,12 @@ begin
SetLength(Objective,NoVars + 1); SetLength(Objective,NoVars + 1);
end; end;
procedure TLinProFrm.NoVarsEditKeyPress(Sender: TObject; var Key: char); procedure TLinProForm.NoVarsEditKeyPress(Sender: TObject; var Key: char);
begin begin
if ord(Key) = 13 then NoMaxEdit.SetFocus; if ord(Key) = 13 then NoMaxEdit.SetFocus;
end; end;
PROCEDURE TLinProFrm.simplx(VAR a: DblDyneMat; m,n,mp,np,m1,m2,m3: integer; PROCEDURE TLinProForm.simplx(VAR a: DblDyneMat; m,n,mp,np,m1,m2,m3: integer;
VAR icase: integer; VAR izrov: IntDyneVec; VAR icase: integer; VAR izrov: IntDyneVec;
VAR iposv: IntDyneVec); VAR iposv: IntDyneVec);
LABEL 1,2,10,20,30,99; LABEL 1,2,10,20,30,99;
@@ -607,7 +607,7 @@ BEGIN
END; END;
PROCEDURE TLinProFrm.simp1(VAR a: DblDyneMat; mp,np,mm: integer; PROCEDURE TLinProForm.simp1(VAR a: DblDyneMat; mp,np,mm: integer;
ll: IntDyneVec; nll,iabf: integer; ll: IntDyneVec; nll,iabf: integer;
VAR kp: integer; VAR bmax: double); VAR kp: integer; VAR bmax: double);
LABEL 99; LABEL 99;
@@ -632,7 +632,7 @@ BEGIN
99: END; 99: END;
PROCEDURE TLinProFrm.simp2(VAR a: DblDyneMat; m,n,mp,np: integer; PROCEDURE TLinProForm.simp2(VAR a: DblDyneMat; m,n,mp,np: integer;
l2: IntDyneVec; nl2: integer; VAR ip: integer; l2: IntDyneVec; nl2: integer; VAR ip: integer;
kp: integer; VAR q1: double); kp: integer; VAR q1: double);
LABEL 2,6,99; LABEL 2,6,99;
@@ -670,7 +670,7 @@ BEGIN
end; end;
PROCEDURE TLinProFrm.simp3(VAR a: DblDyneMat; mp,np,i1,k1,ip,kp: integer); PROCEDURE TLinProForm.simp3(VAR a: DblDyneMat; mp,np,i1,k1,ip,kp: integer);
(* Programs using routine SIMP3 must define the type (* Programs using routine SIMP3 must define the type
TYPE TYPE
glmpbynp = ARRAY [1..mp,1..np] OF real; glmpbynp = ARRAY [1..mp,1..np] OF real;
@@ -700,7 +700,7 @@ BEGIN
END; END;
procedure TLinProFrm.LoadArrayData(Sender: TObject); procedure TLinProForm.LoadArrayData(Sender: TObject);
var var
i, j : integer; i, j : integer;
begin begin

View File

@@ -1,305 +1,260 @@
object LogRegFrm: TLogRegFrm inherited LogRegForm: TLogRegForm
Left = 876 Left = 566
Height = 355 Height = 342
Top = 245 Top = 243
Width = 353 Width = 582
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/BinaryLogisticRegression.htm' HelpKeyword = 'html/BinaryLogisticRegression.htm'
AutoSize = True
Caption = 'Binary Logistic Regression' Caption = 'Binary Logistic Regression'
ClientHeight = 355 ClientHeight = 342
ClientWidth = 353 ClientWidth = 582
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 326
OnShow = FormShow ClientHeight = 326
Position = poMainFormCenter inherited CloseBtn: TButton
LCLVersion = '2.1.0.0' Top = 301
object Label1: TLabel TabOrder = 12
AnchorSideLeft.Control = Owner end
AnchorSideTop.Control = Owner inherited ComputeBtn: TButton
Left = 8 Top = 301
Height = 15 TabOrder = 11
Top = 8 end
Width = 97 inherited ResetBtn: TButton
BorderSpacing.Left = 8 Top = 301
BorderSpacing.Top = 8 TabOrder = 10
BorderSpacing.Right = 8 end
Caption = 'Available Variables' inherited HelpBtn: TButton
ParentColor = False Top = 301
end TabOrder = 9
object Label2: TLabel end
AnchorSideLeft.Control = DepVar inherited ButtonBevel: TBevel
AnchorSideBottom.Control = DepVar Top = 285
Left = 198 end
Height = 15 object Label1: TLabel[5]
Top = 31 AnchorSideLeft.Control = ParamsPanel
Width = 102 AnchorSideTop.Control = ParamsPanel
Anchors = [akLeft, akBottom] Left = 0
BorderSpacing.Bottom = 2 Height = 15
Caption = 'Dependent Variable' Top = 0
ParentColor = False Width = 97
end BorderSpacing.Right = 8
object Label3: TLabel Caption = 'Available Variables'
AnchorSideLeft.Control = BlockList ParentColor = False
AnchorSideTop.Control = InBtn end
Left = 198 object Label2: TLabel[6]
Height = 15 AnchorSideLeft.Control = DepVarEdit
Top = 120 AnchorSideBottom.Control = DepVarEdit
Width = 116 Left = 164
Caption = 'Independent Variables' Height = 15
ParentColor = False Top = 19
end Width = 102
object Label4: TLabel Anchors = [akLeft, akBottom]
AnchorSideLeft.Control = GroupBox1 BorderSpacing.Bottom = 2
AnchorSideLeft.Side = asrBottom Caption = 'Dependent Variable'
AnchorSideTop.Control = GroupBox1 ParentColor = False
AnchorSideTop.Side = asrCenter end
Left = 179 object Label3: TLabel[7]
Height = 15 AnchorSideLeft.Control = BlockList
Top = 247 AnchorSideTop.Control = InBtn
Width = 107 Left = 164
BorderSpacing.Left = 16 Height = 15
Caption = 'Maximum Iterations' Top = 103
ParentColor = False Width = 116
end Caption = 'Independent Variables'
object VarList: TListBox ParentColor = False
AnchorSideLeft.Control = Owner end
AnchorSideTop.Control = Label1 object VarList: TListBox[8]
AnchorSideTop.Side = asrBottom AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = DepInBtn AnchorSideTop.Control = Label1
AnchorSideBottom.Control = GroupBox1 AnchorSideTop.Side = asrBottom
Left = 8 AnchorSideRight.Control = DepInBtn
Height = 170 AnchorSideBottom.Control = OptionsGroup
Top = 25 Left = 0
Width = 146 Height = 157
Anchors = [akTop, akLeft, akRight, akBottom] Top = 17
BorderSpacing.Left = 8 Width = 126
BorderSpacing.Top = 2 Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 8 BorderSpacing.Top = 2
BorderSpacing.Bottom = 8 BorderSpacing.Right = 6
ItemHeight = 0 BorderSpacing.Bottom = 8
MultiSelect = True ItemHeight = 0
OnSelectionChange = VarListSelectionChange MultiSelect = True
TabOrder = 0 OnDblClick = VarListDblClick
end OnSelectionChange = VarListSelectionChange
object DepInBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 162
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 1
end
object DepOutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 162
Height = 28
Top = 55
Width = 28
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2
end
object InBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 162
Height = 28
Top = 120
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 4
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 162
Height = 28
Top = 148
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5
end
object DepVar: TEdit
AnchorSideLeft.Control = DepInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 198
Height = 23
Top = 48
Width = 147
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVar'
end
object BlockList: TListBox
AnchorSideLeft.Control = InBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 198
Height = 60
Top = 135
Width = 147
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 103
Top = 203
Width = 155
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 83
ClientWidth = 151
TabOrder = 7
object DescChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 127
Caption = 'Descriptive Statistics'
TabOrder = 0 TabOrder = 0
end end
object ProbsChk: TCheckBox object DepInBtn: TBitBtn[9]
Left = 12 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 32 AnchorSideTop.Control = VarList
Width = 95 Left = 132
Caption = 'Y Probabilities' Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object ItersChk: TCheckBox object DepOutBtn: TBitBtn[10]
Left = 12 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 58 AnchorSideTop.Control = DepInBtn
Width = 101 AnchorSideTop.Side = asrBottom
Caption = 'Show Iterations' Left = 132
Height = 26
Top = 45
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2 TabOrder = 2
end end
object InBtn: TBitBtn[11]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom
Left = 132
Height = 26
Top = 103
Width = 26
BorderSpacing.Top = 32
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 4
end
object OutBtn: TBitBtn[12]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 132
Height = 26
Top = 131
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5
end
object DepVarEdit: TEdit[13]
AnchorSideLeft.Control = DepInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 164
Height = 23
Top = 36
Width = 127
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVarEdit'
end
object BlockList: TListBox[14]
AnchorSideLeft.Control = DepInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 164
Height = 56
Top = 118
Width = 127
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
ItemHeight = 0
MultiSelect = True
OnDblClick = BlockListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
object MaxItsLabel: TLabel[15]
AnchorSideLeft.Control = OptionsGroup
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = MaxItsEdit
Left = 171
Height = 15
Top = 205
Width = 107
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 16
BorderSpacing.Bottom = 2
Caption = 'Maximum Iterations'
ParentColor = False
end
object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 103
Top = 182
Width = 155
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 83
ClientWidth = 151
TabOrder = 7
object DescChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 127
Caption = 'Descriptive Statistics'
TabOrder = 0
end
object ProbsChk: TCheckBox
Left = 12
Height = 19
Top = 32
Width = 95
Caption = 'Y Probabilities'
TabOrder = 1
end
object ItersChk: TCheckBox
Left = 12
Height = 19
Top = 58
Width = 101
Caption = 'Show Iterations'
TabOrder = 2
end
end
object MaxItsEdit: TEdit[17]
AnchorSideLeft.Control = MaxItsLabel
AnchorSideTop.Control = OptionsGroup
AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom
Left = 187
Height = 23
Top = 222
Width = 40
Alignment = taRightJustify
BorderSpacing.Left = 16
TabOrder = 8
Text = 'MaxItsEdit'
end
end end
object MaxItsEdit: TEdit inherited ParamsSplitter: TSplitter
AnchorSideLeft.Control = Label4 Height = 342
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrCenter
Left = 294
Height = 23
Top = 243
Width = 38
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Right = 8
TabOrder = 8
Text = 'MaxItsEdit'
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 140
Height = 25
Top = 322
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 9
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 202
Height = 25
Top = 322
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 10
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 286
Height = 25
Top = 322
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 11
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 306
Width = 353
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end end
end end

View File

@@ -1,286 +1,250 @@
object SimultFrm: TSimultFrm inherited SimultForm: TSimultForm
Left = 872 Left = 619
Height = 447 Height = 447
Top = 291 Top = 274
Width = 437 Width = 866
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/SimultaneousMultipleRegression.htm' HelpKeyword = 'html/SimultaneousMultipleRegression.htm'
AutoSize = True
Caption = 'Simultaneous Multiple Regression' Caption = 'Simultaneous Multiple Regression'
ClientHeight = 447 ClientHeight = 447
ClientWidth = 437 ClientWidth = 866
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 431
OnShow = FormShow Width = 407
Position = poMainFormCenter ClientHeight = 431
LCLVersion = '2.1.0.0' ClientWidth = 407
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 352
AnchorSideTop.Control = Owner Top = 406
Left = 8 TabOrder = 9
Height = 15
Top = 8
Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = ListBox1
AnchorSideTop.Control = Owner
Left = 249
Height = 15
Top = 8
Width = 127
BorderSpacing.Top = 8
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = GroupBox1
Left = 8
Height = 234
Top = 25
Width = 179
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Constraints.MinHeight = 220
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 204
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 1
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 204
Height = 28
Top = 65
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 2
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 195
Height = 25
Top = 112
Width = 46
AutoSize = True
Caption = 'ALL'
OnClick = AllBtnClick
TabOrder = 3
end
object ListBox1: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 249
Height = 235
Top = 24
Width = 180
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 4
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 123
Top = 267
Width = 417
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 103
ClientWidth = 413
TabOrder = 5
object MatInChkBox: TCheckBox
Left = 12
Height = 19
Top = 0
Width = 175
Caption = 'Get Data From a Matrix File'
TabOrder = 0
end end
object MatSaveChkBox: TCheckBox inherited ComputeBtn: TButton
Left = 203 Left = 268
Height = 19 Top = 406
Top = 0
Width = 198
Caption = 'Save Correlation Matrix'
TabOrder = 1
end
object CPChkBox: TCheckBox
Left = 12
Height = 19
Top = 21
Width = 175
Caption = 'Show Cross-Products Matrix'
TabOrder = 2
end
object CovChkBox: TCheckBox
Left = 203
Height = 19
Top = 21
Width = 198
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 3
end
object CorrsChkBox: TCheckBox
Left = 12
Height = 19
Top = 42
Width = 175
Caption = 'Show Intercorrelations Matrix'
TabOrder = 4
end
object MeansChkBox: TCheckBox
Left = 203
Height = 19
Top = 42
Width = 198
Caption = 'Show Means'
TabOrder = 5
end
object VarChkBox: TCheckBox
Left = 12
Height = 19
Top = 63
Width = 175
Caption = 'Show Variances'
TabOrder = 6
end
object SDChkBox: TCheckBox
Left = 203
Height = 19
Top = 63
Width = 198
Caption = 'Show Standard Deviations'
TabOrder = 7
end
object InvMatChkBox: TCheckBox
Left = 12
Height = 19
Top = 84
Width = 175
Caption = 'Show Inverse Matrix'
TabOrder = 8 TabOrder = 8
end end
inherited ResetBtn: TButton
Left = 206
Top = 406
TabOrder = 7
end
inherited HelpBtn: TButton
Left = 147
Top = 406
TabOrder = 6
end
inherited ButtonBevel: TBevel
Top = 390
Width = 407
end
object Label1: TLabel[5]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 15
Top = 0
Width = 97
Caption = 'Available Variables'
ParentColor = False
end
object Label2: TLabel[6]
AnchorSideLeft.Control = SelList
AnchorSideTop.Control = ParamsPanel
Left = 231
Height = 15
Top = 0
Width = 127
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object VarList: TListBox[7]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = OptionsGroup
Left = 0
Height = 222
Top = 17
Width = 177
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 8
Constraints.MinHeight = 220
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn[8]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
Left = 190
Height = 26
Top = 25
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 1
end
object OutBtn: TBitBtn[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
Left = 190
Height = 26
Top = 65
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 2
end
object AllBtn: TBitBtn[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
Left = 183
Height = 25
Top = 112
Width = 40
AutoSize = True
Caption = 'All'
OnClick = AllBtnClick
TabOrder = 3
end
object SelList: TListBox[11]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = OptionsGroup
Left = 231
Height = 222
Top = 17
Width = 168
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = SelListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 4
end
object OptionsGroup: TGroupBox[12]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 135
Top = 247
Width = 417
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 115
ClientWidth = 413
TabOrder = 5
object MatInChkBox: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 175
Caption = 'Get Data From a Matrix File'
TabOrder = 0
end
object MatSaveChkBox: TCheckBox
Left = 203
Height = 19
Top = 6
Width = 198
Caption = 'Save Correlation Matrix'
TabOrder = 1
end
object CPChkBox: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 175
Caption = 'Show Cross-Products Matrix'
TabOrder = 2
end
object CovChkBox: TCheckBox
Left = 203
Height = 19
Top = 27
Width = 198
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 3
end
object CorrsChkBox: TCheckBox
Left = 12
Height = 19
Top = 48
Width = 175
Caption = 'Show Intercorrelations Matrix'
TabOrder = 4
end
object MeansChkBox: TCheckBox
Left = 203
Height = 19
Top = 48
Width = 198
Caption = 'Show Means'
TabOrder = 5
end
object VarChkBox: TCheckBox
Left = 12
Height = 19
Top = 69
Width = 175
Caption = 'Show Variances'
TabOrder = 6
end
object SDChkBox: TCheckBox
Left = 203
Height = 19
Top = 69
Width = 198
Caption = 'Show Standard Deviations'
TabOrder = 7
end
object InvMatChkBox: TCheckBox
Left = 12
Height = 19
Top = 90
Width = 175
Caption = 'Show Inverse Matrix'
TabOrder = 8
end
end
end end
object ResetBtn: TButton inherited ParamsSplitter: TSplitter
AnchorSideRight.Control = ComputeBtn Left = 419
AnchorSideBottom.Control = Owner Height = 447
AnchorSideBottom.Side = asrBottom
Left = 228
Height = 25
Top = 414
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end end
object ComputeBtn: TButton object OpenDialog1: TOpenDialog[2]
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 290
Height = 25
Top = 414
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 7
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 374
Height = 25
Top = 414
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 8
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 398
Width = 437
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object OpenDialog1: TOpenDialog
Left = 88 Left = 88
Top = 96 Top = 96
end end
object SaveDialog1: TSaveDialog object SaveDialog1: TSaveDialog[3]
Left = 88 Left = 88
Top = 160 Top = 160
end end

View File

@@ -7,20 +7,16 @@ unit SimultRegUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
Globals, MainUnit, MatrixLib, OutputUnit, FunctionsLib, DataProcs; Globals, MainUnit, MatrixLib, FunctionsLib, DataProcs, BasicStatsReportFormUnit;
type type
{ TSimultFrm } { TSimultForm }
TSimultFrm = class(TForm) TSimultForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
OpenDialog1: TOpenDialog; OpenDialog1: TOpenDialog;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
MatInChkBox: TCheckBox; MatInChkBox: TCheckBox;
MatSaveChkBox: TCheckBox; MatSaveChkBox: TCheckBox;
CPChkBox: TCheckBox; CPChkBox: TCheckBox;
@@ -31,103 +27,91 @@ type
VarChkBox: TCheckBox; VarChkBox: TCheckBox;
SDChkBox: TCheckBox; SDChkBox: TCheckBox;
InvMatChkBox: TCheckBox; InvMatChkBox: TCheckBox;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
InBtn: TBitBtn; InBtn: TBitBtn;
OutBtn: TBitBtn; OutBtn: TBitBtn;
AllBtn: TBitBtn; AllBtn: TBitBtn;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
ListBox1: TListBox; SelList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure SelListDblClick(Sender: TObject);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
private private
{ private declarations }
procedure UpdateBtnStates; protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
public public
{ public declarations } procedure Reset; override;
end; end;
var var
SimultFrm: TSimultFrm; SimultForm: TSimultForm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils, MathUnit; Utils, MathUnit;
{ TSimultFrm }
procedure TSimultFrm.ResetBtnClick(Sender: TObject); { TSimultForm }
VAR i : integer;
procedure TSimultForm.AdjustConstraints;
begin begin
VarList.Clear; inherited;
ListBox1.Clear;
for i := 1 to NoVariables do ParamsPanel.Constraints.MinWidth := Max(
begin 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); OptionsGroup.Width);
end;
InBtn.Enabled := true; ParamsPanel.Constraints.MinHeight := AllBtn.Top + AllBtn.Height +
OutBtn.Enabled := false; VarList.BorderSpacing.Bottom + OptionsGroup.Height + ButtonBevel.Height +
CPChkBox.Checked := false; CloseBtn.BorderSpacing.Top + CloseBtn.Height;
CovChkBox.Checked := false;
CorrsChkBox.Checked := true;
MeansChkBox.Checked := true;
VarChkBox.Checked := false;
SDChkBox.Checked := true;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
end; end;
procedure TSimultFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TSimultFrm.FormShow(Sender: TObject); procedure TSimultForm.AllBtnClick(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TSimultFrm.AllBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
for index := 0 to VarList.Items.Count-1 do for index := 0 to VarList.Items.Count-1 do
ListBox1.Items.Add(VarList.Items[index]); SelList.Items.Add(VarList.Items[index]);
VarList.Clear; VarList.Clear;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSimultFrm.ComputeBtnClick(Sender: TObject); procedure TSimultForm.Compute;
var var
NoVars, i, j, NCases, errcode: integer; NoVars, i, j, NCases, errcode: integer;
StdErr, df1, df2, x, determinant : double; StdErr, df1, df2, x, determinant : double;
errorcode : boolean = false; errorcode : boolean = false;
filename : string; filename : string;
cellstring, valstring : string; cellstring, valstring : string;
Corrs : DblDyneMat; Corrs : DblDyneMat = nil;
Means : DblDyneVec; Means : DblDyneVec = nil;
Variances : DblDyneVec; Variances : DblDyneVec = nil;
StdDevs : DblDyneVec; StdDevs : DblDyneVec = nil;
ColNoSelected : IntDyneVec; ColNoSelected : IntDyneVec = nil;
title : string; title : string;
RowLabels : StrDyneVec; RowLabels : StrDyneVec = nil;
ColLabels : StrDyneVec; ColLabels : StrDyneVec = nil;
InverseMat : DblDyneMat; InverseMat : DblDyneMat = nil;
R2s : DblDyneVec; R2s : DblDyneVec = nil;
W : DblDyneVec; W : DblDyneVec = nil;
ProdMat : DblDyneMat; ProdMat : DblDyneMat = nil;
FProbs : DblDyneVec; FProbs : DblDyneVec = nil;
CorrMat : DblDyneMat; CorrMat : DblDyneMat = nil;
lReport: TStrings; lReport: TStrings;
begin begin
@@ -165,7 +149,7 @@ begin
end else end else
begin begin
{ get variable columns } { get variable columns }
NoVars := ListBox1.Items.Count; NoVars := SelList.Items.Count;
if NoVars < 1 then if NoVars < 1 then
begin begin
MessageDlg('No variables selected.',mtError, [mbOK], 0); MessageDlg('No variables selected.',mtError, [mbOK], 0);
@@ -173,7 +157,7 @@ begin
end; end;
for i := 1 to NoVars do for i := 1 to NoVars do
begin begin
cellstring := ListBox1.Items.Strings[i-1]; cellstring := SelList.Items.Strings[i-1];
for j := 1 to NoVariables do for j := 1 to NoVariables do
begin begin
if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then
@@ -354,7 +338,7 @@ begin
finally finally
if lReport.Count > 0 then if lReport.Count > 0 then
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
ColNoSelected := nil; ColNoSelected := nil;
CorrMat := nil; CorrMat := nil;
@@ -372,25 +356,8 @@ begin
end; end;
end; end;
procedure TSimultFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width; procedure TSimultForm.InBtnClick(Sender: TObject);
Constraints.MinHeight := Height;
end;
procedure TSimultFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TSimultFrm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@@ -399,7 +366,7 @@ begin
begin begin
if VarList.Selected[i] then if VarList.Selected[i] then
begin begin
ListBox1.Items.Add(VarList.Items[i]); SelList.Items.Add(VarList.Items[i]);
VarList.Items.Delete(i); VarList.Items.Delete(i);
i := 0; i := 0;
end end
@@ -409,17 +376,18 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSimultFrm.OutBtnClick(Sender: TObject);
procedure TSimultForm.OutBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
i := 0; i := 0;
while i < Listbox1.Items.Count do while i < SelList.Items.Count do
begin begin
if Listbox1.Selected[i] then if SelList.Selected[i] then
begin begin
VarList.Items.Add(Listbox1.Items[i]); VarList.Items.Add(SelList.Items[i]);
Listbox1.Items.Delete(i); SelList.Items.Delete(i);
i := 0; i := 0;
end else end else
inc(i); inc(i);
@@ -427,15 +395,72 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TSimultFrm.UpdateBtnStates;
procedure TSimultForm.Reset;
var
i: integer;
begin begin
inherited;
VarList.Clear;
SelList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := false;
MeansChkBox.Checked := false;
VarChkBox.Checked := false;
SDChkBox.Checked := false;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
UpdateBtnStates;
end;
procedure TSimultForm.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 TSimultForm.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 TSimultForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TSimultForm.UpdateBtnStates;
begin
inherited;
InBtn.Enabled := AnySelected(VarList); InBtn.Enabled := AnySelected(VarList);
OutBtn.Enabled := AnySelected(ListBox1); OutBtn.Enabled := AnySelected(SelList);
AllBtn.Enabled := VarList.Items.Count > 0; AllBtn.Enabled := VarList.Items.Count > 0;
end; end;
initialization
{$I simultregunit.lrs}
end. end.

View File

@@ -1,377 +1,300 @@
object TwoSLSFrm: TTwoSLSFrm inherited TwoSLSForm: TTwoSLSForm
Left = 582 Left = 582
Height = 416 Height = 376
Top = 203 Top = 203
Width = 415 Width = 415
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/TwoStageLeastSquaresRegression.htm' HelpKeyword = 'html/TwoStageLeastSquaresRegression.htm'
AutoSize = True
Caption = 'Two Stage Least Squares Regression' Caption = 'Two Stage Least Squares Regression'
ClientHeight = 416 ClientHeight = 376
ClientWidth = 415 ClientWidth = 415
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 360
OnShow = FormShow Width = 315
Position = poMainFormCenter ClientHeight = 360
LCLVersion = '2.1.0.0' ClientWidth = 315
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 260
AnchorSideTop.Control = Owner Top = 335
Left = 8 TabOrder = 14
Height = 15 end
Top = 8 inherited ComputeBtn: TButton
Width = 46 Left = 176
BorderSpacing.Left = 8 Top = 335
BorderSpacing.Top = 8 TabOrder = 13
Caption = 'Variables' end
ParentColor = False inherited ResetBtn: TButton
end Left = 114
object Label2: TLabel Top = 335
AnchorSideLeft.Control = DepVarEdit TabOrder = 12
AnchorSideTop.Control = DepIn end
AnchorSideBottom.Control = DepVarEdit inherited HelpBtn: TButton
Left = 229 Left = 55
Height = 15 Top = 335
Top = 25 TabOrder = 11
Width = 102 end
Caption = 'Dependent Variable' inherited ButtonBevel: TBevel
ParentColor = False Top = 319
end Width = 315
object Label3: TLabel end
AnchorSideLeft.Control = Explanatory object Label1: TLabel[5]
AnchorSideTop.Control = ExpIn AnchorSideLeft.Control = ParamsPanel
Left = 229 AnchorSideTop.Control = ParamsPanel
Height = 15 Left = 0
Top = 101 Height = 15
Width = 111 Top = 0
Caption = 'Explanatory Variables' Width = 46
ParentColor = False Caption = 'Variables'
end ParentColor = False
object Label4: TLabel end
AnchorSideLeft.Control = Instrumental object Label2: TLabel[6]
AnchorSideTop.Control = Bevel2 AnchorSideLeft.Control = DepVarEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Control = DepIn
Left = 229 AnchorSideBottom.Control = DepVarEdit
Height = 15 Left = 176
Top = 182 Height = 15
Width = 116 Top = 17
Caption = 'Instrumental Variables' Width = 102
ParentColor = False Caption = 'Dependent Variable'
end ParentColor = False
object VarList: TListBox end
AnchorSideLeft.Control = Owner object Label3: TLabel[7]
AnchorSideTop.Control = Label1 AnchorSideLeft.Control = ExplanatoryList
AnchorSideTop.Side = asrBottom AnchorSideTop.Control = ExpIn
AnchorSideRight.Control = DepIn Left = 176
AnchorSideBottom.Control = GroupBox1 Height = 15
Left = 8 Top = 89
Height = 253 Width = 111
Top = 25 Caption = 'Explanatory Variables'
Width = 177 ParentColor = False
Anchors = [akTop, akLeft, akRight, akBottom] end
BorderSpacing.Left = 8 object Label4: TLabel[8]
BorderSpacing.Top = 2 AnchorSideLeft.Control = InstrumentalList
BorderSpacing.Right = 8 AnchorSideTop.Side = asrCenter
BorderSpacing.Bottom = 8 Left = 176
Constraints.MinHeight = 220 Height = 15
ItemHeight = 0 Top = 182
MultiSelect = True Width = 116
OnSelectionChange = ExplanatorySelectionChange Caption = 'Instrumental Variables'
TabOrder = 0 ParentColor = False
end end
object DepIn: TBitBtn object VarList: TListBox[9]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = Label1
AnchorSideTop.Control = VarList AnchorSideTop.Side = asrBottom
Left = 193 AnchorSideRight.Control = DepIn
Height = 28 AnchorSideBottom.Control = OptionsGroup
Top = 25 Left = 0
Width = 28 Height = 221
Images = MainDataModule.ImageList Top = 17
ImageIndex = 1 Width = 138
OnClick = DepInClick Anchors = [akTop, akLeft, akRight, akBottom]
Spacing = 0 BorderSpacing.Top = 2
TabOrder = 1 BorderSpacing.Right = 6
end BorderSpacing.Bottom = 8
object DepOut: TBitBtn Constraints.MinHeight = 220
AnchorSideLeft.Control = Owner ItemHeight = 0
AnchorSideLeft.Side = asrCenter MultiSelect = True
AnchorSideTop.Control = DepIn OnDblClick = VarListDblClick
AnchorSideTop.Side = asrBottom OnSelectionChange = ExplanatoryListSelectionChange
Left = 193
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutClick
Spacing = 0
TabOrder = 2
end
object ExpIn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOut
AnchorSideTop.Side = asrBottom
Left = 193
Height = 28
Top = 101
Width = 28
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = ExpInClick
Spacing = 0
TabOrder = 4
end
object ExpOut: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ExpIn
AnchorSideTop.Side = asrBottom
Left = 193
Height = 28
Top = 133
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = ExpOutClick
Spacing = 0
TabOrder = 5
end
object InstIn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Label4
AnchorSideBottom.Control = InstOut
Left = 193
Height = 28
Top = 182
Width = 28
BorderSpacing.Bottom = 4
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InstInClick
Spacing = 0
TabOrder = 7
end
object InstOut: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InstIn
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 193
Height = 28
Top = 214
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = InstOutClick
Spacing = 0
TabOrder = 8
end
object DepVarEdit: TEdit
AnchorSideLeft.Control = DepIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOut
AnchorSideBottom.Side = asrBottom
Left = 229
Height = 23
Top = 42
Width = 178
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 3
Text = 'DepVarEdit'
end
object Explanatory: TListBox
AnchorSideLeft.Control = ExpIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label4
Left = 229
Height = 40
Top = 118
Width = 178
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 24
ItemHeight = 0
MultiSelect = True
OnSelectionChange = ExplanatorySelectionChange
TabOrder = 6
end
object Instrumental: TListBox
AnchorSideLeft.Control = InstIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 229
Height = 79
Top = 199
Width = 178
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = ExplanatorySelectionChange
TabOrder = 9
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 73
Top = 286
Width = 316
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 53
ClientWidth = 312
TabOrder = 10
object ProxyRegShowChk: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 273
Caption = 'Show Regression Results for each Proxy Variable'
TabOrder = 0 TabOrder = 0
end end
object SaveItChk: TCheckBox object DepIn: TBitBtn[10]
Left = 16 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 28 AnchorSideTop.Control = VarList
Width = 280 Left = 144
Caption = 'Save Predicted and Residuals of 2nd Stage to Grid' Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInClick
Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object DepOut: TBitBtn[11]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepIn
AnchorSideTop.Side = asrBottom
Left = 144
Height = 26
Top = 47
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutClick
Spacing = 0
TabOrder = 3
end
object ExpIn: TBitBtn[12]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOut
AnchorSideTop.Side = asrBottom
Left = 144
Height = 26
Top = 89
Width = 26
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = ExpInClick
Spacing = 0
TabOrder = 4
end
object ExpOut: TBitBtn[13]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ExpIn
AnchorSideTop.Side = asrBottom
Left = 144
Height = 26
Top = 119
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = ExpOutClick
Spacing = 0
TabOrder = 5
end
object InstIn: TBitBtn[14]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Label4
AnchorSideBottom.Control = InstOut
Left = 144
Height = 26
Top = 182
Width = 26
BorderSpacing.Bottom = 4
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InstInClick
Spacing = 0
TabOrder = 7
end
object InstOut: TBitBtn[15]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InstIn
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 144
Height = 26
Top = 212
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = InstOutClick
Spacing = 0
TabOrder = 8
end
object DepVarEdit: TEdit[16]
AnchorSideLeft.Control = DepIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOut
AnchorSideBottom.Side = asrBottom
Left = 176
Height = 23
Top = 34
Width = 139
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
ReadOnly = True
TabOrder = 2
Text = 'DepVarEdit'
end
object ExplanatoryList: TListBox[17]
AnchorSideLeft.Control = ExpIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label4
Left = 176
Height = 52
Top = 106
Width = 139
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Bottom = 24
ItemHeight = 0
MultiSelect = True
OnDblClick = ExplanatoryListDblClick
OnSelectionChange = ExplanatoryListSelectionChange
TabOrder = 6
end
object InstrumentalList: TListBox[18]
AnchorSideLeft.Control = InstIn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = OptionsGroup
Left = 176
Height = 39
Top = 199
Width = 139
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = InstrumentalListDblClick
OnSelectionChange = ExplanatoryListSelectionChange
TabOrder = 9
end
object OptionsGroup: TGroupBox[19]
AnchorSideLeft.Control = ParamsPanel
Left = 0
Height = 73
Top = 246
Width = 316
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ClientHeight = 53
ClientWidth = 312
TabOrder = 10
object ProxyRegShowChk: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 273
Caption = 'Show Regression Results for each Proxy Variable'
TabOrder = 0
end
object SaveItChk: TCheckBox
Left = 16
Height = 19
Top = 28
Width = 280
Caption = 'Save Predicted and Residuals of 2nd Stage to Grid'
TabOrder = 1
end
end
end end
object ResetBtn: TButton inherited ParamsSplitter: TSplitter
AnchorSideRight.Control = ComputeBtn Left = 327
AnchorSideBottom.Control = Owner Height = 376
AnchorSideBottom.Side = asrBottom
Left = 202
Height = 25
Top = 383
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 12
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 264
Height = 25
Top = 383
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 13
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 348
Height = 25
Top = 383
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 14
end
object HelpBtn: TButton
Tag = 153
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 143
Height = 25
Top = 383
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 11
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 367
Width = 415
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object Bevel2: TBevel
AnchorSideLeft.Control = DepIn
AnchorSideTop.Control = ExpIn
AnchorSideRight.Control = DepIn
AnchorSideBottom.Control = VarList
AnchorSideBottom.Side = asrBottom
Left = 189
Height = 177
Top = 101
Width = 4
Anchors = [akTop, akRight, akBottom]
Shape = bsSpacer
end end
end end

View File

@@ -1,7 +1,7 @@
// File for testing: "cansas.laz" // File for testing: "cansas.laz"
// - dependent variable: jumpgs // - dependent variable: jumpgs
// - exolanatory variables: pulse, chins, situps // - exolanatory variables: pulse, chins, situps
// - instrumental variables: pulse, chins, situps, weight, waist // - InstrumentalList variables: pulse, chins, situps, weight, waist
unit TwoSLSUnit; unit TwoSLSUnit;
@@ -10,28 +10,23 @@ unit TwoSLSUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, math, StdCtrls, Buttons, ExtCtrls, math,
Globals, MainUnit, MainDM, MatrixLib, DictionaryUnit, OutputUnit, ContextHelpUnit; Globals, MainUnit, MainDM, MatrixLib, DictionaryUnit, BasicStatsReportFormUnit;
type type
{ TTwoSLSFrm } { TTwoSLSForm }
TTwoSLSFrm = class(TForm) TTwoSLSForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
Bevel2: TBevel; Bevel2: TBevel;
HelpBtn: TButton;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
ProxyRegShowChk: TCheckBox; ProxyRegShowChk: TCheckBox;
SaveItChk: TCheckBox; SaveItChk: TCheckBox;
DepIn: TBitBtn; DepIn: TBitBtn;
DepOut: TBitBtn; DepOut: TBitBtn;
ExpIn: TBitBtn; ExpIn: TBitBtn;
ExpOut: TBitBtn; ExpOut: TBitBtn;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
InstIn: TBitBtn; InstIn: TBitBtn;
InstOut: TBitBtn; InstOut: TBitBtn;
DepVarEdit: TEdit; DepVarEdit: TEdit;
@@ -39,132 +34,70 @@ type
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
Label4: TLabel; Label4: TLabel;
Explanatory: TListBox; ExplanatoryList: TListBox;
Instrumental: TListBox; InstrumentalList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure DepInClick(Sender: TObject); procedure DepInClick(Sender: TObject);
procedure DepOutClick(Sender: TObject); procedure DepOutClick(Sender: TObject);
procedure ExpInClick(Sender: TObject); procedure ExpInClick(Sender: TObject);
procedure ExplanatorySelectionChange(Sender: TObject; User: boolean); procedure ExplanatoryListDblClick(Sender: TObject);
procedure ExplanatoryListSelectionChange(Sender: TObject; User: boolean);
procedure ExpOutClick(Sender: TObject); procedure ExpOutClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure InstInClick(Sender: TObject); procedure InstInClick(Sender: TObject);
procedure InstOutClick(Sender: TObject); procedure InstOutClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure InstrumentalListDblClick(Sender: TObject);
procedure PredictIt(const ColNoSelected: IntDyneVec; NoVars: integer; procedure PredictIt(const ColNoSelected: IntDyneVec; NoVars: integer;
Means, StdDevs, BetaWeights : DblDyneVec; Means, StdDevs, BetaWeights : DblDyneVec;
StdErrEst : double; NoIndepVars : integer); StdErrEst : double; NoIndepVars : integer);
procedure VarListDblClick(Sender: TObject);
private private
{ private declarations }
FAutoSized: boolean; protected
procedure UpdateBtnStates; procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
public public
{ public declarations } constructor Create(AOwner: TComponent); override;
procedure Reset; override;
end; end;
var var
TwoSLSFrm: TTwoSLSFrm; TwoSLSForm: TTwoSLSForm;
implementation implementation
{$R *.lfm}
uses uses
StrUtils, Utils; StrUtils, Utils;
{ TTwoSLSFrm } { TTwoSLSForm }
procedure TTwoSLSFrm.ResetBtnClick(Sender: TObject); constructor TTwoSLSForm.Create(AOwner: TComponent);
var
i: integer;
begin begin
VarList.Clear; inherited;
Explanatory.Clear; if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
Instrumental.Clear;
DepVarEdit.Text := '';
ProxyRegShowChk.Checked := false;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.FormActivate(Sender: TObject);
var procedure TTwoSLSForm.AdjustConstraints;
w: Integer;
begin begin
if FAutoSized then inherited;
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]); ParamsPanel.Constraints.MinWidth := Max(
HelpBtn.Constraints.MinWidth := w; 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
ResetBtn.Constraints.MinWidth := w; OptionsGroup.Width);
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width; ParamsPanel.Constraints.MinHeight := InstOut.Top + InstOut.Height +
Constraints.MinHeight := Height; VarList.BorderSpacing.Bottom + OptionsGroup.Height + ButtonBevel.Height +
CloseBtn.BorderSpacing.Top + CloseBtn.Height;
FAutoSized := True;
end; end;
procedure TTwoSLSFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
end;
procedure TTwoSLSFrm.FormShow(Sender: TObject); procedure TTwoSLSForm.Compute;
begin
ResetBtnClick(self);
end;
procedure TTwoSLSFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TTwoSLSFrm.InstInClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while (i < VarList.Items.Count) do
begin
if VarList.Selected[i] and (Instrumental.Items.IndexOf(VarList.Items[i]) = -1) then
Instrumental.Items.Add(VarList.Items[i])
// DO NOT DELETE Items HERE.
else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TTwoSLSFrm.InstOutClick(Sender: TObject);
var
i: Integer;
begin
i := 0;
while (i < Instrumental.Items.Count) do
begin
if Instrumental.Selected[i] then
begin
if VarList.Items.IndexOf(Instrumental.Items[i]) = -1 then
VarList.Items.Add(Instrumental.Items[i]);
Instrumental.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TTwoSLSFrm.ComputeBtnClick(Sender: TObject);
var var
i, j, k, DepCol, NoInst, NoExp, NoProx, Noindep : integer; i, j, k, DepCol, NoInst, NoExp, NoProx, Noindep : integer;
IndepCols, ProxSrcCols, ExpCols, InstCols, ProxCols : IntDyneVec; IndepCols, ProxSrcCols, ExpCols, InstCols, ProxCols : IntDyneVec;
@@ -187,12 +120,12 @@ begin
MessageDlg('Dependent variable not selected.', mtError, [mbOK], 0); MessageDlg('Dependent variable not selected.', mtError, [mbOK], 0);
exit; exit;
end; end;
if Explanatory.Items.Count = 0 then if ExplanatoryList.Items.Count = 0 then
begin begin
MessageDlg('No explanatory variables selected.', mtError, [mbOK], 0); MessageDlg('No explanatory variables selected.', mtError, [mbOK], 0);
exit; exit;
end; end;
if Instrumental.Items.Count = 0 then if InstrumentalList.Items.Count = 0 then
begin begin
MessageDlg('No instrumental variables selected.', mtError, [mbOK], 0); MessageDlg('No instrumental variables selected.', mtError, [mbOK], 0);
exit; exit;
@@ -236,8 +169,8 @@ begin
// Get variables to analyze // Get variables to analyze
NCases := NoCases; NCases := NoCases;
NoInst := Instrumental.Items.Count; NoInst := InstrumentalList.Items.Count;
NoExp := Explanatory.Items.Count; NoExp := ExplanatoryList.Items.Count;
if (NoInst < NoExp) then if (NoInst < NoExp) then
begin begin
MessageDlg('The no. of Instrumental must equal or exceed the Explanatory', mtError, [mbOK], 0); MessageDlg('The no. of Instrumental must equal or exceed the Explanatory', mtError, [mbOK], 0);
@@ -254,22 +187,22 @@ begin
end; end;
for j := 0 to NoExp - 1 do for j := 0 to NoExp - 1 do
begin begin
if (OS3MainFrm.DataGrid.Cells[i+1,0] = Explanatory.Items.Strings[j]) then if (OS3MainFrm.DataGrid.Cells[i+1,0] = ExplanatoryList.Items.Strings[j]) then
begin begin
ExpCols[j] := i+1; ExpCols[j] := i+1;
// result := VarTypeChk(i+1,0); // result := VarTypeChk(i+1,0);
// if (result :=:= 1) goto cleanup; // if (result :=:= 1) goto cleanup;
ExpLabels[j] := Explanatory.Items.Strings[j]; ExpLabels[j] := ExplanatoryList.Items.Strings[j];
end; end;
end; // next j end; // next j
for j := 0 to NoInst - 1 do for j := 0 to NoInst - 1 do
begin begin
if (OS3MainFrm.DataGrid.Cells[i+1,0] = Instrumental.Items.Strings[j]) then if (OS3MainFrm.DataGrid.Cells[i+1,0] = InstrumentalList.Items.Strings[j]) then
begin begin
InstCols[j] := i+1; InstCols[j] := i+1;
// result := VarTypeChk(i+1,0); // result := VarTypeChk(i+1,0);
// if (result :=:= 1) goto cleanup; // if (result :=:= 1) goto cleanup;
InstLabels[j] := Instrumental.Items.Strings[j]; InstLabels[j] := InstrumentalList.Items.Strings[j];
end; end;
end; // next j end; // next j
end; // next i end; // next i
@@ -310,7 +243,7 @@ begin
lReport.Add(' ' + ProxLabels[i]); lReport.Add(' ' + ProxLabels[i]);
lReport.Add(''); lReport.Add('');
// Compute the prox regressions for the instrumental variables // Compute the prox regressions for the InstrumentalList variables
for i := 0 to NoProx - 1 do for i := 0 to NoProx - 1 do
begin begin
DictionaryFrm.DictGrid.ColCount := 8; DictionaryFrm.DictGrid.ColCount := 8;
@@ -382,7 +315,7 @@ begin
lReport.Add('=================================================================='); lReport.Add('==================================================================');
lReport.Add(''); lReport.Add('');
// Compute the OLS using the Prox values and explanatory // Compute the OLS using the Prox values and ExplanatoryList
Noindep := 0; Noindep := 0;
counter := 0; counter := 0;
for i := 0 to NoExp - 1 do for i := 0 to NoExp - 1 do
@@ -414,36 +347,18 @@ begin
BWeights, BetaWeights, BStdErrs, Bttests, tprobs, R2, stderrest, BWeights, BetaWeights, BStdErrs, Bttests, tprobs, R2, stderrest,
NCases, errorcode, PrintDesc, lReport); NCases, errorcode, PrintDesc, lReport);
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
if SaveItChk.Checked then if SaveItChk.Checked then
PredictIt(IndepCols, Noindep+1, Means, StdDevs, BetaWeights, stderrest, Noindep); PredictIt(IndepCols, Noindep+1, Means, StdDevs, BetaWeights, stderrest, Noindep);
finally finally
lReport.Free; lReport.Free;
// ProxVals := nil;
ProxSrcLabels := nil;
ProxSrcCols := nil;
RowLabels := nil;
IndepCols := nil;
ProxLabels := nil;
ProxCols := nil;
InstCols := nil;
InstLabels := nil;
ExpCols := nil;
ExpLabels := nil;
tprobs := nil;
Bttests := nil;
BStdErrs := nil;
BetaWeights := nil;
BWeights := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
end; end;
end; end;
procedure TTwoSLSFrm.DepInClick(Sender: TObject);
procedure TTwoSLSForm.DepInClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@@ -456,7 +371,8 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.DepOutClick(Sender: TObject);
procedure TTwoSLSForm.DepOutClick(Sender: TObject);
begin begin
if DepVarEdit.Text <> '' then if DepVarEdit.Text <> '' then
begin begin
@@ -466,38 +382,55 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.ExpInClick(Sender: TObject);
procedure TTwoSLSForm.ExpInClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
i := 0; i := 0;
while (i < VarList.Items.Count) do while (i < VarList.Items.Count) do
begin begin
if VarList.Selected[i] and (Explanatory.Items.IndexOf(VarList.Items[i]) = -1) then if VarList.Selected[i] and (ExplanatoryList.Items.IndexOf(VarList.Items[i]) = -1) then
Explanatory.Items.Add(VarList.Items[i]); ExplanatoryList.Items.Add(VarList.Items[i]);
// DO NOT DELETE Items HERE. // DO NOT DELETE Items HERE.
i := i + 1; i := i + 1;
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.ExplanatorySelectionChange(Sender: TObject; User: boolean);
procedure TTwoSLSForm.ExplanatoryListDblClick(Sender: TObject);
var
index: Integer;
begin
index := ExplanatoryList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(ExplanatoryList.Items[index]);
ExplanatoryList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TTwoSLSForm.ExplanatoryListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.ExpOutClick(Sender: TObject);
procedure TTwoSLSForm.ExpOutClick(Sender: TObject);
var var
i: Integer; i: Integer;
begin begin
i := 0; i := 0;
while (i < Explanatory.Items.Count) do while (i < ExplanatoryList.Items.Count) do
begin begin
if Explanatory.Selected[i] then if ExplanatoryList.Selected[i] then
begin begin
if (VarList.Items.IndexOf(Explanatory.Items[i]) = -1) then if (VarList.Items.IndexOf(ExplanatoryList.Items[i]) = -1) then
VarList.Items.Add(Explanatory.Items[i]); VarList.Items.Add(ExplanatoryList.Items[i]);
Explanatory.Items.Delete(i); ExplanatoryList.Items.Delete(i);
i := 0; i := 0;
end else end else
i := i + 1; i := i + 1;
@@ -505,7 +438,59 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TTwoSLSFrm.PredictIt(const ColNoSelected: IntDyneVec; NoVars: integer;
procedure TTwoSLSForm.InstInClick(Sender: TObject);
var
i: integer;
begin
i := 0;
while (i < VarList.Items.Count) do
begin
if VarList.Selected[i] and (InstrumentalList.Items.IndexOf(VarList.Items[i]) = -1) then
InstrumentalList.Items.Add(VarList.Items[i])
// DO NOT DELETE Items HERE.
else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TTwoSLSForm.InstOutClick(Sender: TObject);
var
i: Integer;
begin
i := 0;
while (i < InstrumentalList.Items.Count) do
begin
if InstrumentalList.Selected[i] then
begin
if VarList.Items.IndexOf(InstrumentalList.Items[i]) = -1 then
VarList.Items.Add(InstrumentalList.Items[i]);
InstrumentalList.Items.Delete(i);
i := 0;
end else
i := i + 1;
end;
UpdateBtnStates;
end;
procedure TTwoSLSForm.InstrumentalListDblClick(Sender: TObject);
var
index: Integer;
begin
index := InstrumentalList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(InstrumentalList.Items[index]);
InstrumentalList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TTwoSLSForm.PredictIt(const ColNoSelected: IntDyneVec; NoVars: integer;
Means, StdDevs, BetaWeights: DblDyneVec; Means, StdDevs, BetaWeights: DblDyneVec;
StdErrEst: double; NoIndepVars: integer); StdErrEst: double; NoIndepVars: integer);
var var
@@ -596,22 +581,57 @@ begin
end; end;
end; end;
procedure TTwoSLSFrm.UpdateBtnStates;
procedure TTwoSLSForm.Reset;
var
i: integer;
begin
inherited;
DepVarEdit.Clear;
InstrumentalList.Clear;
ExplanatoryList.Clear;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
ProxyRegShowChk.Checked := false;
UpdateBtnStates;
end;
procedure TTwoSLSForm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
begin begin
inherited;
lSelected := AnySelected(VarList); lSelected := AnySelected(VarList);
DepIn.Enabled := lSelected and (DepVarEdit.Text = ''); DepIn.Enabled := lSelected and (DepVarEdit.Text = '');
ExpIn.Enabled := lSelected; ExpIn.Enabled := lSelected;
InstIn.Enabled := lSelected; InstIn.Enabled := lSelected;
DepOut.Enabled := (DepVarEdit.Text <> ''); DepOut.Enabled := (DepVarEdit.Text <> '');
ExpOut.Enabled := AnySelected(Explanatory); ExpOut.Enabled := AnySelected(ExplanatoryList);
InstOut.Enabled := AnySelected(Instrumental); InstOut.Enabled := AnySelected(InstrumentalList);
end;
procedure TTwoSLSForm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if DepVarEdit.Text = '' then
DepVarEdit.Text := VarList.Items[index]
else
ExplanatoryList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end; end;
initialization
{$I twoslsunit.lrs}
end. end.

View File

@@ -2,12 +2,12 @@ inherited WLSForm: TWLSForm
Left = 288 Left = 288
Height = 469 Height = 469
Top = 171 Top = 171
Width = 1024 Width = 861
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/WeightedLeast-SquaresRegression.htm' HelpKeyword = 'html/WeightedLeast-SquaresRegression.htm'
Caption = 'Weighted Least Squares Regression' Caption = 'Weighted Least Squares Regression'
ClientHeight = 469 ClientHeight = 469
ClientWidth = 1024 ClientWidth = 861
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Height = 453 Height = 453
Width = 280 Width = 280
@@ -345,7 +345,7 @@ inherited WLSForm: TWLSForm
Left = 301 Left = 301
Height = 453 Height = 453
Top = 8 Top = 8
Width = 715 Width = 552
ActivePage = ResidualsRegPage ActivePage = ResidualsRegPage
Align = alClient Align = alClient
BorderSpacing.Left = 4 BorderSpacing.Left = 4
@@ -360,12 +360,12 @@ inherited WLSForm: TWLSForm
object ResidualsRegPage: TTabSheet object ResidualsRegPage: TTabSheet
Caption = 'Squared Residuals Regression' Caption = 'Squared Residuals Regression'
ClientHeight = 425 ClientHeight = 425
ClientWidth = 707 ClientWidth = 544
object ResRegPageControl: TPageControl object ResRegPageControl: TPageControl
Left = 8 Left = 8
Height = 409 Height = 409
Top = 8 Top = 8
Width = 691 Width = 528
ActivePage = ResRegReportPage ActivePage = ResRegReportPage
Align = alClient Align = alClient
BorderSpacing.Around = 8 BorderSpacing.Around = 8

View File

@@ -2044,32 +2044,33 @@ end;
// Menu "Analysis" > "Multiple Regression" > "Best Combination" // Menu "Analysis" > "Multiple Regression" > "Best Combination"
procedure TOS3MainFrm.mnuAnalysisMultReg_BestCombClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_BestCombClick(Sender: TObject);
begin begin
if BestRegFrm = nil then if BestRegForm = nil then
Application.CreateForm(TBestRegFrm, BestRegFrm); Application.CreateForm(TBestRegForm, BestRegForm);
BestRegFrm.ShowModal; BestRegForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Binary Logistic" // Menu "Analysis" > "Multiple Regression" > "Binary Logistic"
procedure TOS3MainFrm.mnuAnalysisMultReg_BinLogisticClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_BinLogisticClick(Sender: TObject);
begin begin
if LogRegFrm = nil then if LogRegForm = nil then
Application.CreateForm(TLogRegFrm, LogRegFrm); Application.CreateForm(TLogRegForm, LogRegForm);
LogRegFrm.ShowModal; LogRegForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Block Entry"
procedure TOS3MainFrm.mnuAnalysisMultReg_BlockEntryClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_BlockEntryClick(Sender: TObject);
begin begin
if BlkMregFrm = nil then if BlkMregForm = nil then
Application.CreateForm(TBlkMregFrm, BlkMregFrm); Application.CreateForm(TBlkMregForm, BlkMregForm);
BlkMregFrm.ShowModal; BlkMregForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Cox Proportional Hazzards Survival Regression" // Menu "Analysis" > "Multiple Regression" > "Cox Proportional Hazzards Survival Regression"
procedure TOS3MainFrm.mnuAnalysisMultReg_CoxSurvivalClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_CoxSurvivalClick(Sender: TObject);
begin begin
if CoxRegFrm = nil then if CoxRegForm = nil then
Application.CreateForm(TCoxRegFrm, CoxRegFrm); Application.CreateForm(TCoxRegForm, CoxRegForm);
CoxRegFrm.ShowModal; CoxRegForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Forward Stepwise" // Menu "Analysis" > "Multiple Regression" > "Forward Stepwise"
@@ -2083,9 +2084,9 @@ end;
// Menu "Analysis" > "Multiple Regression" > "Linear Programming" // Menu "Analysis" > "Multiple Regression" > "Linear Programming"
procedure TOS3MainFrm.mnuAnalysisMultReg_LinProgClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_LinProgClick(Sender: TObject);
begin begin
if LinProFrm = nil then if LinProForm = nil then
Application.CreateForm(TLinProFrm, LinProFrm); Application.CreateForm(TLinProForm, LinProForm);
LinProFrm.ShowModal; LinProForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Least Squares Multiple Regression" // Menu "Analysis" > "Multiple Regression" > "Least Squares Multiple Regression"
@@ -2099,17 +2100,17 @@ end;
// Menu "Analysis" > "Multiple Regression" > "Simultaneous" // Menu "Analysis" > "Multiple Regression" > "Simultaneous"
procedure TOS3MainFrm.mnuAnalysisMultReg_SimultClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_SimultClick(Sender: TObject);
begin begin
if SimultFrm = nil then if SimultForm = nil then
Application.CreateForm(TSimultFrm, SimultFrm); Application.CreateForm(TSimultForm, SimultForm);
SimultFrm.ShowModal; SimultForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Two Stage Least Squares Regression" // Menu "Analysis" > "Multiple Regression" > "Two Stage Least Squares Regression"
procedure TOS3MainFrm.mnuAnalysisMultReg_TwoStageClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisMultReg_TwoStageClick(Sender: TObject);
begin begin
if TwoSLSFrm = nil then if TwoSLSForm = nil then
Application.CreateForm(TTwoSLSFrm, TwoSLSFrm); Application.CreateForm(TTwoSLSForm, TwoSLSForm);
TwoSLSFrm.ShowModal; TwoSLSForm.Show;
end; end;
// Menu "Analysis" > "Multiple Regression" > "Weighted Least Squares Regression" // Menu "Analysis" > "Multiple Regression" > "Weighted Least Squares Regression"

View File

@@ -64,13 +64,12 @@ object ReportFrame: TReportFrame
TabOrder = 1 TabOrder = 1
object ReportMemo: TMemo object ReportMemo: TMemo
Left = 4 Left = 4
Height = 194 Height = 198
Top = 4 Top = 4
Width = 294 Width = 294
Align = alClient Align = alClient
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
BorderStyle = bsNone BorderStyle = bsNone
Color = clWhite Color = clWhite
Font.Height = -11 Font.Height = -11