LazStats: Fine-tuning and updating of chm help of MultXvsYUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8024 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-05-10 21:02:08 +00:00
parent 6740602d6c
commit 9a4ebebaa1
7 changed files with 51 additions and 49 deletions

Binary file not shown.

View File

@ -297,7 +297,7 @@
<Unit23> <Unit23>
<Filename Value="forms\analysis\descriptive\multxvsyunit.pas"/> <Filename Value="forms\analysis\descriptive\multxvsyunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="MultXvsYFrm"/> <ComponentName Value="MultXvsYForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="MultXvsYUnit"/> <UnitName Value="MultXvsYUnit"/>

View File

@ -1,27 +1,38 @@
inherited MultXvsYFrm: TMultXvsYFrm inherited MultXvsYForm: TMultXvsYForm
Height = 382
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/MultipleGroupXVersusYPlot.htm' HelpKeyword = 'html/MultipleGroupXVersusYPlot.htm'
Caption = 'Multiple X Versus Y Plot' Caption = 'Multiple X Versus Y Plot'
ClientHeight = 382
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Height = 366
Width = 344 Width = 344
ClientHeight = 366
ClientWidth = 344 ClientWidth = 344
inherited CloseBtn: TButton inherited CloseBtn: TButton
Left = 289 Left = 289
Top = 341
TabOrder = 15 TabOrder = 15
end end
inherited ComputeBtn: TButton inherited ComputeBtn: TButton
Left = 205 Left = 205
Top = 341
TabOrder = 14 TabOrder = 14
end end
inherited ResetBtn: TButton inherited ResetBtn: TButton
Left = 143 Left = 143
Top = 341
TabOrder = 13 TabOrder = 13
end end
inherited HelpBtn: TButton inherited HelpBtn: TButton
Left = 84 Left = 84
Top = 341
HelpType = htKeyword
HelpKeyword = 'html/MultipleGroupXVersusYPlot.htm'
TabOrder = 12 TabOrder = 12
end end
inherited ButtonBevel: TBevel inherited ButtonBevel: TBevel
Top = 325
Width = 344 Width = 344
end end
object Label5: TLabel[5] object Label5: TLabel[5]
@ -30,7 +41,7 @@ inherited MultXvsYFrm: TMultXvsYFrm
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 0 Left = 0
Height = 15 Height = 15
Top = 374 Top = 306
Width = 46 Width = 46
Caption = 'Plot Title' Caption = 'Plot Title'
ParentColor = False ParentColor = False
@ -42,7 +53,7 @@ inherited MultXvsYFrm: TMultXvsYFrm
AnchorSideBottom.Control = ButtonBevel AnchorSideBottom.Control = ButtonBevel
Left = 54 Left = 54
Height = 23 Height = 23
Top = 370 Top = 302
Width = 290 Width = 290
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
@ -63,9 +74,10 @@ inherited MultXvsYFrm: TMultXvsYFrm
AnchorSideTop.Control = Label1 AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = XInBtn AnchorSideRight.Control = XInBtn
AnchorSideBottom.Control = OptionsGroup
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 309 Height = 277
Top = 17 Top = 17
Width = 153 Width = 153
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -178,7 +190,7 @@ inherited MultXvsYFrm: TMultXvsYFrm
AnchorSideBottom.Control = LabelEdit AnchorSideBottom.Control = LabelEdit
Left = 159 Left = 159
Height = 49 Height = 49
Top = 313 Top = 245
Width = 182 Width = 182
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
@ -295,9 +307,11 @@ inherited MultXvsYFrm: TMultXvsYFrm
end end
inherited ParamsSplitter: TSplitter inherited ParamsSplitter: TSplitter
Left = 356 Left = 356
Height = 382
end end
inherited PageControl: TPageControl inherited PageControl: TPageControl
Left = 365 Left = 365
Height = 366
Width = 343 Width = 343
end end
end end

View File

