LazStats: Refactoring of single-variable part in BlkAnovaUnit, use TAChart. Some corrections in OnCaseAnovaUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7851 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-11-09 17:34:25 +00:00
parent 7c52d4bcc3
commit 5a4cba00bd
6 changed files with 560 additions and 368 deletions

View File

@ -336,7 +336,7 @@
<Unit28>
<Filename Value="forms\analysis\comparisons\blkanovaunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="BlksAnovaFrm"/>
<ComponentName Value="BlksAnovaForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="BlkANOVAUnit"/>

View File

@ -1,7 +1,7 @@
inherited BlksAnovaFrm: TBlksAnovaFrm
Left = 853
inherited BlksAnovaForm: TBlksAnovaForm
Left = 971
Height = 553
Top = 216
Top = 314
Width = 914
HelpType = htKeyword
HelpKeyword = 'html/OneTwoorThreeWayAnalysesofVarian.htm'
@ -485,15 +485,15 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
ClientHeight = 145
ClientWidth = 182
TabOrder = 25
object Scheffe: TCheckBox
object ScheffeChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 138
Caption = 'Scheffe'
Caption = 'ScheffeChk'
TabOrder = 0
end
object TukeyHSD: TCheckBox
object TukeyHSDChk: TCheckBox
Left = 12
Height = 19
Top = 25
@ -501,7 +501,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Tukey HSD (= n''s)'
TabOrder = 1
end
object TukeyB: TCheckBox
object TukeyBChk: TCheckBox
Left = 12
Height = 19
Top = 44
@ -509,7 +509,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Tukey B (= n''s)'
TabOrder = 2
end
object TukeyKramer: TCheckBox
object TukeyKramerChk: TCheckBox
Left = 12
Height = 19
Top = 63
@ -517,7 +517,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Tukey-Kramer'
TabOrder = 3
end
object NewmanKeuls: TCheckBox
object NewmanKeulsChk: TCheckBox
Left = 12
Height = 19
Top = 82
@ -525,7 +525,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Newman-Keuls (= n''s)'
TabOrder = 4
end
object Bonferoni: TCheckBox
object BonferroniChk: TCheckBox
Left = 12
Height = 19
Top = 101
@ -533,7 +533,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Bonferroni'
TabOrder = 5
end
object OrthoContrasts: TCheckBox
object OrthoContrastsChk: TCheckBox
Left = 12
Height = 19
Top = 120
@ -558,7 +558,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
ClientWidth = 192
TabOrder = 26
object Label3: TLabel
AnchorSideTop.Control = OverallAlpha
AnchorSideTop.Control = OverallAlphaEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label4
AnchorSideRight.Side = asrBottom
@ -572,8 +572,8 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Overall Tests'
ParentColor = False
end
object OverallAlpha: TEdit
AnchorSideLeft.Control = PostAlpha
object OverallAlphaEdit: TEdit
AnchorSideLeft.Control = PostAlphaEdit
AnchorSideTop.Control = GroupBox1
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
@ -586,11 +586,11 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
BorderSpacing.Top = 4
BorderSpacing.Right = 8
TabOrder = 0
Text = 'OverallAlpha'
Text = 'OverallAlphaEdit'
end
object Label4: TLabel
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = PostAlpha
AnchorSideTop.Control = PostAlphaEdit
AnchorSideTop.Side = asrCenter
Left = 24
Height = 15
@ -601,12 +601,12 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Caption = 'Post-Hoc Tests:'
ParentColor = False
end
object PostAlpha: TEdit
object PostAlphaEdit: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = OverallAlpha
AnchorSideTop.Control = OverallAlphaEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = OverallAlpha
AnchorSideRight.Control = OverallAlphaEdit
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
@ -618,7 +618,7 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
TabOrder = 1
Text = 'PostAlpha'
Text = 'PostAlphaEdit'
end
end
object Bevel1: TBevel[32]
@ -640,5 +640,16 @@ inherited BlksAnovaFrm: TBlksAnovaFrm
Left = 421
Height = 537
Width = 485
ActivePage = PosthocPage
inherited ReportPage: TTabSheet
Caption = 'ANOVA Results'
end
object PosthocPage: TTabSheet[1]
Caption = 'Post-Hoc'
TabVisible = False
end
inherited ChartPage: TTabSheet[2]
Caption = 'Plots'
end
end
end

View File

