LazStats: Inherit form in StepFwdMRUnit from TBasicStatsReportForm.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7790 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-20 22:20:15 +00:00
parent 4666d9f58a
commit 5d5f326ad6
3 changed files with 526 additions and 557 deletions

View File

@ -1,444 +1,400 @@
object StepFwdForm: TStepFwdForm inherited StepFwdForm: TStepFwdForm
Left = 989 Left = 564
Height = 470 Height = 487
Top = 243 Top = 333
Width = 476 Width = 786
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/ForwardStepwise.htm' HelpKeyword = 'html/ForwardStepwise.htm'
AutoSize = True
Caption = 'Forward Stepwise Multiple Regression' Caption = 'Forward Stepwise Multiple Regression'
ClientHeight = 470 ClientHeight = 487
ClientWidth = 476 ClientWidth = 786
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 471
OnShow = FormShow Width = 448
Position = poMainFormCenter ClientHeight = 471
LCLVersion = '2.1.0.0' ClientWidth = 448
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 393
AnchorSideTop.Control = Owner Top = 446
Left = 8 TabOrder = 13
Height = 15 end
Top = 8 inherited ComputeBtn: TButton
Width = 97 Left = 309
BorderSpacing.Left = 8 Top = 446
BorderSpacing.Top = 8 TabOrder = 12
Caption = 'Available Variables' end
ParentColor = False inherited ResetBtn: TButton
end Left = 247
object Label2: TLabel Top = 446
AnchorSideLeft.Control = SelList TabOrder = 11
AnchorSideTop.Control = InBtn end
Left = 269 inherited HelpBtn: TButton
Height = 15 Left = 188
Top = 108 Top = 446
Width = 127 TabOrder = 10
Caption = 'Variables to be Analyzed' end
ParentColor = False inherited ButtonBevel: TBevel
end Top = 430
object Label3: TLabel Width = 448
AnchorSideLeft.Control = DepVar end
AnchorSideBottom.Control = DepVar object Label1: TLabel[5]
Left = 269 AnchorSideLeft.Control = ParamsPanel
Height = 15 AnchorSideTop.Control = ParamsPanel
Top = 32 Left = 0
Width = 102 Height = 15
Anchors = [akLeft, akBottom] Top = 0
BorderSpacing.Bottom = 2 Width = 97
Caption = 'Dependent Variable' Caption = 'Available Variables'
ParentColor = False ParentColor = False
end end
object VarList: TListBox object Label2: TLabel[6]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = SelList
AnchorSideTop.Control = Label1 AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom Left = 248
AnchorSideRight.Control = AllBtn Height = 15
AnchorSideBottom.Control = GroupBox2 Top = 104
Left = 8 Width = 127
Height = 188 Caption = 'Variables to be Analyzed'
Top = 25 ParentColor = False
Width = 199 end
Anchors = [akTop, akLeft, akRight, akBottom] object Label3: TLabel[7]
BorderSpacing.Left = 8 AnchorSideLeft.Control = DepVarEdit
BorderSpacing.Top = 2 AnchorSideBottom.Control = DepVarEdit
BorderSpacing.Right = 8 Left = 252
BorderSpacing.Bottom = 8 Height = 15
ItemHeight = 0 Top = 28
MultiSelect = True Width = 102
OnSelectionChange = SelListSelectionChange Anchors = [akLeft, akBottom]
TabOrder = 0 BorderSpacing.Bottom = 2
end Caption = 'Dependent Variable'
object InBtn: TBitBtn ParentColor = False
AnchorSideLeft.Control = Owner end
AnchorSideLeft.Side = asrCenter object VarList: TListBox[8]
AnchorSideTop.Control = DepOutBtn AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom AnchorSideTop.Control = Label1
Left = 224 AnchorSideTop.Side = asrBottom
Height = 28 AnchorSideRight.Control = AllBtn
Top = 108 AnchorSideBottom.Control = CriteriaGroup
Width = 28 Left = 0
BorderSpacing.Top = 24 Height = 205
Images = MainDataModule.ImageList Top = 17
ImageIndex = 1 Width = 200
OnClick = InBtnClick Anchors = [akTop, akLeft, akRight, akBottom]
Spacing = 0 BorderSpacing.Top = 2
TabOrder = 4 BorderSpacing.Right = 4
end BorderSpacing.Bottom = 8
object OutBtn: TBitBtn ItemHeight = 0
AnchorSideLeft.Control = Owner MultiSelect = True
AnchorSideLeft.Side = asrCenter OnDblClick = VarListDblClick
AnchorSideTop.Control = InBtn OnSelectionChange = SelListSelectionChange
AnchorSideTop.Side = asrBottom
Left = 224
Height = 28
Top = 140
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 215
Height = 25
Top = 192
Width = 46
AutoSize = True
BorderSpacing.Top = 24
Caption = 'ALL'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 6
end
object SelList: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox2
Left = 269
Height = 88
Top = 125
Width = 199
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = SelListSelectionChange
TabOrder = 7
end
object DepInBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 224
Height = 28
Top = 24
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 1
end
object DepOutBtn: TBitBtn
AnchorSideLeft.Control = DepInBtn
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 224
Height = 28
Top = 56
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2
end
object DepVar: TEdit
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 269
Height = 23
Top = 49
Width = 199
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVar'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 135
Top = 286
Width = 457
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 453
TabOrder = 9
object CPChkBox: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 196
Caption = 'Show Cross-Products Matrix'
TabOrder = 0 TabOrder = 0
end end
object CovChkBox: TCheckBox object InBtn: TBitBtn[9]
Left = 16 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = DepOutBtn
Width = 196 AnchorSideTop.Side = asrBottom
Caption = 'Show Variance-covariance Matrix' Left = 211
TabOrder = 1 Height = 26
end Top = 104
object CorrsChkBox: TCheckBox Width = 26
Left = 16 BorderSpacing.Top = 24
Height = 19 Images = MainDataModule.ImageList
Top = 48 ImageIndex = 1
Width = 196 OnClick = InBtnClick
Caption = 'Show Intercorrelations Matrix' Spacing = 0
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 16
Height = 19
Top = 69
Width = 196
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 16
Height = 19
Top = 90
Width = 196
Caption = 'Show Variances'
TabOrder = 4 TabOrder = 4
end end
object SDChkBox: TCheckBox object OutBtn: TBitBtn[10]
Left = 236 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 6 AnchorSideTop.Control = InBtn
Width = 201 AnchorSideTop.Side = asrBottom
Caption = 'Show Standard Deviations' Left = 211
Height = 26
Top = 134
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object MatInChkBox: TCheckBox object AllBtn: TBitBtn[11]
Left = 236 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = OutBtn
Width = 201 AnchorSideTop.Side = asrBottom
Caption = 'Get Data from a Matrix File' Left = 204
Height = 25
Top = 184
Width = 40
AutoSize = True
BorderSpacing.Top = 24
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 6 TabOrder = 6
end end
object MatSaveChkBox: TCheckBox object SelList: TListBox[12]
Left = 236 AnchorSideLeft.Control = AllBtn
Height = 19 AnchorSideLeft.Side = asrBottom
Top = 48 AnchorSideTop.Control = Label2
Width = 201 AnchorSideTop.Side = asrBottom
Caption = 'Save the Correlation Matrix' AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CriteriaGroup
Left = 248
Height = 101
Top = 121
Width = 200
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
ItemHeight = 0
MultiSelect = True
OnDblClick = SelListDblClick
OnSelectionChange = SelListSelectionChange
TabOrder = 7 TabOrder = 7
end end
object PredictChkBox: TCheckBox object DepInBtn: TBitBtn[13]
Left = 236 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 69 Left = 211
Width = 201 Height = 26
Caption = 'Predictions, residuals, C.I.''s to Grid' Top = 24
TabOrder = 8 Width = 26
end Images = MainDataModule.ImageList
end ImageIndex = 1
object ResetBtn: TButton OnClick = DepInBtnClick
AnchorSideRight.Control = ComputeBtn Spacing = 0
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 267
Height = 25
Top = 437
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 = 329
Height = 25
Top = 437
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 = 413
Height = 25
Top = 437
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 = 421
Width = 476
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object GroupBox2: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 8
Height = 53
Top = 225
Width = 268
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Minimum Probability'
ClientHeight = 33
ClientWidth = 264
TabOrder = 8
object Label4: TLabel
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = InProb
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = InProb
Left = 18
Height = 15
Top = 6
Width = 44
BorderSpacing.Left = 18
BorderSpacing.Right = 8
Caption = 'to Enter:'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = InProb
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = OutProb
Left = 144
Height = 15
Top = 6
Width = 50
BorderSpacing.Left = 24
BorderSpacing.Right = 8
Caption = 'to Retain:'
ParentColor = False
end
object InProb: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBox2
AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom
Left = 70
Height = 23
Top = 2
Width = 50
BorderSpacing.Top = 2
BorderSpacing.Right = 12
TabOrder = 0
Text = 'InProb'
end
object OutProb: TEdit
AnchorSideLeft.Control = Label5
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb
AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom
Left = 202
Height = 23
Top = 2
Width = 50
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
TabOrder = 1 TabOrder = 1
Text = 'OutProb' end
object DepOutBtn: TBitBtn[14]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 211
Height = 26
Top = 54
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2
end
object DepVarEdit: TEdit[15]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 252
Height = 23
Top = 45
Width = 196
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVarEdit'
end
object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 135
Top = 295
Width = 441
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 437
TabOrder = 9
object CPChkBox: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 196
Caption = 'Show Cross-Products Matrix'
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 196
Caption = 'Show Variance-covariance Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 12
Height = 19
Top = 48
Width = 196
Caption = 'Show Intercorrelations Matrix'
TabOrder = 2
end
object MeansChkBox: TCheckBox
Left = 12
Height = 19
Top = 69
Width = 196
Caption = 'Show Means'
TabOrder = 3
end
object VarChkBox: TCheckBox
Left = 12
Height = 19
Top = 90
Width = 196
Caption = 'Show Variances'
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 224
Height = 19
Top = 6
Width = 201
Caption = 'Show Standard Deviations'
TabOrder = 5
end
object MatInChkBox: TCheckBox
Left = 224
Height = 19
Top = 27
Width = 201
Caption = 'Get Data from a Matrix File'
TabOrder = 6
end
object MatSaveChkBox: TCheckBox
Left = 224
Height = 19
Top = 48
Width = 201
Caption = 'Save the Correlation Matrix'
TabOrder = 7
end
object PredictChkBox: TCheckBox
Left = 224
Height = 19
Top = 69
Width = 201
Caption = 'Predictions, residuals, C.I.''s to Grid'
TabOrder = 8
end
end
object CriteriaGroup: TGroupBox[17]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = OptionsGroup
Left = 0
Height = 53
Top = 234
Width = 268
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Minimum Probability'
ClientHeight = 33
ClientWidth = 264
TabOrder = 8
object Label4: TLabel
AnchorSideLeft.Control = CriteriaGroup
AnchorSideTop.Control = InProbEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = InProbEdit
Left = 18
Height = 15
Top = 6
Width = 44
BorderSpacing.Left = 18
BorderSpacing.Right = 8
Caption = 'to Enter:'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = InProbEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProbEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = OutProbEdit
Left = 144
Height = 15
Top = 6
Width = 50
BorderSpacing.Left = 24
BorderSpacing.Right = 8
Caption = 'to Retain:'
ParentColor = False
end
object InProbEdit: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CriteriaGroup
AnchorSideRight.Control = CriteriaGroup
AnchorSideRight.Side = asrBottom
Left = 70
Height = 23
Top = 2
Width = 50
BorderSpacing.Top = 2
BorderSpacing.Right = 12
TabOrder = 0
Text = 'InProbEdit'
end
object OutProbEdit: TEdit
AnchorSideLeft.Control = Label5
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProbEdit
AnchorSideRight.Control = CriteriaGroup
AnchorSideRight.Side = asrBottom
Left = 202
Height = 23
Top = 2
Width = 50
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
TabOrder = 1
Text = 'OutProbEdit'
end
end end
end end
object Bevel2: TBevel inherited ParamsSplitter: TSplitter
Left = 460
Height = 487
end
object Bevel2: TBevel[2]
Left = 5 Left = 5
Height = 15 Height = 15
Top = 352 Top = 352
Width = 13 Width = 13
Shape = bsSpacer Shape = bsSpacer
end end
object OpenDialog1: TOpenDialog object OpenDialog1: TOpenDialog[3]
Left = 49 Left = 49
Top = 48 Top = 48
end end
object SaveDialog1: TSaveDialog object SaveDialog1: TSaveDialog[4]
Left = 48 Left = 48
Top = 112 Top = 112
end end

