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,82 +1,103 @@
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
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 Height = 15
Top = 8 Top = 0
Width = 97 Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables' Caption = 'Available Variables'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel[6]
AnchorSideLeft.Control = SelList AnchorSideLeft.Control = SelList
AnchorSideTop.Control = InBtn AnchorSideTop.Control = InBtn
Left = 269 Left = 248
Height = 15 Height = 15
Top = 108 Top = 104
Width = 127 Width = 127
Caption = 'Variables to be Analyzed' Caption = 'Variables to be Analyzed'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel[7]
AnchorSideLeft.Control = DepVar AnchorSideLeft.Control = DepVarEdit
AnchorSideBottom.Control = DepVar AnchorSideBottom.Control = DepVarEdit
Left = 269 Left = 252
Height = 15 Height = 15
Top = 32 Top = 28
Width = 102 Width = 102
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Dependent Variable' Caption = 'Dependent Variable'
ParentColor = False ParentColor = False
end end
object VarList: TListBox object VarList: TListBox[8]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1 AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = GroupBox2 AnchorSideBottom.Control = CriteriaGroup
Left = 8 Left = 0
Height = 188 Height = 205
Top = 25 Top = 17
Width = 199 Width = 200
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8 BorderSpacing.Right = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
ItemHeight = 0 ItemHeight = 0
MultiSelect = True MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = SelListSelectionChange OnSelectionChange = SelListSelectionChange
TabOrder = 0 TabOrder = 0
end end
object InBtn: TBitBtn object InBtn: TBitBtn[9]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 224 Left = 211
Height = 28 Height = 26
Top = 108 Top = 104
Width = 28 Width = 26
BorderSpacing.Top = 24 BorderSpacing.Top = 24
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
@ -84,15 +105,15 @@ object StepFwdForm: TStepFwdForm
Spacing = 0 Spacing = 0
TabOrder = 4 TabOrder = 4
end end
object OutBtn: TBitBtn object OutBtn: TBitBtn[10]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 224 Left = 211
Height = 28 Height = 26
Top = 140 Top = 134
Width = 28 Width = 26
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -100,64 +121,65 @@ object StepFwdForm: TStepFwdForm
Spacing = 0 Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object AllBtn: TBitBtn object AllBtn: TBitBtn[11]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 215 Left = 204
Height = 25 Height = 25
Top = 192 Top = 184
Width = 46 Width = 40
AutoSize = True AutoSize = True
BorderSpacing.Top = 24 BorderSpacing.Top = 24
Caption = 'ALL' Caption = 'All'
OnClick = AllBtnClick OnClick = AllBtnClick
Spacing = 0 Spacing = 0
TabOrder = 6 TabOrder = 6
end end
object SelList: TListBox object SelList: TListBox[12]
AnchorSideLeft.Control = AllBtn AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2 AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox2 AnchorSideBottom.Control = CriteriaGroup
Left = 269 Left = 248
Height = 88 Height = 101
Top = 125 Top = 121
Width = 199 Width = 200
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 4
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0 ItemHeight = 0
MultiSelect = True MultiSelect = True
OnDblClick = SelListDblClick
OnSelectionChange = SelListSelectionChange OnSelectionChange = SelListSelectionChange
TabOrder = 7 TabOrder = 7
end end
object DepInBtn: TBitBtn object DepInBtn: TBitBtn[13]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
Left = 224 Left = 211
Height = 28 Height = 26
Top = 24 Top = 24
Width = 28 Width = 26
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = DepInBtnClick OnClick = DepInBtnClick
Spacing = 0 Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object DepOutBtn: TBitBtn object DepOutBtn: TBitBtn[14]
AnchorSideLeft.Control = DepInBtn AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 224 Left = 211
Height = 28 Height = 26
Top = 56 Top = 54
Width = 28 Width = 26
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -165,51 +187,49 @@ object StepFwdForm: TStepFwdForm
Spacing = 0 Spacing = 0
TabOrder = 2 TabOrder = 2
end end
object DepVar: TEdit object DepVarEdit: TEdit[15]
AnchorSideLeft.Control = AllBtn AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3 AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 269 Left = 252
Height = 23 Height = 23
Top = 49 Top = 45
Width = 199 Width = 196
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
TabOrder = 3 TabOrder = 3
Text = 'DepVar' Text = 'DepVarEdit'
end end
object GroupBox1: TGroupBox object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Control = ButtonBevel
Left = 8 Left = 0
Height = 135 Height = 135
Top = 286 Top = 295
Width = 457 Width = 441
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
Caption = 'Options' Caption = 'Options'
ChildSizing.LeftRightSpacing = 16 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24 ChildSizing.HorizontalSpacing = 16
ChildSizing.VerticalSpacing = 2 ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5 ChildSizing.ControlsPerLine = 5
ClientHeight = 115 ClientHeight = 115
ClientWidth = 453 ClientWidth = 437
TabOrder = 9 TabOrder = 9
object CPChkBox: TCheckBox object CPChkBox: TCheckBox
Left = 16 Left = 12
Height = 19 Height = 19
Top = 6 Top = 6
Width = 196 Width = 196
@ -217,7 +237,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 0 TabOrder = 0
end end
object CovChkBox: TCheckBox object CovChkBox: TCheckBox
Left = 16 Left = 12
Height = 19 Height = 19
Top = 27 Top = 27
Width = 196 Width = 196
@ -225,7 +245,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 1 TabOrder = 1
end end
object CorrsChkBox: TCheckBox object CorrsChkBox: TCheckBox
Left = 16 Left = 12
Height = 19 Height = 19
Top = 48 Top = 48
Width = 196 Width = 196
@ -233,7 +253,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 2 TabOrder = 2
end end
object MeansChkBox: TCheckBox object MeansChkBox: TCheckBox
Left = 16 Left = 12
Height = 19 Height = 19
Top = 69 Top = 69
Width = 196 Width = 196
@ -241,7 +261,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 3 TabOrder = 3
end end
object VarChkBox: TCheckBox object VarChkBox: TCheckBox
Left = 16 Left = 12
Height = 19 Height = 19
Top = 90 Top = 90
Width = 196 Width = 196
@ -249,7 +269,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 4 TabOrder = 4
end end
object SDChkBox: TCheckBox object SDChkBox: TCheckBox
Left = 236 Left = 224
Height = 19 Height = 19
Top = 6 Top = 6
Width = 201 Width = 201
@ -257,7 +277,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 5 TabOrder = 5
end end
object MatInChkBox: TCheckBox object MatInChkBox: TCheckBox
Left = 236 Left = 224
Height = 19 Height = 19
Top = 27 Top = 27
Width = 201 Width = 201
@ -265,7 +285,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 6 TabOrder = 6
end end
object MatSaveChkBox: TCheckBox object MatSaveChkBox: TCheckBox
Left = 236 Left = 224
Height = 19 Height = 19
Top = 48 Top = 48
Width = 201 Width = 201
@ -273,7 +293,7 @@ object StepFwdForm: TStepFwdForm
TabOrder = 7 TabOrder = 7
end end
object PredictChkBox: TCheckBox object PredictChkBox: TCheckBox
Left = 236 Left = 224
Height = 19 Height = 19
Top = 69 Top = 69
Width = 201 Width = 201
@ -281,85 +301,16 @@ object StepFwdForm: TStepFwdForm
TabOrder = 8 TabOrder = 8
end end
end end
object ResetBtn: TButton object CriteriaGroup: TGroupBox[17]
AnchorSideRight.Control = ComputeBtn AnchorSideLeft.Control = ParamsPanel
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 AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = GroupBox1 AnchorSideBottom.Control = OptionsGroup
Left = 8 Left = 0
Height = 53 Height = 53
Top = 225 Top = 234
Width = 268 Width = 268
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 12 BorderSpacing.Top = 12
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -368,10 +319,10 @@ object StepFwdForm: TStepFwdForm
ClientWidth = 264 ClientWidth = 264
TabOrder = 8 TabOrder = 8
object Label4: TLabel object Label4: TLabel
AnchorSideLeft.Control = GroupBox2 AnchorSideLeft.Control = CriteriaGroup
AnchorSideTop.Control = InProb AnchorSideTop.Control = InProbEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = InProb AnchorSideRight.Control = InProbEdit
Left = 18 Left = 18
Height = 15 Height = 15
Top = 6 Top = 6
@ -382,11 +333,11 @@ object StepFwdForm: TStepFwdForm
ParentColor = False ParentColor = False
end end
object Label5: TLabel object Label5: TLabel
AnchorSideLeft.Control = InProb AnchorSideLeft.Control = InProbEdit
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb AnchorSideTop.Control = InProbEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = OutProb AnchorSideRight.Control = OutProbEdit
Left = 144 Left = 144
Height = 15 Height = 15
Top = 6 Top = 6
@ -396,11 +347,11 @@ object StepFwdForm: TStepFwdForm
Caption = 'to Retain:' Caption = 'to Retain:'
ParentColor = False ParentColor = False
end end
object InProb: TEdit object InProbEdit: TEdit
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBox2 AnchorSideTop.Control = CriteriaGroup
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = CriteriaGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 70 Left = 70
Height = 23 Height = 23
@ -409,13 +360,13 @@ object StepFwdForm: TStepFwdForm
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 12 BorderSpacing.Right = 12
TabOrder = 0 TabOrder = 0
Text = 'InProb' Text = 'InProbEdit'
end end
object OutProb: TEdit object OutProbEdit: TEdit
AnchorSideLeft.Control = Label5 AnchorSideLeft.Control = Label5
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = InProb AnchorSideTop.Control = InProbEdit
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = CriteriaGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 202 Left = 202
Height = 23 Height = 23
@ -424,21 +375,26 @@ object StepFwdForm: TStepFwdForm
BorderSpacing.Right = 12 BorderSpacing.Right = 12
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
TabOrder = 1 TabOrder = 1
Text = 'OutProb' Text = 'OutProbEdit'
end end
end end
object Bevel2: TBevel end
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,6 +1343,9 @@ begin
AReport.Add('SOURCE DF SS MS F Prob. > F'); AReport.Add('SOURCE DF SS MS F Prob. > F');
AReport.Add('---------- ---- -------------- -------------- -------------- ---------'); AReport.Add('---------- ---- -------------- -------------- -------------- ---------');
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('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]);