@ -516,17 +516,16 @@ inherited OneCaseAnovaForm: TOneCaseAnovaForm
Left = 440
Height = 529
Width = 492
ActivePage = ReportPage
TabIndex = 0
ActivePage = PostHocPage
inherited ReportPage: TTabSheet
Caption = 'ANOVA Results'
end
inherited ChartPage: TTabSheet
Caption = 'Plots'
object PostHocPage: TTabSheet[1]
Caption = 'Post-Hoc'
TabVisible = False
end
object PostHocPage: TTabSheet[2]
Caption = 'Post-Hoc'
inherited ChartPage: TTabSheet[2]
Caption = 'Plots'
TabVisible = False
end
end

View File

@ -376,7 +376,7 @@ begin
NoFactors := 3;
// Get column numbers of dependent variable and factors
SetLength(ColNoSelected, NoFactors + 1); // +1 because DepVar is at Index 0
SetLength(ColNoSelected, NoFactors + 1); // +1 because DepVar is at index 0
ColNoSelected[0] := GetVariableIndex(OS3MainFrm.DataGrid, DepVarEdit.Text);
ColNoSelected[1] := GetVariableIndex(OS3MainFrm.DataGrid, Factor1Edit.Text);
ColNoSelected[2] := GetVariableIndex(OS3MainFrm.DataGrid, Factor2Edit.Text);
@ -785,6 +785,8 @@ begin
FChartFrame.Chart.BottomAxis.Marks.Source := FSeries.Source;
FChartFrame.Chart.BottomAxis.Marks.Style := smsLabel;
FChartFrame.Chart.Legend.Visible := FSeries.Source.YCount > 1;
FChartFrame.UpdateBtnStates;
end;
@ -797,7 +799,7 @@ begin
end;
FChartFrame.Clear; // this destroys the series
FChartFrame.SetYTitle('Means');
FChartFrame.SetYTitle('Mean');
FSeries := FChartFrame.PlotXY(ptBars, nil, nil, nil, nil, '', DATA_COLORS[0]);
with TBarSeries(FSeries) do
begin
@ -1408,6 +1410,8 @@ begin
FChartFrame.Chart.BottomAxis.Marks.Source := FSeries.Source;
FChartFrame.Chart.BottomAxis.Marks.Style := smsLabel;
FChartFrame.Chart.Legend.Visible := FSeries.Source.YCount > 1;
FChartFrame.UpdateBtnStates;
end;
@ -1958,7 +1962,10 @@ var
lSelected: Boolean;
begin
inherited;
if FPosthocReportFrame <> nil then
FPostHocReportFrame.UpdateBtnStates;
lSelected := false;
for i:=0 to VarList.Items.Count-1 do
if VarList.Selected[i] then

View File

@ -1830,9 +1830,9 @@ end;
// Menu "Analysis" > "Comparisons" > "1,2 or 3 Way ANOVAs"
procedure TOS3MainFrm.mnuAnalysisComp_AnovaClick(Sender: TObject);
begin
if BlksAnovaFrm = nil then
Application.CreateForm(TBlksAnovaFrm, BlksAnovaFrm);
BlksAnovaFrm.ShowModal;
if BlksAnovaForm = nil then
Application.CreateForm(TBlksAnovaForm, BlksAnovaForm);
BlksAnovaForm.Show;
end;
// Menu "Analysis" > "Comparisons" > "A x B x S Anova"
@ -1859,7 +1859,7 @@ begin
AxSAnovaFrm.ShowModal;
end;
// Menu "Analysis" > "Comparisons" > "B Nested in A mnuAnalysisComp_Anova"
// Menu "Analysis" > "Comparisons" > "B Nested in A Anova"
procedure TOS3MainFrm.mnuAnalysisComp_BinAClick(Sender: TObject);
begin
if BNestedAForm = nil then
@ -1883,7 +1883,7 @@ begin
LatinSqrsFrm.ShowModal;
end;
// Menu "Analysis" > "Comparisons" > "ABC mnuAnalysisComp_Anova with B Nested in A"
// Menu "Analysis" > "Comparisons" > "ABC Anova with B Nested in A"
procedure TOS3MainFrm.mnuAnalysisComp_NestedABCClick(Sender: TObject);
begin
if ABCNestedForm = nil then
@ -1891,7 +1891,7 @@ begin
ABCNestedForm.ShowModal;
end;
// Menu "Analysis" > "Comparisons" > "2 or 3 Way mnuAnalysisComp_Anova with One Case Per Cell"
// Menu "Analysis" > "Comparisons" > "2 or 3 Way Anova with One Case Per Cell"
procedure TOS3MainFrm.mnuAnalysisComp_OneCaseAnovaClick(Sender: TObject);
begin
if OneCaseAnovaForm = nil then