View File

@ -5,22 +5,18 @@ unit StepFwdMRUnit;
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
{ TStepFwdForm } { TStepFwdForm }
TStepFwdForm = class(TForm) TStepFwdForm = class(TBasicStatsReportForm)
Bevel1: TBevel;
Bevel2: TBevel; Bevel2: TBevel;
GroupBox2: TGroupBox; CriteriaGroup: TGroupBox;
OpenDialog1: TOpenDialog; OpenDialog1: TOpenDialog;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
PredictChkBox: TCheckBox; PredictChkBox: TCheckBox;
MatSaveChkBox: TCheckBox; MatSaveChkBox: TCheckBox;
MatInChkBox: TCheckBox; MatInChkBox: TCheckBox;
@ -31,9 +27,9 @@ type
CorrsChkBox: TCheckBox; CorrsChkBox: TCheckBox;
CovChkBox: TCheckBox; CovChkBox: TCheckBox;
CPChkBox: TCheckBox; CPChkBox: TCheckBox;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
InProb: TEdit; InProbEdit: TEdit;
OutProb: TEdit; OutProbEdit: TEdit;
InBtn: TBitBtn; InBtn: TBitBtn;
Label4: TLabel; Label4: TLabel;
Label5: TLabel; Label5: TLabel;
@ -41,95 +37,62 @@ type
AllBtn: TBitBtn; AllBtn: TBitBtn;
DepInBtn: TBitBtn; DepInBtn: TBitBtn;
DepOutBtn: TBitBtn; DepOutBtn: TBitBtn;
DepVar: TEdit; DepVarEdit: TEdit;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
SelList: TListBox; SelList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure ComputeBtnClick(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 SelListDblClick(Sender: TObject);
procedure SelListSelectionChange(Sender: TObject; User: boolean); procedure SelListSelectionChange(Sender: TObject; User: boolean);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); 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 } procedure Reset; override;
end; end;
var var
StepFwdForm: TStepFwdForm; StepFwdForm: TStepFwdForm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils, MathUnit; Utils, MathUnit;
{ TStepFwdForm } { TStepFwdForm }
procedure TStepFwdForm.ResetBtnClick(Sender: TObject); procedure TStepFwdForm.AdjustConstraints;
var
i: integer;
begin begin
VarList.Clear; inherited;
SelList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
DepVar.Text := ''; ParamsPanel.Constraints.MinWidth := Max(
InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
OutProb.Text := FormatFloat('0.00', 0.10); OptionsGroup.Width
);
CPChkBox.Checked := false; ParamsPanel.Constraints.MinHeight :=
CovChkBox.Checked := false; AllBtn.Top + AllBtn.Height + VarList.BorderSpacing.Bottom +
CorrsChkBox.Checked := true; CriteriaGroup.Height + CriteriaGroup.BorderSpacing.Bottom +
MeansChkBox.Checked := true; OptionsGroup.Height + ButtonBevel.Height +
VarChkBox.Checked := false; CloseBtn.BorderSpacing.Top + CloseBtn.Height;
SDChkBox.Checked := true;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
end; end;
procedure TStepFwdForm.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 := Max(200, AllBtn.Top + AllBtn.Height - VarList.Top); //GroupBox2.Top + Groupbox2.Height - VarList.Top);
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TStepFwdForm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TStepFwdForm.FormShow(Sender: TObject);
begin
ResetBtnClick(Self);
end;
procedure TStepFwdForm.AllBtnClick(Sender: TObject); procedure TStepFwdForm.AllBtnClick(Sender: TObject);
var var
@ -141,7 +104,8 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TStepFwdForm.ComputeBtnClick(Sender: TObject);
procedure TStepFwdForm.Compute;
Label Label
lastone; lastone;
var var
@ -151,25 +115,25 @@ var
StdErrEst, NewR2, LargestPartial : double; StdErrEst, NewR2, LargestPartial : double;
pdf1, pdf2, PartF, PartProb, LargestProb, POut : double; pdf1, pdf2, PartF, PartProb, LargestProb, POut : double;
SmallestProb : double; SmallestProb : double;
BetaWeights : DblDyneVec; BetaWeights : DblDyneVec = nil;
cellstring: string; cellstring: 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;
// IndRowLabels : StrDyneVec; // IndRowLabels : StrDyneVec;
// IndColLabels : StrDyneVec; // IndColLabels : StrDyneVec;
// IndepCorrs : DblDyneMat; // IndepCorrs : DblDyneMat;
IndepInverse : DblDyneMat; IndepInverse : DblDyneMat = nil;
IndepIndex : IntDyneVec; IndepIndex : IntDyneVec = nil;
// XYCorrs : DblDyneVec; // XYCorrs : DblDyneVec;
matched : boolean; matched : boolean;
Partial : DblDyneVec; Partial : DblDyneVec = nil;
Candidate : IntDyneVec; Candidate : IntDyneVec = nil;
TempNoVars : Integer; TempNoVars : Integer;
StepNo : integer; StepNo : integer;
filename : string; filename : string;
@ -177,27 +141,27 @@ var
lReport: TStrings; lReport: TStrings;
tmp: Double; tmp: Double;
begin begin
if InProb.Text = '' then if InProbEdit.Text = '' then
begin begin
InProb.SetFocus; InProbEdit.SetFocus;
MessageDlg('Probability to enter not specified.', mtError, [mbOK], 0); MessageDlg('Probability to enter not specified.', mtError, [mbOK], 0);
exit; exit;
end; end;
if OutProb.Text = '' then if OutProbEdit.Text = '' then
begin begin
OutProb.SetFocus; OutProbEdit.SetFocus;
MessageDlg('Probability to retain not specified.', mtError, [mbOK], 0); MessageDlg('Probability to retain not specified.', mtError, [mbOK], 0);
exit; exit;
end; end;
if not TryStrToFloat(InProb.Text, tmp) then if not TryStrToFloat(InProbEdit.Text, tmp) then
begin begin
InProb.SetFocus; InProbEdit.SetFocus;
MessageDlg('No valid number.', mtError, [mbOK], 0); MessageDlg('No valid number.', mtError, [mbOK], 0);
exit; exit;
end; end;
if not TryStrToFloat(OutProb.Text, tmp) then if not TryStrToFloat(OutProbEdit.Text, tmp) then
begin begin
OutProb.SetFocus; OutProbEdit.SetFocus;
MessageDlg('No valid number.', mtError, [mbOK], 0); MessageDlg('No valid number.', mtError, [mbOK], 0);
exit; exit;
end; end;
@ -240,7 +204,7 @@ begin
Variances[i] := sqr(StdDevs[i]); Variances[i] := sqr(StdDevs[i]);
ColNoSelected[i] := i+1; ColNoSelected[i] := i+1;
end; end;
DepVar.Text := RowLabels[NoVars-1]; DepVarEdit.Text := RowLabels[NoVars-1];
for i := 0 to NoVars-2 do SelList.Items.Add(RowLabels[i]); for i := 0 to NoVars-2 do SelList.Items.Add(RowLabels[i]);
Messagedlg('Last variable in matrix is the dependent variable.', mtInformation, [mbOK], 0); Messagedlg('Last variable in matrix is the dependent variable.', mtInformation, [mbOK], 0);
end; end;
@ -271,7 +235,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;
@ -280,11 +244,11 @@ begin
NoVars := NoVars + 1; NoVars := NoVars + 1;
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
ColNoSelected[NoVars-1] := j; ColNoSelected[NoVars-1] := j;
RowLabels[NoVars-1] := DepVar.Text; RowLabels[NoVars-1] := DepVarEdit.Text;
ColLabels[NoVars-1] := DepVar.Text; ColLabels[NoVars-1] := DepVarEdit.Text;
end; end;
end; end;
@ -349,7 +313,7 @@ begin
if errorcode then if errorcode then
begin begin
lReport.Add('One or more correlations could not be computed due to zero variance of a variable.'); lReport.Add('One or more correlations could not be computed due to zero variance of a variable.');
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;
@ -373,7 +337,7 @@ begin
end; end;
NoIndepVars := 1; NoIndepVars := 1;
IndepIndex[NoIndepVars-1] := Index; IndepIndex[NoIndepVars-1] := Index;
POut := StrToFloat(OutProb.Text); POut := StrToFloat(OutProbEdit.Text);
lReport.Add(''); lReport.Add('');
lReport.Add('----------------- STEP %d ------------------', [StepNo]); lReport.Add('----------------- STEP %d ------------------', [StepNo]);
MReg2(NCases, NoVars, NoIndepVars, IndepIndex, corrs, IndepInverse, MReg2(NCases, NoVars, NoIndepVars, IndepIndex, corrs, IndepInverse,
@ -439,7 +403,7 @@ begin
]); ]);
end; end;
if (SmallestProb > StrToFloat(InProb.Text)) then if (SmallestProb > StrToFloat(InProbEdit.Text)) then
begin begin
lReport.Add('No further steps meet criterion for entry.'); lReport.Add('No further steps meet criterion for entry.');
goto lastone; goto lastone;
@ -489,52 +453,39 @@ lastone:
if PredictChkBox.Checked then if PredictChkBox.Checked then
Predict(ColNoSelected, NoVars, IndepInverse, Means, StdDevs, BetaWeights, StdErrEst, IndepIndex, NoIndepVars); Predict(ColNoSelected, NoVars, IndepInverse, Means, StdDevs, BetaWeights, StdErrEst, IndepIndex, NoIndepVars);
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
ColNoSelected := nil;
Candidate := nil;
Partial := nil;
BetaWeights := nil;
// IndColLabels := nil;
// IndRowLabels := nil;
IndepIndex := nil;
// XYCorrs := nil;
ColLabels := nil;
RowLabels := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
IndepInverse := nil;
// IndepCorrs := nil;
corrs := nil;
end; end;
end; end;
procedure TStepFwdForm.DepInBtnClick(Sender: TObject); procedure TStepFwdForm.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 TStepFwdForm.DepOutBtnClick(Sender: TObject); procedure TStepFwdForm.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 TStepFwdForm.InBtnClick(Sender: TObject); procedure TStepFwdForm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@ -554,10 +505,6 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TStepFwdForm.SelListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TStepFwdForm.OutBtnClick(Sender: TObject); procedure TStepFwdForm.OutBtnClick(Sender: TObject);
var var
@ -578,18 +525,83 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TStepFwdForm.Reset;
var
i: integer;
begin
inherited;
VarList.Clear;
SelList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
DepVarEdit.Text := '';
InProbEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
OutProbEdit.Text := FormatFloat('0.00', 0.10);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := false;
MeansChkBox.Checked := false;
VarChkBox.Checked := false;
SDChkBox.Checked := false;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PredictChkBox.Checked := false;
UpdateBtnStates;
end;
procedure TStepFwdForm.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 TStepFwdForm.SelListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TStepFwdForm.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
SelList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TStepFwdForm.UpdateBtnStates; procedure TStepFwdForm.UpdateBtnStates;
begin begin
DepInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVar.Text = ''); inherited;
DepOutBtn.Enabled := (DepVar.Text <> '');
DepInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVarEdit.Text = '');
DepOutBtn.Enabled := (DepVarEdit.Text <> '');
InBtn.Enabled := AnySelected(VarList); InBtn.Enabled := AnySelected(VarList);
OutBtn.Enabled := AnySelected(SelList); OutBtn.Enabled := AnySelected(SelList);
end; end;
initialization
{$I stepfwdmrunit.lrs}
end. end.