@ -14,9 +14,9 @@ uses
type type
{ TMultXvsYFrm } { TMultXvsYForm }
TMultXvsYFrm = class(TBasicStatsReportAndChartForm) TMultXvsYForm = class(TBasicStatsReportAndChartForm)
XInBtn: TBitBtn; XInBtn: TBitBtn;
XOutBtn: TBitBtn; XOutBtn: TBitBtn;
YInBtn: TBitBtn; YInBtn: TBitBtn;
@ -59,7 +59,7 @@ type
end; end;
var var
MultXvsYFrm: TMultXvsYFrm; MultXvsYForm: TMultXvsYForm;
implementation implementation
@ -67,18 +67,18 @@ implementation
uses uses
TATypes, TATypes,
Math, Utils, MatrixUnit; Math, Utils, MatrixUnit, GridProcs;
{ TMultXvsYFrm } { TMultXvsYForm }
constructor TMultXvsYFrm.Create(AOwner: TComponent); constructor TMultXvsYForm.Create(AOwner: TComponent);
begin begin
inherited; inherited;
end; end;
procedure TMultXvsYFrm.AdjustConstraints; procedure TMultXvsYForm.AdjustConstraints;
begin begin
ParamsPanel.Constraints.MinWidth := Max( ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left, 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
@ -89,11 +89,10 @@ begin
end; end;
procedure TMultXvsYFrm.Compute; procedure TMultXvsYForm.Compute;
var var
i, N, xCol, yCol, grpCol, grp, numGrps: integer; i, N, xCol, yCol, grpCol, grp, numGrps: integer;
grpName: String; grpName: String;
//minX, maxX, minY, maxY,
X, Y: double; X, Y: double;
cellstring: string; cellstring: string;
numInGrp: IntDyneVec = nil; numInGrp: IntDyneVec = nil;
@ -109,17 +108,10 @@ begin
SetLength(stdDevs, 2); SetLength(stdDevs, 2);
// Get selected variables // Get selected variables
xCol := 0; xCol := GetVariableIndex(OS3MainFrm.DataGrid, XEdit.Text);
yCol := 0; yCol := GetVariableIndex(OS3MainFrm.DataGrid, YEdit.Text);
grpCol := 0; grpCol := GetVariableIndex(OS3MainFrm.DataGrid, GroupEdit.Text);
for i := 1 to NoVariables do if (xCol = -1) or (yCol = -1) or (grpCol = -1) then
begin
cellstring := OS3MainFrm.DataGrid.Cells[i, 0];
if (cellstring = XEdit.Text) then xCol := i;
if (cellstring = YEdit.Text) then yCol := i;
if (cellstring = GroupEdit.Text) then grpCol := i;
end;
if (xCol = 0) or (yCol = 0) or (grpCol = 0) then
begin begin
ErrorMsg('No variable selected.'); ErrorMsg('No variable selected.');
exit; exit;
@ -152,7 +144,7 @@ begin
N := 0; N := 0;
for i := 1 to NoCases do for i := 1 to NoCases do
begin begin
if not GoodRecord(i, Length(selected), selected) then continue; if not GoodRecord(OS3MainFrm.Datagrid, i, selected) then continue;
inc(N); inc(N);
X := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol, i]); X := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol, i]);
@ -199,7 +191,7 @@ begin
end; end;
procedure TMultXvsYFrm.GroupInBtnClick(Sender: TObject); procedure TMultXvsYForm.GroupInBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@ -213,7 +205,7 @@ begin
end; end;
procedure TMultXvsYFrm.GroupOutBtnClick(Sender: TObject); procedure TMultXvsYForm.GroupOutBtnClick(Sender: TObject);
begin begin
if GroupEdit.Text <> '' then if GroupEdit.Text <> '' then
begin begin
@ -227,7 +219,7 @@ end;
// Routine to plot X versus multiple Y values for several groups // Routine to plot X versus multiple Y values for several groups
// Layout of X and Y matrices: // Layout of X and Y matrices:
// 1st index: group index, 2nd index: point index within group // 1st index: group index, 2nd index: point index within group
procedure TMultXvsYFrm.PlotXY(const XValues, YValues: DblDyneMat; procedure TMultXvsYForm.PlotXY(const XValues, YValues: DblDyneMat;
const Groups: StrDyneVec); const Groups: StrDyneVec);
var var
pt: TPlotType; pt: TPlotType;
@ -255,25 +247,20 @@ begin
end; end;
procedure TMultXvsYFrm.Reset; procedure TMultXvsYForm.Reset;
var
i: integer;
begin begin
inherited; inherited;
VarList.Clear; CollectVariableNames(OS3MainFrm.DataGrid, varList.Items);
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
XEdit.Text := ''; XEdit.Text := '';
YEdit.Text := ''; YEdit.Text := '';
GroupEdit.Text := ''; GroupEdit.Text := '';
LinesChk.Checked := false;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TMultXvsYFrm.VarListDblClick(Sender: TObject); procedure TMultXvsYForm.VarListDblClick(Sender: TObject);
var var
index: Integer; index: Integer;
begin begin
@ -292,7 +279,7 @@ begin
end; end;
procedure TMultXvsYFrm.UpdateBtnStates; procedure TMultXvsYForm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
i: Integer; i: Integer;
@ -316,13 +303,13 @@ begin
end; end;
procedure TMultXvsYFrm.VarListSelectionChange(Sender: TObject; User: boolean); procedure TMultXvsYForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TMultXVsYFrm.WriteToReport(const AMeans, AStdDevs: DblDyneVec); procedure TMultXvsYForm.WriteToReport(const AMeans, AStdDevs: DblDyneVec);
var var
lReport: TStrings; lReport: TStrings;
begin begin
@ -348,7 +335,7 @@ begin
end; end;
procedure TMultXvsYFrm.XInBtnClick(Sender: TObject); procedure TMultXvsYForm.XInBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@ -362,7 +349,7 @@ begin
end; end;
procedure TMultXvsYFrm.XOutBtnClick(Sender: TObject); procedure TMultXvsYForm.XOutBtnClick(Sender: TObject);
begin begin
if XEdit.Text <> '' then if XEdit.Text <> '' then
begin begin
@ -373,7 +360,7 @@ begin
end; end;
procedure TMultXvsYFrm.YInBtnClick(Sender: TObject); procedure TMultXvsYForm.YInBtnClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
@ -387,7 +374,7 @@ begin
end; end;
procedure TMultXvsYFrm.YOutBtnClick(Sender: TObject); procedure TMultXvsYForm.YOutBtnClick(Sender: TObject);
begin begin
if YEdit.Text <> '' then if YEdit.Text <> '' then
begin begin

