diff --git a/applications/lazstats/LazStats.chm b/applications/lazstats/LazStats.chm index 2b04807e5..8f3265f4f 100644 Binary files a/applications/lazstats/LazStats.chm and b/applications/lazstats/LazStats.chm differ diff --git a/applications/lazstats/docs/HelpNDoc/LazStats.hnd b/applications/lazstats/docs/HelpNDoc/LazStats.hnd index 619e2b84e..0183a4891 100644 Binary files a/applications/lazstats/docs/HelpNDoc/LazStats.hnd and b/applications/lazstats/docs/HelpNDoc/LazStats.hnd differ diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.lfm index b999abbc6..c3ea58311 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.lfm @@ -31,6 +31,8 @@ inherited BackRegForm: TBackRegForm inherited HelpBtn: TButton Left = 172 Top = 357 + HelpType = htKeyword + HelpKeyword = 'html/BackwardStepwise.htm' TabOrder = 9 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.pas index 632bf96ed..862fa7cdb 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/backregunit.pas @@ -69,7 +69,7 @@ implementation uses Math, - Utils; + Utils, GridProcs; { TBackRegForm } @@ -214,7 +214,8 @@ begin if StepNo > 1 then lReport.Add(''); lReport.Add(''); - lReport.Add('----------------- STEP %3d ------------------', [StepNo]); + lReport.Add('----------------- STEP %d ------------------', [StepNo]); + lReport.Add(''); if CPChkBox.Checked then begin title := 'Cross-Products Matrix'; @@ -277,7 +278,7 @@ begin MessageDlg('Matrix is singular!', mtError,[mbOK], 0); // goto cleanup; end; - lReport.Add('Determinant of correlation matrix = %8.4f', [determinant]); + lReport.Add('Determinant of correlation matrix: %.4f', [determinant]); lReport.Add(''); NoIndepVars := NoVars-1; @@ -406,16 +407,12 @@ begin end; procedure TBackRegForm.Reset; -var - i: integer; begin inherited; DepVarEdit.Clear; - VarList.Clear; SelList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); CPChkBox.Checked := false; CovChkBox.Checked := false; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.lfm index 99f007685..209fb6c1d 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.lfm @@ -28,6 +28,8 @@ inherited BestRegForm: TBestRegForm inherited HelpBtn: TButton Left = 207 Top = 392 + HelpType = htKeyword + HelpKeyword = 'html/BestCombinationMultipleRegressio.htm' end inherited ButtonBevel: TBevel Top = 376 diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.pas index 7f1a188c5..386b1c1d3 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/bestregunit.pas @@ -131,7 +131,7 @@ implementation uses Math, - Utils, MathUnit; + Utils, MathUnit, GridProcs; { TBestRegForm } @@ -736,16 +736,12 @@ end; procedure TBestRegForm.Reset; -var - i: integer; begin inherited; DepVarEdit.Clear; BlockList.Clear; - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); CPChkBox.Checked := false; CovChkBox.Checked := false; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.lfm index 479975841..f66fdd2bf 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.lfm @@ -8,6 +8,7 @@ inherited BlkMregForm: TBlkMregForm Caption = 'Block Entry Multiple Regression' ClientHeight = 415 ClientWidth = 962 + OnCreate = FormCreate inherited ParamsPanel: TPanel Height = 399 Width = 442 @@ -31,6 +32,8 @@ inherited BlkMregForm: TBlkMregForm inherited HelpBtn: TButton Left = 182 Top = 374 + HelpType = htKeyword + HelpKeyword = 'html/BlockEntryMultipleRegression.htm' TabOrder = 12 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.pas index d7ce1bc33..ebd5e865b 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/blkmregunit.pas @@ -49,6 +49,7 @@ type procedure BlockListDblClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject); + procedure FormCreate(Sender: TObject); procedure InBtnClick(Sender: TObject); procedure NextBlkBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject); @@ -81,7 +82,7 @@ implementation uses Math, - Utils, MathUnit; + Utils, MathUnit, GridProcs; { TBlkMregForm } @@ -136,24 +137,24 @@ end; procedure TBlkMregForm.Compute; var i, j, k, errorcode: integer; - NoIndepVars, DepVarCol, NEntered, StepNo : integer; + NoIndepVars, DepVarCol, NEntered, StepNo: integer; R2, df1, df2: double; - StdErrEst, F, FProbF, OldR2 : double; - pdf1, probin, prout : double; - BetaWeights : DblDyneVec = nil; - corrs : DblDyneMat = nil; - Means : DblDyneVec = nil; - Variances : DblDyneVec = nil; - StdDevs : DblDyneVec = nil; - title : string; - IndRowLabels : StrDyneVec = nil; - IndColLabels : StrDyneVec = nil; - IndepInverse : DblDyneMat = nil; - IndepIndex : IntDyneVec = nil; - Candidate : IntDyneVec = nil; - filename : string; - ColEntered : IntDyneVec = nil; - constant : double; + StdErrEst, F, FProbF, OldR2: double; + pdf1, probin, prout: double; + BetaWeights: DblDyneVec = nil; + corrs: DblDyneMat = nil; + Means: DblDyneVec = nil; + Variances: DblDyneVec = nil; + StdDevs: DblDyneVec = nil; + IndRowLabels: StrDyneVec = nil; + IndColLabels: StrDyneVec = nil; + IndepInverse: DblDyneMat = nil; + IndepIndex: IntDyneVec = nil; + Candidate: IntDyneVec = nil; + ColEntered: IntDyneVec = nil; + title: string; + filename: string; + constant: double; errcode: boolean = false; NCases: Integer = 0; lReport: TStrings; @@ -171,7 +172,7 @@ begin SetLength(ColEntered,NoVariables); NextBlkBtnClick(self); - probin := StrToFloat(InProb.Text); // probability to include a block + probin := StrToFloat(InProb.Text); // probability to include a block prout := 1.0; lReport := TStringList.Create; @@ -437,6 +438,12 @@ begin end; +procedure TBlkMregForm.FormCreate(Sender: TObject); +begin + InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); +end; + + procedure TBlkMregForm.InBtnClick(Sender: TObject); var i: integer; @@ -511,17 +518,13 @@ end; procedure TBlkMregForm.Reset; -var - i: integer; begin inherited; BlockList.Items.Clear; - VarList.Items.Clear; BlockNoEdit.Text := '1'; NoBlocks := 1; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); CPChkBox.Checked := false; CovChkBox.Checked := false; @@ -534,7 +537,6 @@ begin NoVars := 0; DepVarEdit.Text := ''; - InProb.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); SetLength(BlkVarCols, NoVariables, NoVariables); SetLength(VarsInBlk, NoVariables); diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.lfm index 5871de490..9b9413789 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.lfm @@ -8,6 +8,7 @@ inherited CoxRegForm: TCoxRegForm Caption = 'Cox Proportional Hazards Survival Regression' ClientHeight = 393 ClientWidth = 480 + OnCreate = FormCreate inherited ParamsPanel: TPanel Height = 377 ClientHeight = 377 @@ -22,6 +23,8 @@ inherited CoxRegForm: TCoxRegForm end inherited HelpBtn: TButton Top = 352 + HelpType = htKeyword + HelpKeyword = 'html/CoxProportionalHazardsSurvivalRe.htm' end inherited ButtonBevel: TBevel Top = 336 diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.pas index 78f30faf6..93c771b3a 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/coxregunit.pas @@ -38,13 +38,14 @@ type procedure BlockListDblClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject); + procedure FormCreate(Sender: TObject); procedure InBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject); procedure StatusInBtnClick(Sender: TObject); procedure StatusOutBtnClick(Sender: TObject); - function ChiSq(x : double; n : integer) : double; - function Norm(z : double): double; - function ix(j, k, nCols : integer): integer; + function ChiSq(x: double; n: integer) : double; + function Norm(z: double): double; + function ix(j, k, nCols: integer): integer; procedure VarListDblClick(Sender: TObject); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); @@ -55,6 +56,7 @@ type procedure AdjustConstraints; override; procedure Compute; override; procedure UpdateBtnStates; override; + function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; public procedure Reset; override; @@ -69,7 +71,7 @@ implementation uses Math, - Utils; + Utils, GridProcs; { TCoxRegForm } @@ -161,7 +163,7 @@ var SE : DblDyneVec = nil; x : DblDyneVec = nil; // data matrix for independent variables RowLabels : StrDyneVec = nil; - ColLabels : StrDyneVec; + ColLabels : StrDyneVec = nil; Lo95 : double; Hi95 : double; d : double; @@ -169,19 +171,7 @@ var lReport: TStrings; begin - if MaxItsEdit.Text = '' then - begin - MaxItsEdit.Setfocus; - MessageDlg('Maximum iterations not specified.', mtError, [mbOK], 0); - exit; - end; - - if not TryStrToInt(MaxItsEdit.Text, iters) then - begin - MaxItsEdit.SetFocus; - MessageDlg('Valid number required.', mtError, [mbOK], 0); - exit; - end; + iters := StrToInt(MaxItsEdit.Text); { get independent item columns } nR := BlockList.Items.Count; @@ -189,11 +179,6 @@ begin SetLength(ColNoSelected,nR + 2); SetLength(RowLabels,nR + 2); SetLength(ColLabels,nR + 2); - if nR < 1 then - begin - MessageDlg('No independent variables selected.', mtError, [mbOK], 0); - exit; - end; for i := 1 to nR do begin @@ -210,16 +195,6 @@ begin end; { get survival time variable column and survival status var. column } - if DepVar.Text = '' then - begin - MessageDlg('No Survival time variable selected.', mtError, [mbOK], 0); - exit; - end; - if StatusEdit.Text = '' then - begin - MessageDlg('No Survival Status variable selected.', mtError, [mbOK], 0); - exit; - end; nP := nR + 1; nS := nP + 1; for j := 1 to NoVariables do @@ -521,6 +496,14 @@ begin end; +procedure TCoxRegForm.FormCreate(Sender: TObject); +begin + MaxItsEdit.Text := '20'; + ProbsChk.Checked := true; + DescChk.Checked := true; +end; + + procedure TCoxRegForm.InBtnClick(Sender: TObject); var i: integer; @@ -540,7 +523,7 @@ begin end; -function TCoxRegForm.ix(j, k, nCols : integer): integer; +function TCoxRegForm.ix(j, k, nCols: integer): integer; begin Result := j*nCols + k; end; @@ -572,20 +555,14 @@ end; procedure TCoxRegForm.Reset; -var - i: integer; begin inherited; BlockList.Clear; - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); - ProbsChk.Checked := true; - DescChk.Checked := true; + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); + DepVar.Text := ''; StatusEdit.Text := ''; - MaxItsEdit.Text := '20'; end; @@ -631,6 +608,52 @@ begin end; +function TCoxRegForm.Validate(out AMsg: String; + out AControl: TWinControl): Boolean; +var + n: Integer; +begin + Result := false; + + if BlockList.Items.Count < 1 then + begin + AControl := VarList; + AMsg := 'No independent variables selected.'; + exit; + end; + + if DepVar.Text = '' then + begin + AControl := VarList; + AMsg := 'No Survival time variable selected.'; + exit; + end; + + if StatusEdit.Text = '' then + begin + AControl := VarList; + AMsg := 'No Survival Status variable selected.'; + exit; + end; + + if MaxItsEdit.Text = '' then + begin + AControl := MaxItsEdit; + AMsg := 'Maximum iterations not specified.'; + exit; + end; + + if not TryStrToInt(MaxItsEdit.Text, n) then + begin + AControl := MaxItsEdit; + AMsg := 'Valid number required.'; + exit; + end; + + Result := true; +end; + + procedure TCoxRegForm.VarListDblClick(Sender: TObject); var index: Integer; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.lfm index 60ffdca06..f69c1ee3b 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.lfm @@ -8,6 +8,7 @@ inherited LogRegForm: TLogRegForm Caption = 'Binary Logistic Regression' ClientHeight = 342 ClientWidth = 582 + OnCreate = FormCreate inherited ParamsPanel: TPanel Height = 326 ClientHeight = 326 @@ -25,6 +26,8 @@ inherited LogRegForm: TLogRegForm end inherited HelpBtn: TButton Top = 301 + HelpType = htKeyword + HelpKeyword = 'html/BinaryLogisticRegression.htm' TabOrder = 9 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.pas index 0557cf001..501726da5 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/logregunit.pas @@ -32,6 +32,7 @@ type procedure BlockListDblClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject); + procedure FormCreate(Sender: TObject); procedure InBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject); procedure VarListDblClick(Sender: TObject); @@ -58,7 +59,7 @@ implementation {$R *.lfm} uses - Math; + Math, GridProcs; function ix(j, k, nCols: integer): integer; @@ -262,7 +263,7 @@ begin if DescChk.Checked then lReport.Add(' %3d %15s %10.4f %10.4f',[j,RowLabels[j],xM[j],xSD[j]]); end; - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); xM[0] := 0.0; xSD[0] := 1.0; @@ -373,7 +374,7 @@ begin end; // iteration lReport.Add('Converged'); lReport.Add(''); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); CSq := LLn - LL; @@ -503,6 +504,14 @@ begin end; +procedure TLogRegForm.FormCreate(Sender: TObject); +begin + MaxItsEdit.Text := '20'; + ProbsChk.Checked := true; + DescChk.Checked := true; +end; + + procedure TLogRegForm.InBtnClick(Sender: TObject); var i: integer; @@ -550,15 +559,9 @@ begin inherited; BlockList.Clear; - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); DepVarEdit.Text := ''; - ProbsChk.Checked := true; - DescChk.Checked := true; - MaxItsEdit.Text := '20'; - UpdateBtnStates; end; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.lfm index a48cfcea8..0aba071e0 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.lfm @@ -31,6 +31,8 @@ inherited SimultForm: TSimultForm inherited HelpBtn: TButton Left = 147 Top = 406 + HelpType = htKeyword + HelpKeyword = 'html/SimultaneousMultipleRegression.htm' TabOrder = 6 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.pas index 2e8f58a09..55dae135f 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/simultregunit.pas @@ -62,7 +62,7 @@ implementation uses Math, - Utils, MathUnit; + Utils, MathUnit, GridProcs; { TSimultForm } @@ -132,12 +132,12 @@ begin lReport := TStringList.Create; try lReport.Add('SIMULTANEOUS MULTIPLE REGRESSION by Bill Miller'); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); errcode := 0; if MatInChkBox.Checked then begin - OpenDialog1.Filter := 'FreeStat matrix files (*.mat)|*.mat;*.MAT|All files (*.*)|*.*'; + OpenDialog1.Filter := 'LazStat matrix files (*.mat)|*.mat;*.MAT|All files (*.*)|*.*'; OpenDialog1.FilterIndex := 1; if OpenDialog1.Execute then begin @@ -175,7 +175,7 @@ begin title := 'Cross-Products Matrix'; GridXProd(NoVars,ColNoSelected,Corrs,errorcode,NCases); MatPrint(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -185,7 +185,7 @@ begin GridCovar(NoVars,ColNoSelected,Corrs,Means,Variances, StdDevs,errorcode,NCases); MatPrint(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -197,7 +197,7 @@ begin for j := 1 to NoVars do InverseMat[i-1,j-1] := Corrs[i-1,j-1]; title := 'Product-Moment Correlations Matrix'; MatPrint(Corrs,NoVars,NoVars,title,RowLabels,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -217,7 +217,7 @@ begin begin title := 'Means'; DynVectorPrint(Means,NoVars,title,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -225,7 +225,7 @@ begin begin title := 'Variances'; DynVectorPrint(Variances,NoVars,title,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -233,7 +233,7 @@ begin begin title := 'Standard Deviations'; DynVectorPrint(StdDevs,NoVars,title,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -254,7 +254,7 @@ begin MessageDlg('Matrix is singular.', mtError, [mbOK], 0); exit; end; - lReport.Add('Determinant of correlation matrix = %8.4f', [Determinant]); + lReport.Add('Determinant of correlation matrix: %.4f', [Determinant]); lReport.Add(''); SVDinverse(InverseMat, NoVars); @@ -262,7 +262,7 @@ begin begin title := 'Inverse of correlation matrix'; MatPrint(InverseMat,NoVars,NoVars,title,RowLabels,ColLabels,NCases, lReport); - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); end; @@ -287,7 +287,7 @@ begin ProdMat[i-1,j-1] := -InverseMat[i-1,j-1] / InverseMat[j-1,j-1]; end; end; - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); title := 'Betas in Columns'; @@ -301,7 +301,7 @@ begin valstring := format('%10s', [ColLabels[i-1]]); lReport.Add('%10s%10.3f', [valstring,StdErr]); end; - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); for i := 1 to NoVars do @@ -321,7 +321,7 @@ begin valstring := format('%10s',[ColLabels[i-1]]); lReport.Add('%10s%10.3f', [valstring, x]); end; - lReport.Add('------------------------------------------------------------------'); + lReport.Add(DIVIDER_SMALL_AUTO); lReport.Add(''); // Get partial correlation matrix @@ -397,15 +397,11 @@ end; procedure TSimultForm.Reset; -var - i: integer; begin inherited; - VarList.Clear; SelList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); CPChkBox.Checked := false; CovChkBox.Checked := false; @@ -433,6 +429,7 @@ begin end; end; + procedure TSimultForm.VarListDblClick(Sender: TObject); var index: Integer; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.lfm index cc6d26c65..0159feeae 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.lfm @@ -2,12 +2,13 @@ inherited StepFwdForm: TStepFwdForm Left = 564 Height = 487 Top = 333 - Width = 786 + Width = 801 HelpType = htKeyword HelpKeyword = 'html/ForwardStepwise.htm' Caption = 'Forward Stepwise Multiple Regression' ClientHeight = 487 - ClientWidth = 786 + ClientWidth = 801 + OnCreate = FormCreate inherited ParamsPanel: TPanel Height = 471 Width = 448 @@ -31,6 +32,8 @@ inherited StepFwdForm: TStepFwdForm inherited HelpBtn: TButton Left = 188 Top = 446 + HelpType = htKeyword + HelpKeyword = 'html/ForwardStepwise.htm' TabOrder = 10 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.pas index bd087fbd5..61545a366 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/stepfwdmrunit.pas @@ -46,6 +46,7 @@ type procedure AllBtnClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject); + procedure FormCreate(Sender: TObject); procedure InBtnClick(Sender: TObject); procedure SelListDblClick(Sender: TObject); procedure SelListSelectionChange(Sender: TObject; {%H-}User: boolean); @@ -73,7 +74,7 @@ implementation uses Math, - Utils, MathUnit; + Utils, GridProcs, MathUnit; { TStepFwdForm } @@ -486,6 +487,13 @@ begin end; +procedure TStepFwdForm.FormCreate(Sender: TObject); +begin + InProbEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); + OutProbEdit.Text := FormatFloat('0.00', 0.10); +end; + + procedure TStepFwdForm.InBtnClick(Sender: TObject); var i: integer; @@ -532,14 +540,10 @@ var begin inherited; - VarList.Clear; + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); 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; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.lfm index e3754fdbd..ee912811e 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.lfm @@ -31,6 +31,8 @@ inherited TwoSLSForm: TTwoSLSForm inherited HelpBtn: TButton Left = 55 Top = 335 + HelpType = htKeyword + HelpKeyword = 'html/TwoStageLeastSquaresRegression.htm' TabOrder = 11 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.pas index 8db155607..9df0e30b3 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/twoslsunit.pas @@ -57,6 +57,7 @@ type procedure AdjustConstraints; override; procedure Compute; override; procedure UpdateBtnStates; override; + function Validate(out AMsg: String; out AControl: TWinControl): boolean; override; public constructor Create(AOwner: TComponent); override; @@ -72,7 +73,7 @@ implementation {$R *.lfm} uses - StrUtils, Utils; + StrUtils, Utils, GridProcs; { TTwoSLSForm } @@ -130,38 +131,8 @@ var lReport: TStrings; errorcode: Boolean = false; begin - if DepVarEdit.Text = '' then - begin - MessageDlg('Dependent variable not selected.', mtError, [mbOK], 0); - exit; - end; - if ExplanatoryList.Items.Count = 0 then - begin - MessageDlg('No explanatory variables selected.', mtError, [mbOK], 0); - exit; - end; - if InstrumentalList.Items.Count = 0 then - begin - MessageDlg('No instrumental variables selected.', mtError, [mbOK], 0); - exit; - end; + PrintDesc := ProxyRegShowChk.Checked; - if (ProxyRegShowChk.Checked) then - begin - PrintDesc := true; -// PrintCorrs := true; -// PrintInverse := false; -// PrintCoefs := true; -// SaveCorrs := false; - end - else - begin - PrintDesc := false; -// PrintCorrs := false; -// PrintInverse := false; -// PrintCoefs := false; -// SaveCorrs := false; - end; SetLength(Means,NoVariables+2); SetLength(Variances,NoVariables+2); SetLength(StdDevs,NoVariables+2); @@ -293,7 +264,7 @@ begin end; IndepCols[Noindep] := DepProx; lReport.Add(''); - lReport.Add('=================================================================='); + lReport.Add(DIVIDER_AUTO); lReport.Add(''); lReport.Add('Analysis for ' + ProxLabels[i]); lReport.Add('-------------' + DupeString('-', Length(ProxLabels[i]))); @@ -327,7 +298,7 @@ begin // OutputFrm.ShowModal(); lReport.Add(''); - lReport.Add('=================================================================='); + lReport.Add(DIVIDER_AUTO); lReport.Add(''); // Compute the OLS using the Prox values and ExplanatoryList @@ -598,17 +569,13 @@ end; procedure TTwoSLSForm.Reset; -var - i: integer; begin inherited; DepVarEdit.Clear; InstrumentalList.Clear; ExplanatoryList.Clear; - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); ProxyRegShowChk.Checked := false; UpdateBtnStates; end; @@ -631,6 +598,36 @@ begin end; +function TTwoSLSForm.Validate(out AMsg: String; + out AControl: TWinControl): boolean; +begin + Result := false; + + if DepVarEdit.Text = '' then + begin + AMsg := 'Dependent variable not selected.'; + AControl := VarList; + exit; + end; + + if ExplanatoryList.Items.Count = 0 then + begin + AMsg := 'No explanatory variables selected.'; + AControl := VarList; + exit; + end; + + if InstrumentalList.Items.Count = 0 then + begin + AMsg := 'No instrumental variables selected.'; + AControl := VarList; + exit; + end; + + Result := true; +end; + + procedure TTwoSLSForm.VarListDblClick(Sender: TObject); var index: Integer; diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.lfm b/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.lfm index 5b2ef2350..d173b900b 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.lfm +++ b/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.lfm @@ -32,6 +32,8 @@ inherited WLSForm: TWLSForm Tag = 158 Left = 20 Top = 428 + HelpType = htKeyword + HelpKeyword = 'html/WeightedLeast-SquaresRegression.htm' TabOrder = 11 end inherited ButtonBevel: TBevel @@ -346,13 +348,13 @@ inherited WLSForm: TWLSForm Height = 453 Top = 8 Width = 552 - ActivePage = ResidualsRegPage + ActivePage = OLSPage Align = alClient BorderSpacing.Left = 4 BorderSpacing.Top = 8 BorderSpacing.Right = 8 BorderSpacing.Bottom = 8 - TabIndex = 1 + TabIndex = 0 TabOrder = 2 object OLSPage: TTabSheet Caption = 'OLS Regression' diff --git a/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.pas b/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.pas index 07dcc416f..5238f666f 100644 --- a/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.pas +++ b/applications/lazstats/source/forms/analysis/multiple_regression/wlsunit.pas @@ -923,14 +923,10 @@ end; procedure TWLSForm.Reset; -var - i: integer; begin inherited; - VarList.Clear; - for i := 0 to NoVariables - 1 do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i+1,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); IndVarList.Clear; DepVarEdit.Clear; diff --git a/applications/lazstats/source/forms/mainunit.lfm b/applications/lazstats/source/forms/mainunit.lfm index 11db3e4b0..06138dfa8 100644 --- a/applications/lazstats/source/forms/mainunit.lfm +++ b/applications/lazstats/source/forms/mainunit.lfm @@ -648,6 +648,9 @@ object OS3MainFrm: TOS3MainFrm Caption = 'Binary Logistic' OnClick = mnuAnalysisMultReg_BinLogisticClick end + object MenuItem4: TMenuItem + Caption = '-' + end object mnuAnalysisMultReg_CoxSurvival: TMenuItem Caption = 'Cox Proportional Hazzards Survival Regression' OnClick = mnuAnalysisMultReg_CoxSurvivalClick diff --git a/applications/lazstats/source/forms/mainunit.pas b/applications/lazstats/source/forms/mainunit.pas index 2ec19b318..8296d6357 100644 --- a/applications/lazstats/source/forms/mainunit.pas +++ b/applications/lazstats/source/forms/mainunit.pas @@ -47,6 +47,7 @@ type FilterLabel: TLabel; MenuItem2: TMenuItem; MenuItem3: TMenuItem; + MenuItem4: TMenuItem; NoCasesEdit: TEdit; NoCasesLabel: TLabel; NoVarsEdit: TEdit;