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
Left = 989
Height = 470
Top = 243
Width = 476
inherited StepFwdForm: TStepFwdForm
Left = 564
Height = 487
Top = 333
Width = 786
HelpType = htKeyword
HelpKeyword = 'html/ForwardStepwise.htm'
AutoSize = True
Caption = 'Forward Stepwise Multiple Regression'
ClientHeight = 470
ClientWidth = 476
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
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 = SelList
AnchorSideTop.Control = InBtn
Left = 269
Height = 15
Top = 108
Width = 127
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = DepVar
AnchorSideBottom.Control = DepVar
Left = 269
Height = 15
Top = 32
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = GroupBox2
Left = 8
Height = 188
Top = 25
Width = 199
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = SelListSelectionChange
TabOrder = 0
end
object InBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom
Left = 224
Height = 28
Top = 108
Width = 28
BorderSpacing.Top = 24
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 4
end
object OutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
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'
ClientHeight = 487
ClientWidth = 786
inherited ParamsPanel: TPanel
Height = 471
Width = 448
ClientHeight = 471
ClientWidth = 448
inherited CloseBtn: TButton
Left = 393
Top = 446
TabOrder = 13
end
inherited ComputeBtn: TButton
Left = 309
Top = 446
TabOrder = 12
end
inherited ResetBtn: TButton
Left = 247
Top = 446
TabOrder = 11
end
inherited HelpBtn: TButton
Left = 188
Top = 446
TabOrder = 10
end
inherited ButtonBevel: TBevel
Top = 430
Width = 448
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 = InBtn
Left = 248
Height = 15
Top = 104
Width = 127
Caption = 'Variables to be Analyzed'
ParentColor = False
end
object Label3: TLabel[7]
AnchorSideLeft.Control = DepVarEdit
AnchorSideBottom.Control = DepVarEdit
Left = 252
Height = 15
Top = 28
Width = 102
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Dependent Variable'
ParentColor = False
end
object VarList: TListBox[8]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = CriteriaGroup
Left = 0
Height = 205
Top = 17
Width = 200
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 4
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = SelListSelectionChange
TabOrder = 0
end
object CovChkBox: TCheckBox
Left = 16
Height = 19
Top = 27
Width = 196
Caption = 'Show Variance-covariance Matrix'
TabOrder = 1
end
object CorrsChkBox: TCheckBox
Left = 16
Height = 19
Top = 48
Width = 196
Caption = 'Show Intercorrelations Matrix'
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'
object InBtn: TBitBtn[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom
Left = 211
Height = 26
Top = 104
Width = 26
BorderSpacing.Top = 24
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = InBtnClick
Spacing = 0
TabOrder = 4
end
object SDChkBox: TCheckBox
Left = 236
Height = 19
Top = 6
Width = 201
Caption = 'Show Standard Deviations'
object OutBtn: TBitBtn[10]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 211
Height = 26
Top = 134
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5
end
object MatInChkBox: TCheckBox
Left = 236
Height = 19
Top = 27
Width = 201
Caption = 'Get Data from a Matrix File'
object AllBtn: TBitBtn[11]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 204
Height = 25
Top = 184
Width = 40
AutoSize = True
BorderSpacing.Top = 24
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 6
end
object MatSaveChkBox: TCheckBox
Left = 236
Height = 19
Top = 48
Width = 201
Caption = 'Save the Correlation Matrix'
object SelList: TListBox[12]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
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
end
object PredictChkBox: TCheckBox
Left = 236
Height = 19
Top = 69
Width = 201
Caption = 'Predictions, residuals, C.I.''s to Grid'
TabOrder = 8
end
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
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
object DepInBtn: TBitBtn[13]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
Left = 211
Height = 26
Top = 24
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
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
object Bevel2: TBevel
inherited ParamsSplitter: TSplitter
Left = 460
Height = 487
end
object Bevel2: TBevel[2]
Left = 5
Height = 15
Top = 352
Width = 13
Shape = bsSpacer
end
object OpenDialog1: TOpenDialog
object OpenDialog1: TOpenDialog[3]
Left = 49
Top = 48
end
object SaveDialog1: TSaveDialog
object SaveDialog1: TSaveDialog[4]
Left = 48
Top = 112
end

View File

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

View File

@ -1228,6 +1228,13 @@ begin
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;
NoVars : integer;
VAR NoIndepVars : integer;
@ -1247,15 +1254,6 @@ procedure MReg2(NCases : integer;
TestOut : boolean;
PrintInv : boolean;
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
i, j, k, l : integer;
IndexX, IndexY : integer;
@ -1345,7 +1343,10 @@ begin
AReport.Add('SOURCE DF SS MS F Prob. > F');
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('Total %4.0f %14.3f', [df3, SSt]);
AReport.Add('');