View File

@ -1998,9 +1998,9 @@ end;
//Menu "Analysis" > "Descriptive" > "Multiple Group X vs Y Plot" //Menu "Analysis" > "Descriptive" > "Multiple Group X vs Y Plot"
procedure TOS3MainFrm.mnuAnalysisDescr_MultXvsYClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisDescr_MultXvsYClick(Sender: TObject);
begin begin
if MultXvsYFrm = nil then if MultXvsYForm = nil then
Application.CreateForm(TMultXvsYFrm, MultXvsYFrm); Application.CreateForm(TMultXvsYForm, MultXvsYForm);
MultXvsYFrm.Show; MultXvsYForm.Show;
end; end;
// Menu "Analysis" > "Descriptive" > "Normality Tests" // Menu "Analysis" > "Descriptive" > "Normality Tests"

View File

@ -158,7 +158,8 @@ end;
Probability = 0 ... 1 --> Result = -INF ... +INF Probability = 0 ... 1 --> Result = -INF ... +INF
Algorithm by Peter John Acklam. Algorithm by Peter John Acklam.
http://home.online.no/~pjacklam/notes/invnorm/index.html } http://home.online.no/~pjacklam/notes/invnorm/index.html --- no longer valid!
https://stackedboxes.org/2017/05/01/acklams-normal-quantile-function/ }
function InverseNormalDist(Probability: Double): Double; function InverseNormalDist(Probability: Double): Double;
const const
A: array[1..6] of Double = ( A: array[1..6] of Double = (