diff --git a/applications/lazstats/LazStats.chm b/applications/lazstats/LazStats.chm index 8a577f600..73cb4ed0a 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 5e4bbbce2..e67e20350 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/descriptive/comparedistunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm index c2a8d6966..83b62b0d0 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm @@ -25,25 +25,28 @@ inherited CompareDistFrm: TCompareDistFrm end inherited HelpBtn: TButton Top = 494 + HelpType = htKeyword + HelpKeyword = 'html/ComparisonsWithTheoreticalDistri.htm' TabOrder = 7 - Visible = False end inherited ButtonBevel: TBevel Top = 478 end object OptionsGroup: TGroupBox[5] AnchorSideLeft.Control = ParamsPanel + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = ButtonBevel Left = 0 Height = 110 Top = 368 - Width = 294 - Anchors = [akLeft, akBottom] + Width = 291 + Anchors = [akLeft, akRight, akBottom] AutoSize = True BorderSpacing.Top = 8 Caption = 'Options' ClientHeight = 90 - ClientWidth = 290 + ClientWidth = 287 TabOrder = 6 object BothChk: TCheckBox AnchorSideLeft.Control = OptionsGroup diff --git a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas index a3aba3874..68c2c4c9d 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas @@ -113,7 +113,7 @@ implementation uses Math, TACustomSeries, TASeries, - Utils, MathUnit; + Utils, GridProcs, MathUnit; { TCompareDistFrm } @@ -140,7 +140,7 @@ procedure TCompareDistFrm.AdjustConstraints; begin Notebook.AutoSize := true; ParamsPanel.Constraints.MinWidth := Max( - 3*CloseBtn.Width + 2*CloseBtn.BorderSpacing.Left, + 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left, Min( CompareGroup.Width * 2 - Var1InBtn.Width + VarList.BorderSpacing.Right, OptionsGroup.Width) @@ -165,7 +165,7 @@ begin // count values in these intervals for j := 1 to NoCases do begin - if not ValidValue(j, AColIndex) then continue; + if not DataProcs.ValidValue(j, AColIndex) then continue; value := StrToFloat(OS3MainFrm.DataGrid.Cells[AColIndex, j]); for k := 0 to ANumIntervals-1 do begin @@ -249,7 +249,7 @@ begin numCases := 0; for j := 1 to NoCases do begin - if not ValidValue(j, AColIndex) then continue; + if not DataProcs.ValidValue(j, AColIndex) then continue; value := StrToFloat(OS3MainFrm.DataGrid.Cells[AColIndex, j]); if value > AMax then AMax := value; if value < AMin then AMin := value; @@ -328,25 +328,19 @@ var C: TWinControl; begin // Get columns of the variables - col1 := 0; - for i := 1 to NoVariables do - if VarOneEdit.Text = OS3MainFrm.DataGrid.Cells[i, 0] then col1 := i; - - col2 := 0; - if CompareTo = ctVariable then - for i := 1 to NoVariables do - if VarTwoEdit.Text = OS3MainFrm.DataGrid.Cells[i, 0] then col2 := i; + col1 := GetVariableIndex(OS3MainFrm.DataGrid, VarOneEdit.Text); + col2 := GetVariableIndex(OS3MainFrm.DataGrid, VarTwoEdit.Text); // Check existence of required variables msg := ''; case CompareTo of ctTheoreticalDistrib: - if col1 = 0 then + if col1 = -1 then msg := 'Variable not specified.'; ctVariable: - if col1 = 0 then + if col1 = -1 then msg := 'Variable One is not specified.' - else if col2 = 0 then + else if col2 = -1 then msg := 'Variable Two is not specified.'; end; if msg <> '' then @@ -583,7 +577,7 @@ procedure TCompareDistFrm.UpdateDF1; AMean := 0; ANumCases := 0; for i := 1 to NoCases do - if ValidValue(i, col) then + if DataProcs.ValidValue(i, col) then begin AMean := AMean + StrToFloat(OS3MainFrm.DataGrid.Cells[col, i]); inc(ANumCases); diff --git a/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.lfm index 5bda8c087..3404925ec 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.lfm @@ -8,6 +8,7 @@ inherited ResistanceLineForm: TResistanceLineForm Caption = 'Resistant Line for Bivariate Data' ClientHeight = 438 ClientWidth = 883 + OnCreate = FormCreate inherited ParamsPanel: TPanel Height = 422 Width = 320 @@ -333,13 +334,13 @@ inherited ResistanceLineForm: TResistanceLineForm Left = 0 Height = 228 Top = 153 - Width = 264 + Width = 276 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Right = 8 Caption = 'Options' ClientHeight = 208 - ClientWidth = 260 + ClientWidth = 272 TabOrder = 7 object ConfLabel: TLabel AnchorSideLeft.Control = OptionsGroup @@ -427,6 +428,7 @@ inherited ResistanceLineForm: TResistanceLineForm Top = 177 Width = 248 BorderSpacing.Left = 12 + BorderSpacing.Right = 12 BorderSpacing.Bottom = 12 Caption = 'Enter Predicted Y and Residual Y in the Grid' TabOrder = 6 @@ -467,7 +469,7 @@ inherited ResistanceLineForm: TResistanceLineForm Left = 12 Height = 12 Top = 46 - Width = 236 + Width = 248 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 12 BorderSpacing.Right = 12 diff --git a/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.pas b/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.pas index 3b887b184..a5134a678 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/resistancelineunit.pas @@ -42,6 +42,7 @@ type Label2: TLabel; Label3: TLabel; Label4: TLabel; + procedure FormCreate(Sender: TObject); procedure PlotMediansChkChange(Sender: TObject); procedure StdCorChkChange(Sender: TObject); procedure VarListDblClick(Sender: TObject); @@ -212,6 +213,12 @@ begin end; +procedure TResistanceLineForm.FormCreate(Sender: TObject); +begin + ConfEdit.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT); +end; + + procedure TResistanceLineForm.PlotMedians(const XMedians, YMedians: DblDyneVec; Aslope, AIntercept: Double); var @@ -380,8 +387,6 @@ end; procedure TResistanceLineForm.Reset; -var - i: integer; begin inherited; @@ -391,10 +396,7 @@ begin XEdit.Text := ''; YEdit.Text := ''; - VarList.Clear; - ConfEdit.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT); - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); UpdateBtnStates; end; diff --git a/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.lfm index 18cd6ce62..59bab741b 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.lfm @@ -25,6 +25,8 @@ inherited StemLeafForm: TStemLeafForm inherited HelpBtn: TButton Tag = 148 Top = 298 + HelpType = htKeyword + HelpKeyword = 'html/StemandLeafPlot.htm' TabOrder = 6 end inherited ButtonBevel: TBevel diff --git a/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.pas b/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.pas index 92457f73e..ce7698add 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/stemleafunit.pas @@ -1,3 +1,7 @@ +{ NOTE: The calculation in this unit is probably in error because the result of + the sample file is different from the one shown in Bill's book with the same + data file. } + unit StemLeafUnit; {$mode objfpc}{$H+} @@ -33,6 +37,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; @@ -100,11 +105,6 @@ var begin noselected := SelectList.Items.Count; - if (noselected = 0) then - begin - ErrorMsg('No variables were selected.'); - exit; - end; SetLength(selected, noselected); SetLength(bins, 100); @@ -352,14 +352,9 @@ begin end; procedure TStemLeafForm.Reset; -var - i: integer; begin inherited; - - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); SelectList.Clear; UpdateBtnStates; end; @@ -406,6 +401,21 @@ begin end; +function TStemLeafForm.Validate(out AMsg: String; out AControl: TWinControl): boolean; +begin + Result := false; + + if SelectList.Items.Count = 0 then + begin + AMsg := 'No variables were selected.'; + AControl := VarList; + exit; + end; + + Result := true; +end; + + procedure TStemLeafForm.VarListDblClick(Sender: TObject); var index: Integer;