View File

@ -1228,6 +1228,13 @@ begin
end; end;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ The following routine obtains multiple regression results for a
correlation matrix consisting of 1 to NoVars. The last variable
represents the dependent variable. The number of independent
variables is passed as NoIndepVars. The inverse matrix of independent
variables may be obtained by the calling program using the variable
IndepCorrs. The user may request printing of the inverse using the
boolean variable PrintIt. }
procedure MReg2(NCases : integer; procedure MReg2(NCases : integer;
NoVars : integer; NoVars : integer;
VAR NoIndepVars : integer; VAR NoIndepVars : integer;
@ -1247,15 +1254,6 @@ procedure MReg2(NCases : integer;
TestOut : boolean; TestOut : boolean;
PrintInv : boolean; PrintInv : boolean;
AReport: TStrings); AReport: TStrings);
{
The following routine obtains multiple regression results for a
correlation matrix consisting of 1 to NoVars. The last variable
represents the dependent variable. The number of independent
variables is passed as NoIndepVars. The inverse matrix of independent
variables may be obtained by the calling program using the variable
IndepCorrs. The user may request printing of the inverse using the
boolean variable Printit.
}
var var
i, j, k, l : integer; i, j, k, l : integer;
IndexX, IndexY : integer; IndexX, IndexY : integer;
@ -1345,7 +1343,10 @@ begin
AReport.Add('SOURCE DF SS MS F Prob. > F'); AReport.Add('SOURCE DF SS MS F Prob. > F');
AReport.Add('---------- ---- -------------- -------------- -------------- ---------'); AReport.Add('---------- ---- -------------- -------------- -------------- ---------');
AReport.Add('Regression %4.0f %14.3f %14.3f %14.3f %9.3f', [df1, SSreg, SSreg/df1, F, FprobF]); if df1 = 0 then
AReport.Add('Regression %4.0f %14.3f %14.3f %14.3f %9.3f', [df1, SSreg, NaN, F, FprobF])
else
AReport.Add('Regression %4.0f %14.3f %14.3f %14.3f %9.3f', [df1, SSreg, SSreg/df1, F, FprobF]);
AReport.Add('Residual %4.0f %14.3f %14.3f', [df2, SSres, SSres/df2]); AReport.Add('Residual %4.0f %14.3f %14.3f', [df2, SSres, SSres/df2]);
AReport.Add('Total %4.0f %14.3f', [df3, SSt]); AReport.Add('Total %4.0f %14.3f', [df3, SSt]);
AReport.Add(''); AReport.Add('');