From 64e8d40df99a6003dafa22d4221bf66e19d78c23 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 6 Nov 2020 23:33:13 +0000 Subject: [PATCH] LazStats: Inherit OneCaseAnovaUnit from TBasicStatsReportAndChartForm git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7847 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../analysis/comparisons/onecaseanovaunit.lfm | 879 ++++++++---------- .../analysis/comparisons/onecaseanovaunit.pas | 386 ++++---- .../lazstats/source/forms/mainunit.pas | 4 +- 3 files changed, 601 insertions(+), 668 deletions(-) diff --git a/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.lfm b/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.lfm index 0c98f3bfb..f48c9e130 100644 --- a/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.lfm +++ b/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.lfm @@ -1,300 +1,224 @@ -object OneCaseAnovaForm: TOneCaseAnovaForm - Left = 694 - Height = 458 - Top = 246 - Width = 567 +inherited OneCaseAnovaForm: TOneCaseAnovaForm + Left = 616 + Height = 545 + Top = 235 + Width = 940 HelpType = htKeyword HelpKeyword = 'html/TwoorThreeWayFixedANOVAwith1Case.htm' - AutoSize = True - Caption = 'OneCaseAnovaForm' - ClientHeight = 458 - ClientWidth = 567 - OnActivate = FormActivate - OnCreate = FormCreate - OnShow = FormShow - Position = poMainFormCenter - LCLVersion = '2.1.0.0' - object GroupBox1: TGroupBox - AnchorSideLeft.Control = PlotOptionsBox - AnchorSideTop.Control = PlotOptionsBox - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = PlotOptionsBox - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = OverAllAlpha - Left = 364 - Height = 135 - Top = 146 - Width = 195 - Anchors = [akTop, akLeft, akRight] - AutoSize = True - BorderSpacing.Top = 16 - BorderSpacing.Bottom = 8 - Caption = 'Post-Hoc Comparisons:' - ChildSizing.LeftRightSpacing = 12 - ChildSizing.TopBottomSpacing = 6 - ChildSizing.VerticalSpacing = 2 - ChildSizing.EnlargeHorizontal = crsHomogenousChildResize - ChildSizing.EnlargeVertical = crsHomogenousChildResize - ChildSizing.ShrinkHorizontal = crsHomogenousChildResize - ChildSizing.ShrinkVertical = crsHomogenousChildResize - ChildSizing.Layout = cclLeftToRightThenTopToBottom - ChildSizing.ControlsPerLine = 1 - ClientHeight = 115 - ClientWidth = 191 - TabOrder = 2 - object ScheffeChk: TCheckBox - Left = 12 - Height = 19 - Top = 6 - Width = 167 - Caption = 'ScheffeChk' - TabOrder = 0 + Caption = 'One Case ANOVA' + ClientHeight = 545 + ClientWidth = 940 + inherited ParamsPanel: TPanel + Height = 529 + Width = 401 + ClientHeight = 529 + ClientWidth = 401 + inherited CloseBtn: TButton + Left = 346 + Top = 504 end - object TukeyHSDChk: TCheckBox - Left = 12 - Height = 19 - Top = 27 - Width = 167 - Caption = 'Tukey HSD (= n''s)' - TabOrder = 1 + inherited ComputeBtn: TButton + Left = 262 + Top = 504 end - object TukeyBChk: TCheckBox - Left = 12 - Height = 19 - Top = 48 - Width = 167 - Caption = 'Tukey B (= n''s)' - TabOrder = 2 + inherited ResetBtn: TButton + Left = 200 + Top = 504 end - object TukeyKramerChk: TCheckBox - Left = 12 - Height = 19 - Top = 69 - Width = 167 - Caption = 'Tukey-Kramer' - TabOrder = 3 + inherited HelpBtn: TButton + Tag = 107 + Left = 141 + Top = 504 end - object NewmanKeulsChk: TCheckBox - Left = 12 - Height = 19 - Top = 90 - Width = 167 - Caption = 'Newman-Keuls (= n''s)' + inherited ButtonBevel: TBevel + Top = 488 + Width = 401 + end + object Label3: TLabel[5] + AnchorSideTop.Control = OverAllAlphaEdit + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = OverAllAlphaEdit + Left = 263 + Height = 30 + Top = 297 + Width = 79 + Alignment = taRightJustify + Anchors = [akTop, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Right = 8 + Caption = 'Alpha Level for'#13#10'Overall Tests' + ParentColor = False + end + object OverAllAlphaEdit: TEdit[6] + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Factor3Edit + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Factor3Edit + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ButtonBevel + Left = 350 + Height = 23 + Top = 301 + Width = 51 + Alignment = taRightJustify + Anchors = [akTop, akRight] + BorderSpacing.Top = 24 TabOrder = 4 + Text = 'OverAllAlphaEdit' end - end - object Label3: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = OverAllAlpha - AnchorSideTop.Side = asrCenter - AnchorSideRight.Control = OverAllAlpha - Left = 8 - Height = 15 - Top = 390 - Width = 147 - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - Caption = 'Alpha Level for Overall Tests' - ParentColor = False - end - object OverAllAlpha: TEdit - AnchorSideLeft.Control = Label3 - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PostAlpha - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Bevel1 - Left = 163 - Height = 23 - Top = 386 - Width = 51 - Alignment = taRightJustify - Anchors = [akLeft, akBottom] - TabOrder = 4 - Text = 'OverAllAlpha' - end - object Label4: TLabel - AnchorSideLeft.Control = OverAllAlpha - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = PostAlpha - AnchorSideTop.Side = asrCenter - AnchorSideRight.Control = PostAlpha - Left = 238 - Height = 15 - Top = 390 - Width = 163 - BorderSpacing.Left = 24 - BorderSpacing.Right = 8 - Caption = 'Alpha Level for Post-Hoc Tests:' - ParentColor = False - end - object PostAlpha: TEdit - AnchorSideLeft.Control = Label4 - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Side = asrCenter - AnchorSideBottom.Control = Bevel1 - Left = 409 - Height = 23 - Top = 386 - Width = 51 - Alignment = taRightJustify - Anchors = [akLeft, akBottom] - BorderSpacing.Left = 8 - TabOrder = 5 - Text = 'PostAlpha' - end - object HelpBtn: TButton - Tag = 107 - AnchorSideRight.Control = ResetBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 295 - Height = 25 - Top = 425 - Width = 51 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 12 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Help' - OnClick = HelpBtnClick - TabOrder = 6 - end - object ResetBtn: TButton - AnchorSideRight.Control = ComputeBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 354 - Height = 25 - Top = 425 - Width = 54 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Reset' - OnClick = ResetBtnClick - TabOrder = 7 - end - object ComputeBtn: TButton - AnchorSideRight.Control = CloseBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 416 - Height = 25 - Top = 425 - Width = 76 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Compute' - OnClick = ComputeBtnClick - TabOrder = 8 - end - object CloseBtn: TButton - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 500 - Height = 25 - Top = 425 - Width = 55 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Close' - ModalResult = 11 - TabOrder = 9 - end - object Bevel1: TBevel - AnchorSideLeft.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = CloseBtn - Left = 0 - Height = 8 - Top = 409 - Width = 567 - Anchors = [akLeft, akRight, akBottom] - Shape = bsBottomLine - end - object InteractBtn: TCheckBox - AnchorSideLeft.Control = GroupBox1 - AnchorSideTop.Control = GroupBox1 - AnchorSideTop.Side = asrBottom - Left = 380 - Height = 19 - Top = 297 - Width = 103 - BorderSpacing.Left = 16 - BorderSpacing.Top = 16 - BorderSpacing.Bottom = 8 - Caption = 'Get Interactions' - TabOrder = 3 - end - object PlotOptionsBox: TRadioGroup - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 364 - Height = 114 - Top = 16 - Width = 195 - Anchors = [akTop, akRight] - AutoFill = True - AutoSize = True - BorderSpacing.Left = 16 - BorderSpacing.Top = 16 - BorderSpacing.Right = 8 - Caption = 'Plot Options' - ChildSizing.LeftRightSpacing = 12 - ChildSizing.TopBottomSpacing = 6 - ChildSizing.VerticalSpacing = 2 - ChildSizing.EnlargeHorizontal = crsHomogenousChildResize - ChildSizing.EnlargeVertical = crsHomogenousChildResize - ChildSizing.ShrinkHorizontal = crsScaleChilds - ChildSizing.ShrinkVertical = crsScaleChilds - ChildSizing.Layout = cclLeftToRightThenTopToBottom - ChildSizing.ControlsPerLine = 1 - ClientHeight = 94 - ClientWidth = 191 - ItemIndex = 0 - Items.Strings = ( - 'no plot' - 'Plot with Vertical 3D Bars' - 'Plot with Vertical 2D Bars' - 'Plot with Horizontal 2D Bars' - ) - TabOrder = 1 - end - object Panel1: TPanel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Owner - AnchorSideRight.Control = PlotOptionsBox - AnchorSideBottom.Control = OverAllAlpha - Left = 8 - Height = 370 - Top = 8 - Width = 340 - Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Bottom = 8 - BevelOuter = bvNone - ClientHeight = 370 - ClientWidth = 340 - TabOrder = 0 - object Label1: TLabel - AnchorSideLeft.Control = Panel1 - AnchorSideTop.Control = Panel1 + object Label4: TLabel[7] + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = PostAlphaEdit + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = PostAlphaEdit + Left = 58 + Height = 15 + Top = 469 + Width = 163 + Anchors = [akTop, akRight] + BorderSpacing.Left = 24 + BorderSpacing.Right = 8 + Caption = 'Alpha Level for Post-Hoc Tests:' + ParentColor = False + end + object PostAlphaEdit: TEdit[8] + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = PostHocGroup + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ButtonBevel + Left = 229 + Height = 23 + Top = 465 + Width = 51 + Alignment = taRightJustify + Anchors = [akRight, akBottom] + BorderSpacing.Left = 8 + TabOrder = 5 + Text = 'PostAlphaEdit' + end + object PostHocGroup: TGroupBox[9] + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = PlotOptionsGroup + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = PostAlphaEdit + Left = 0 + Height = 93 + Top = 364 + Width = 280 + Anchors = [akLeft, akBottom] + AutoSize = True + BorderSpacing.Top = 16 + BorderSpacing.Bottom = 8 + Caption = 'Post-Hoc Comparisons:' + ChildSizing.LeftRightSpacing = 12 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.VerticalSpacing = 2 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsHomogenousChildResize + ChildSizing.ShrinkVertical = crsHomogenousChildResize + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 2 + ClientHeight = 73 + ClientWidth = 276 + TabOrder = 6 + object ScheffeChk: TCheckBox + Left = 12 + Height = 19 + Top = 6 + Width = 138 + Caption = 'ScheffeChk' + TabOrder = 0 + end + object TukeyHSDChk: TCheckBox + Left = 150 + Height = 19 + Top = 6 + Width = 114 + Caption = 'Tukey HSD (= n''s)' + TabOrder = 1 + end + object TukeyBChk: TCheckBox + Left = 12 + Height = 19 + Top = 27 + Width = 138 + Caption = 'Tukey B (= n''s)' + TabOrder = 2 + end + object TukeyKramerChk: TCheckBox + Left = 150 + Height = 19 + Top = 27 + Width = 114 + Caption = 'Tukey-Kramer' + TabOrder = 3 + end + object NewmanKeulsChk: TCheckBox + Left = 12 + Height = 19 + Top = 48 + Width = 138 + Caption = 'Newman-Keuls (= n''s)' + TabOrder = 4 + end + end + object InteractChk: TCheckBox[10] + AnchorSideTop.Control = OverAllAlphaEdit + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = OverAllAlphaEdit + AnchorSideRight.Side = asrBottom + Left = 298 + Height = 19 + Top = 332 + Width = 103 + Alignment = taLeftJustify + Anchors = [akTop, akRight] + BorderSpacing.Left = 16 + BorderSpacing.Top = 8 + BorderSpacing.Bottom = 8 + Caption = 'Get Interactions' + TabOrder = 7 + end + object PlotOptionsGroup: TRadioGroup[11] + AnchorSideLeft.Control = PostHocGroup + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = PostHocGroup + AnchorSideRight.Side = asrBottom + Left = 296 + Height = 114 + Top = 364 + Width = 145 + AutoFill = True + AutoSize = True + BorderSpacing.Left = 16 + BorderSpacing.Right = 8 + Caption = 'Plot Options' + ChildSizing.LeftRightSpacing = 12 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.VerticalSpacing = 2 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 94 + ClientWidth = 141 + ItemIndex = 0 + Items.Strings = ( + 'no plot' + 'Vertical 3D Bars' + 'Vertical 2D Bars' + 'Horizontal 2D Bars' + ) + TabOrder = 8 + end + object Label1: TLabel[12] + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = ParamsPanel Left = 0 Height = 15 Top = 0 @@ -302,284 +226,283 @@ object OneCaseAnovaForm: TOneCaseAnovaForm Caption = 'Variables:' ParentColor = False end - object VarList: TListBox - AnchorSideLeft.Control = Panel1 + object VarList: TListBox[13] + AnchorSideLeft.Control = ParamsPanel AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom AnchorSideRight.Control = DepIn - AnchorSideBottom.Control = Panel1 - AnchorSideBottom.Side = asrBottom + AnchorSideBottom.Control = PostHocGroup Left = 0 - Height = 353 + Height = 331 Top = 17 - Width = 187 + Width = 181 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 2 - BorderSpacing.Right = 8 + BorderSpacing.Right = 6 ItemHeight = 0 + OnDblClick = VarListDblClick OnSelectionChange = VarListSelectionChange - TabOrder = 0 + TabOrder = 9 end - object DepIn: TBitBtn - AnchorSideLeft.Control = Bevel2 - AnchorSideLeft.Side = asrBottom + object DepIn: TBitBtn[14] + AnchorSideLeft.Control = ParamsPanel + AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = VarList - Left = 195 - Height = 28 + Left = 187 + Height = 26 Top = 17 - Width = 28 + Width = 26 Images = MainDataModule.ImageList ImageIndex = 1 OnClick = DepInClick Spacing = 0 - TabOrder = 1 + TabOrder = 10 end - object StaticText1: TStaticText + object DepOut: TBitBtn[15] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = DepIn + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 47 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = DepOutClick + Spacing = 0 + TabOrder = 11 + end + object Fact1In: TBitBtn[16] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = DepOut + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 89 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = Fact1InClick + Spacing = 0 + TabOrder = 12 + end + object Fact1Out: TBitBtn[17] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = Fact1In + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 119 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = Fact1OutClick + Spacing = 0 + TabOrder = 13 + end + object Fact2In: TBitBtn[18] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = Fact1Out + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 161 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = Fact2InClick + Spacing = 0 + TabOrder = 14 + end + object Fact2Out: TBitBtn[19] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = Fact2In + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 191 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = Fact2OutClick + Spacing = 0 + TabOrder = 15 + end + object Fact3In: TBitBtn[20] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = Fact2Out + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 233 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = Fact3InClick + Spacing = 0 + TabOrder = 16 + end + object Fact3Out: TBitBtn[21] + AnchorSideLeft.Control = DepIn + AnchorSideTop.Control = Fact3In + AnchorSideTop.Side = asrBottom + Left = 187 + Height = 26 + Top = 263 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = Fact3OutClick + Spacing = 0 + TabOrder = 17 + end + object StaticText1: TStaticText[22] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideBottom.Control = DepVar - Left = 231 + AnchorSideBottom.Control = DepVarEdit + Left = 221 Height = 16 - Top = 24 + Top = 20 Width = 103 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Left = 8 BorderSpacing.Bottom = 2 Caption = 'Dependent Variable' - TabOrder = 3 + TabOrder = 18 end - object DepOut: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = DepIn - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 49 - Width = 28 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = DepOutClick - Spacing = 0 - TabOrder = 2 - end - object Fact1In: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = DepOut - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 101 - Width = 28 - BorderSpacing.Top = 24 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = Fact1InClick - Spacing = 0 - TabOrder = 5 - end - object Fact1Out: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = Fact1In - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 133 - Width = 28 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = Fact1OutClick - Spacing = 0 - TabOrder = 6 - end - object Fact2In: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = Fact1Out - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 185 - Width = 28 - BorderSpacing.Top = 24 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = Fact2InClick - Spacing = 0 - TabOrder = 9 - end - object Fact2Out: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = Fact2In - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 217 - Width = 28 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = Fact2OutClick - Spacing = 0 - TabOrder = 10 - end - object StaticText2: TStaticText + object DepVarEdit: TEdit[23] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideBottom.Control = Factor1 - Left = 231 + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = DepOut + AnchorSideBottom.Side = asrBottom + Left = 221 + Height = 23 + Top = 38 + Width = 180 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + ReadOnly = True + TabOrder = 19 + Text = 'DepVarEdit' + end + object StaticText2: TStaticText[24] + AnchorSideLeft.Control = DepIn + AnchorSideLeft.Side = asrBottom + AnchorSideBottom.Control = Factor1Edit + Left = 221 Height = 16 - Top = 108 + Top = 92 Width = 87 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Left = 8 BorderSpacing.Bottom = 2 Caption = 'Factor 1 Variable' - TabOrder = 7 + TabOrder = 20 end - object Factor1: TEdit + object Factor1Edit: TEdit[25] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Fact1Out AnchorSideBottom.Side = asrBottom - Left = 231 + Left = 221 Height = 23 - Top = 126 - Width = 109 + Top = 110 + Width = 180 Anchors = [akLeft, akRight, akBottom] BorderSpacing.Left = 8 BorderSpacing.Bottom = 12 ReadOnly = True - TabOrder = 8 - Text = 'Edit1' + TabOrder = 21 + Text = 'Factor1Edit' end - object StaticText3: TStaticText + object StaticText3: TStaticText[26] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideBottom.Control = Factor2 - Left = 231 + AnchorSideBottom.Control = Factor2Edit + Left = 221 Height = 16 - Top = 192 + Top = 164 Width = 87 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Left = 8 BorderSpacing.Bottom = 2 Caption = 'Factor 2 Variable' - TabOrder = 11 + TabOrder = 22 end - object Factor2: TEdit + object Factor2Edit: TEdit[27] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Fact2Out AnchorSideBottom.Side = asrBottom - Left = 231 + Left = 221 Height = 23 - Top = 210 - Width = 109 + Top = 182 + Width = 180 Anchors = [akLeft, akRight, akBottom] BorderSpacing.Left = 8 BorderSpacing.Bottom = 12 ReadOnly = True - TabOrder = 12 - Text = 'Edit1' + TabOrder = 23 + Text = 'Factor2Edit' end - object Fact3In: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = Fact2Out - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 269 - Width = 28 - BorderSpacing.Top = 24 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = Fact3InClick - Spacing = 0 - TabOrder = 13 - end - object Fact3Out: TBitBtn - AnchorSideLeft.Control = DepIn - AnchorSideTop.Control = Fact3In - AnchorSideTop.Side = asrBottom - Left = 195 - Height = 28 - Top = 301 - Width = 28 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = Fact3OutClick - Spacing = 0 - TabOrder = 14 - end - object StaticText4: TStaticText + object StaticText4: TStaticText[28] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideBottom.Control = Factor3 - Left = 231 + AnchorSideBottom.Control = Factor3Edit + Left = 221 Height = 16 - Top = 276 + Top = 236 Width = 72 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Left = 8 BorderSpacing.Bottom = 2 Caption = 'Factor 3 Clark' - TabOrder = 15 + TabOrder = 24 end - object Factor3: TEdit + object Factor3Edit: TEdit[29] AnchorSideLeft.Control = DepIn AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Fact3Out AnchorSideBottom.Side = asrBottom - Left = 231 + Left = 221 Height = 23 - Top = 294 - Width = 109 + Top = 254 + Width = 180 Anchors = [akLeft, akRight, akBottom] BorderSpacing.Left = 8 BorderSpacing.Bottom = 12 ReadOnly = True - TabOrder = 16 - Text = 'Edit1' - end - object DepVar: TEdit - AnchorSideLeft.Control = DepIn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = DepOut - AnchorSideBottom.Side = asrBottom - Left = 231 - Height = 23 - Top = 42 - Width = 109 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - ReadOnly = True - TabOrder = 4 - Text = 'DepVar' - end - object Bevel2: TBevel - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = Panel1 - Left = 145 - Height = 17 - Top = 0 - Width = 50 - Shape = bsSpacer + TabOrder = 25 + Text = 'Factor3Edit' end end + inherited ParamsSplitter: TSplitter + Left = 413 + Height = 545 + end + inherited PageControl: TPageControl + Left = 422 + Height = 529 + Width = 510 + end end diff --git a/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.pas b/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.pas index 294f0297f..8fd0230ed 100644 --- a/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.pas +++ b/applications/lazstats/source/forms/analysis/comparisons/onecaseanovaunit.pas @@ -5,44 +5,37 @@ unit OneCaseANOVAUnit; interface uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls, - MainUnit, Globals, OutputUnit, DataProcs, GraphLib, - ANOVATestsUnit, contexthelpunit; + MainUnit, Globals, DataProcs, GraphLib, + ANOVATestsUnit, BasicStatsReportAndChartFormUnit; type { TOneCaseAnovaForm } - TOneCaseAnovaForm = class(TForm) - Bevel1: TBevel; - Bevel2: TBevel; - ComputeBtn: TButton; + TOneCaseAnovaForm = class(TBasicStatsReportAndChartForm) DepIn: TBitBtn; DepOut: TBitBtn; - DepVar: TEdit; + DepVarEdit: TEdit; Fact1In: TBitBtn; Fact1Out: TBitBtn; Fact2In: TBitBtn; Fact2Out: TBitBtn; Fact3In: TBitBtn; Fact3Out: TBitBtn; - Factor1: TEdit; - Factor2: TEdit; - Factor3: TEdit; - GroupBox1: TGroupBox; - InteractBtn: TCheckBox; - HelpBtn: TButton; + Factor1Edit: TEdit; + Factor2Edit: TEdit; + Factor3Edit: TEdit; + PostHocGroup: TGroupBox; + InteractChk: TCheckBox; Label1: TLabel; Label3: TLabel; Label4: TLabel; NewmanKeulsChk: TCheckBox; - OverAllAlpha: TEdit; - Panel1: TPanel; - PostAlpha: TEdit; - PlotOptionsBox: TRadioGroup; - ResetBtn: TButton; - CloseBtn: TButton; + OverAllAlphaEdit: TEdit; + PostAlphaEdit: TEdit; + PlotOptionsGroup: TRadioGroup; ScheffeChk: TCheckBox; StaticText1: TStaticText; StaticText2: TStaticText; @@ -52,7 +45,6 @@ type TukeyHSDChk: TCheckBox; TukeyKramerChk: TCheckBox; VarList: TListBox; - procedure ComputeBtnClick(Sender: TObject); procedure DepInClick(Sender: TObject); procedure DepOutClick(Sender: TObject); procedure Fact1InClick(Sender: TObject); @@ -61,16 +53,11 @@ type procedure Fact2OutClick(Sender: TObject); procedure Fact3InClick(Sender: TObject); procedure Fact3OutClick(Sender: TObject); - procedure FormActivate(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure HelpBtnClick(Sender: TObject); - procedure ResetBtnClick(Sender: TObject); + procedure VarListDblClick(Sender: TObject); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); private { private declarations } - FAutoSized: Boolean; NoSelected, N: integer; ColNoSelected: IntDyneVec; DepVarCol, F1Col, F2Col, F3Col, Nf1cells, Nf2cells, Nf3cells: integer; @@ -118,32 +105,65 @@ type procedure ThreeWayContrasts(AReport: TStrings); procedure ThreeWayPlot; - procedure UpdateBtnStates; - function Validate(out AMsg: String; out AControl: TWinControl): Boolean; - + protected + procedure AdjustConstraints; override; + procedure Compute; override; + procedure UpdateBtnStates; override; + function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; + public - { public declarations } - end; + constructor Create(AOwner: TComponent); override; + procedure Reset; override; + + end; var OneCaseAnovaForm: TOneCaseAnovaForm; implementation +{$R *.lfm} + uses Math, MathUnit; { TOneCaseAnovaForm } -procedure TOneCaseAnovaForm.ResetBtnClick(Sender: TObject); +constructor TOneCaseAnovaForm.Create(AOwner: TComponent); +begin + inherited; + + if GraphFrm = nil then + Application.CreateForm(TGraphFrm, GraphFrm); + + OverAllAlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); + PostAlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); +end; + + +procedure TOneCaseAnovaForm.AdjustConstraints; +begin + inherited; + + ParamsPanel.Constraints.MinHeight := InteractChk.Top + InteractChk.Height + + PostHocGroup.BorderSpacing.Top + PostHocGroup.Height + PostHocGroup.BorderSpacing.Bottom + + PostAlphaEdit.Height + ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height; + ParamsPanel.Constraints.MinWidth := + PostHocGroup.Width + PlotOptionsGroup.BorderSpacing.Left + PlotOptionsGroup.Width; +end; + + +procedure TOneCaseAnovaForm.Reset; var i: integer; begin + inherited; + VarList.Clear; - DepVar.Text := ''; - Factor1.Text := ''; - Factor2.Text := ''; - Factor3.Text := ''; + DepVarEdit.Text := ''; + Factor1Edit.Text := ''; + Factor2Edit.Text := ''; + Factor3Edit.Text := ''; //PlotMeans.Checked := false; ScheffeChk.Checked := false; TukeyHSDChk.Checked := false; @@ -156,49 +176,15 @@ begin UpdateBtnStates; end; -procedure TOneCaseAnovaForm.FormActivate(Sender: TObject); -var - w: Integer; -begin - if FAutoSized then - exit; - - w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]); - HelpBtn.Constraints.MinWidth := w; - ResetBtn.Constraints.MinWidth := w; - ComputeBtn.Constraints.MinWidth := w; - CloseBtn.Constraints.MinWidth := w; - - Panel1.Constraints.MinWidth := 2*PlotoptionsBox.Width; - Constraints.MinHeight := Height; - Constraints.MinWidth := Width; - - FAutoSized := true; -end; - -procedure TOneCaseAnovaForm.FormCreate(Sender: TObject); -begin - Assert(OS3MainFrm <> nil); - if GraphFrm = nil then - Application.CreateForm(TGraphFrm, GraphFrm); - - OverallAlpha.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); - PostAlpha.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); -end; - -procedure TOneCaseAnovaForm.FormShow(Sender: TObject); -begin - ResetBtnClick(self); -end; procedure TOneCaseAnovaForm.DepInClick(Sender: TObject); var index: integer; begin index := VarList.ItemIndex; - if (index > -1) and (DepVar.Text = '') then + if (index > -1) and (DepVarEdit.Text = '') then begin - DepVar.Text := VarList.Items[index]; + DepVarEdit.Text := VarList.Items[index]; VarList.Items.Delete(index); end; UpdateBtnStates; @@ -206,10 +192,10 @@ end; procedure TOneCaseAnovaForm.DepOutClick(Sender: TObject); begin - if DepVar.Text <> '' then + if DepVarEdit.Text <> '' then begin - VarList.Items.Add(DepVar.Text); - DepVar.Text := ''; + VarList.Items.Add(DepVarEdit.Text); + DepVarEdit.Text := ''; end; UpdateBtnStates; end; @@ -219,9 +205,9 @@ var index: integer; begin index := VarList.ItemIndex; - if (index > -1) and (Factor1.Text = '') then + if (index > -1) and (Factor1Edit.Text = '') then begin - Factor1.Text := VarList.Items[index]; + Factor1Edit.Text := VarList.Items[index]; VarList.Items.Delete(index); end; UpdateBtnStates; @@ -229,10 +215,10 @@ end; procedure TOneCaseAnovaForm.Fact1OutClick(Sender: TObject); begin - if Factor1.Text <> '' then + if Factor1Edit.Text <> '' then begin - VarList.Items.Add(Factor1.Text); - Factor1.Text := ''; + VarList.Items.Add(Factor1Edit.Text); + Factor1Edit.Text := ''; end; UpdateBtnStates; end; @@ -242,9 +228,9 @@ var index: integer; begin index := VarList.ItemIndex; - if (index > -1) and (Factor2.Text = '') then + if (index > -1) and (Factor2Edit.Text = '') then begin - Factor2.Text := VarList.Items[index]; + Factor2Edit.Text := VarList.Items[index]; VarList.Items.Delete(index); end; UpdateBtnStates; @@ -252,10 +238,10 @@ end; procedure TOneCaseAnovaForm.Fact2OutClick(Sender: TObject); begin - if Factor2.Text <> '' then + if Factor2Edit.Text <> '' then begin - VarList.Items.Add(Factor2.Text); - Factor2.Text := ''; + VarList.Items.Add(Factor2Edit.Text); + Factor2Edit.Text := ''; end; UpdateBtnStates; end; @@ -265,9 +251,9 @@ var index: integer; begin index := VarList.ItemIndex; - if (index > -1) and (Factor3.Text = '') then + if (index > -1) and (Factor3Edit.Text = '') then begin - Factor3.Text := VarList.Items[index]; + Factor3Edit.Text := VarList.Items[index]; VarList.Items.Delete(index); end; UpdateBtnStates; @@ -275,25 +261,26 @@ end; procedure TOneCaseAnovaForm.Fact3OutClick(Sender: TObject); begin - if Factor3.Text <> '' then + if Factor3Edit.Text <> '' then begin - VarList.Items.Add(Factor3.Text); - Factor3.Text := ''; + VarList.Items.Add(Factor3Edit.Text); + Factor3Edit.Text := ''; end; UpdateBtnStates; end; -procedure TOneCaseAnovaForm.ComputeBtnClick(Sender: TObject); + +procedure TOneCaseAnovaForm.Compute; var lReport: TStrings; msg: String; C: TWinControl; begin NoFactors := 0; - if (Factor1.Text <> '') and (Factor2.Text <> '') then + if (Factor1Edit.Text <> '') and (Factor2Edit.Text <> '') then begin NoFactors := 2; - if (Factor3.Text <> '') then + if (Factor3Edit.Text <> '') then NoFactors := 3; end; if (NoFactors < 2) then @@ -333,8 +320,8 @@ begin try TwoWayTable(lReport); TwoWayContrasts(lReport); - DisplayReport(lReport); - if PlotOptionsBox.ItemIndex > 0 then + FReportFrame.DisplayReport(lReport); + if PlotOptionsGroup.ItemIndex > 0 then TwoWayPlot; finally lReport.Free; @@ -365,8 +352,8 @@ begin try ThreeWayTable(lReport); ThreeWayContrasts(lReport); - DisplayReport(lReport); - if PlotOptionsBox.ItemIndex > 0 then + FReportFrame.DisplayReport(lReport); + if PlotOptionsGroup.ItemIndex > 0 then ThreeWayPlot; finally lReport.Free; @@ -380,25 +367,8 @@ begin end; end; end; // end switch - - cellcnts := nil; - cellvars := nil; - cellsums := nil; - ColNoSelected := nil; - OrdMeansB := nil; - OrdMeansA := nil; - ColCount := nil; - RowCount := nil; - ColSums := nil; - RowSums := nil; end; -procedure TOneCaseAnovaForm.HelpBtnClick(Sender: TObject); -begin - if ContextHelpForm = nil then - Application.CreateForm(TContextHelpForm, ContextHelpForm); - ContextHelpForm.HelpMessage((Sender as TButton).tag); -end; procedure TOneCaseAnovaForm.Init; var @@ -441,35 +411,36 @@ begin for i := 1 to NoVariables do begin cellstring := OS3MainFrm.DataGrid.Cells[i,0]; - if (cellstring = DepVar.Text) then + if (cellstring = DepVarEdit.Text) then begin DepVarCol := i; NoSelected := NoSelected + 1; ColNoSelected[NoSelected-1] := DepVarCol; end else - if (cellstring = Factor1.Text) then + if (cellstring = Factor1Edit.Text) then begin F1Col := i; NoSelected := NoSelected + 1; ColNoSelected[NoSelected-1] := F1Col; end else - if (cellstring = Factor2.Text) then + if (cellstring = Factor2Edit.Text) then begin F2Col := i; NoSelected := NoSelected + 1; ColNoSelected[NoSelected-1] := F2Col; end else - if (cellstring = Factor3.Text) then + if (cellstring = Factor3Edit.Text) then begin F3Col := i; NoSelected := NoSelected + 1; ColNoSelected[NoSelected-1] := F3Col; end; end; - OverAll := StrToFloat(OverAllAlpha.Text); - PostHocAlpha := StrToFloat(PostAlpha.Text); + OverAll := StrToFloat(OverAllAlphaEdit.Text); + PostHocAlpha := StrToFloat(PostAlphaEdit.Text); end; + procedure TOneCaseAnovaForm.GetLevels; var i: integer; @@ -530,6 +501,7 @@ begin end; end; + procedure TOneCaseAnovaForm.Calc2Way; var i, j, grpA, grpB: integer; @@ -667,6 +639,7 @@ begin if (Omega < 0.0) then Omega := 0.0; end; + procedure TOneCaseAnovaForm.TwoWayTable(AReport: TStrings); var i, j, groupsize: integer; @@ -678,25 +651,26 @@ begin AReport.Add('TWO-WAY ANALYSIS OF VARIANCE'); AReport.Add(''); - AReport.Add('Variable analyzed: %s', [DepVar.Text]); + AReport.Add('Variable analyzed: %s', [DepVarEdit.Text]); AReport.Add(''); - AReport.Add('Factor A (rows) variable: %s', [Factor1.Text]); - AReport.Add('Factor B (columns) variable: %s', [Factor2.Text]); + AReport.Add('Factor A (rows) variable: %s', [Factor1Edit.Text]); + AReport.Add('Factor B (columns) variable: %s', [Factor2Edit.Text]); AReport.Add(''); - AReport.Add('SOURCE D.F. SS MS F PROB.> F Omega Squared'); + AReport.Add('SOURCE D.F. SS MS F PROB.> F Omega Squared'); + AReport.Add('-------------- ---- ------------ ------------ ---------- -------- -------------'); + AReport.Add('Among Rows %4.0f %12.3f %12.3f %10.3f %8.3f %10.3f', [DFF1, SSF1, MSF1, FF1, ProbF1, OmegaF1]); + AReport.Add('Among Columns %4.0f %12.3f %12.3f %10.3f %8.3f %10.3f', [DFF2, SSF2, MSF2, FF2, ProbF2, OmegaF2]); + AReport.Add('Residual %4.0f %12.3f %12.3f', [DFErr, SSErr, MSErr]); + AReport.Add(' NonAdditivity %4.0f %12.3f %12.3f %10.3f %8.3f', [1.0, SSNonAdd, MSNonAdd, FNonAdd, ProbNonAdd]); + AReport.Add(' Balance %4.0f %12.3f %12.3f', [DFBalance, SSBalance, MSBalance]); + AReport.Add('Total %4.0f %12.3f %12.3f', [DFTot, SSDep, MSDep]); AReport.Add(''); - AReport.Add('Among Rows %4.0f %8.3f %8.3f %8.3f %6.3f %6.3f', [DFF1, SSF1, MSF1, FF1, ProbF1, OmegaF1]); - AReport.Add('Among Columns %4.0f %8.3f %8.3f %8.3f %6.3f %6.3f', [DFF2, SSF2, MSF2, FF2, ProbF2, OmegaF2]); - AReport.Add('Residual %4.0f %8.3f %8.3f', [DFErr, SSErr, MSErr]); - AReport.Add(' NonAdditivity %4.0f %8.3f %8.3f %8.3f %6.3f', [1.0, SSNonAdd, MSNonAdd, FNonAdd, ProbNonAdd]); - AReport.Add(' Balance %4.0f %8.3f %8.3f', [DFBalance, SSBalance, MSBalance]); - AReport.Add('Total %4.0f %8.3f %8.3f', [DFTot, SSDep, MSDep]); + AReport.Add('Omega squared for combined effects: %10.3f', [Omega]); AReport.Add(''); - AReport.Add('Omega squared for combined effects = %8.3f', [Omega]); - AReport.Add(''); - AReport.Add('Descriptive Statistics'); + AReport.Add('DESCRIPTIVE STATISTICS'); AReport.Add(''); AReport.Add('GROUP Row Col. N MEAN VARIANCE STD.DEV.'); + AReport.Add('----- --- ---- ---- -------- -------- ---------'); groupsize := ceil(counts[0,0]); equal_grp := true; @@ -729,7 +703,7 @@ begin end else XBar := sums[i][j]; - AReport.Add('Cell %3d %3d %3.0f %8.3f %8.3f %8.3f', [minf1+i, minf2+j, counts[i,j], XBar, V, S]); + AReport.Add('Cell %3d %3d %3d %8.3f %8.3f %8.3f', [minf1+i, minf2+j, counts[i,j], XBar, V, S]); end; end; @@ -763,6 +737,7 @@ begin AReport.Add(''); end; + procedure TOneCaseAnovaForm.TwoWayPlot; var i, j: integer; @@ -773,7 +748,7 @@ begin if CompError then exit; - case PlotOptionsBox.ItemIndex of + case PlotOptionsGroup.ItemIndex of 0: exit; 1: plotType := 2; // 3D bars 2: plotType := 1; // 2D bars @@ -798,8 +773,8 @@ begin end; GraphFrm.nosets := 1; GraphFrm.nbars := Nf1cells; - GraphFrm.Heading := Factor1.Text; - GraphFrm.XTitle := Factor1.Text + ' Codes'; + GraphFrm.Heading := Factor1Edit.Text; + GraphFrm.XTitle := Factor1Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -829,8 +804,8 @@ begin end; GraphFrm.nosets := 1; GraphFrm.nbars := Nf2cells; - GraphFrm.Heading := Factor2.Text; - GraphFrm.XTitle := FActor2.Text + ' Codes'; + GraphFrm.Heading := Factor2Edit.Text; + GraphFrm.XTitle := Factor2Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -851,7 +826,7 @@ begin SetLength(GraphFrm.Xpoints, 1, Nf2cells); for i := 1 to Nf1cells do begin - GraphFrm.SetLabels[i] := Factor1.Text + ' ' + IntToStr(i); + GraphFrm.SetLabels[i] := Factor1Edit.Text + ' ' + IntToStr(i); for j := 1 to Nf2cells do begin XBar := sums[i-1,j-1] / counts[i-1,j-1]; @@ -867,7 +842,7 @@ begin GraphFrm.nosets := Nf1cells; GraphFrm.nbars := Nf2cells; GraphFrm.Heading := 'Factor A x Factor B'; - GraphFrm.XTitle := Factor2.Text + ' Codes'; + GraphFrm.XTitle := Factor2Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -884,6 +859,7 @@ begin GraphFrm.Ypoints := nil; end; + procedure TOneCaseAnovaForm.Calc3Way; var i, j, k, grpA, grpB, grpC: integer; @@ -1070,7 +1046,7 @@ begin end; SSDep := SSDep - Constant; - if not InteractBtn.Checked then + if not InteractChk.Checked then SSErr := SSDep - (SSF1 + SSF2 + SSF3) else SSErr := SSDep - (SSF1 + SSF2 + SSF3 + SSF1F2 + SSF1F3 + SSF2F3); @@ -1093,7 +1069,7 @@ begin DFF1F2 := DFF1 * DFF2; DFF1F3 := DFF1 * DFF3; DFF2F3 := DFF2 * DFF3; - if not InteractBtn.Checked then + if not InteractChk.Checked then DFErr := DFTot - DFF1 - DFF2 - DFF3 else DFErr := DFTot - DFF1 - DFF2 - DFF3 - DFF1F2 - DFF1F3 - DFF2F3; @@ -1113,7 +1089,7 @@ begin OmegaF1F2 := (SSF1F2 - DFF1F2 * MSErr) / (SSDep + MSErr); OmegaF1F3 := (SSF1F3 - DFF1F3 * MSErr) / (SSDep + MSErr); OmegaF2F3 := (SSF2F3 - DFF2F3 * MSErr) / (SSDep + MSErr); - if not InteractBtn.Checked then + if not InteractChk.Checked then Omega := OmegaF1 + OmegaF2 + OmegaF3 else Omega := OmegaF1 + OmegaF2 + OmegaF3 + OmegaF1F2 + OmegaF1F3 + OmegaF2F3; @@ -1155,6 +1131,7 @@ begin if (Omega < 0.0) then Omega := 0.0; end; + procedure TOneCaseAnovaForm.ThreeWayTable(AReport: TStrings); var i, j, k: integer; @@ -1165,11 +1142,11 @@ begin AReport.Add('THREE-WAY ANALYSIS OF VARIANCE'); AReport.Add(''); - AReport.Add('Variable analyzed: %s', [DepVar.Text]); + AReport.Add('Variable analyzed: %s', [DepVarEdit.Text]); AReport.Add(''); - AReport.Add('Factor A (rows) variable: %s', [Factor1.Text]); - AReport.Add('Factor B (columns) variable: %s', [Factor2.Text]); - AReport.Add('Factor C (slices) variable: %s', [Factor3.Text]); + AReport.Add('Factor A (rows) variable: %s', [Factor1Edit.Text]); + AReport.Add('Factor B (columns) variable: %s', [Factor2Edit.Text]); + AReport.Add('Factor C (slices) variable: %s', [Factor3Edit.Text]); AReport.Add(''); AReport.Add('SOURCE D.F. SS MS F PROB.> F Omega Squared'); AReport.Add(''); @@ -1177,7 +1154,7 @@ begin AReport.Add('Among Columns %4.0f %12.4f %12.4f %12.4f %6.3f %6.3f', [DFF2, SSF2, MSF2, FF2, ProbF2, OmegaF2]); AReport.Add('Among Slices %4.0f %12.4f %12.4f %12.4f %6.3f %6.3f', [DFF3, SSF3, MSF3, FF3, ProbF3, OmegaF3]); - if InteractBtn.Checked then + if InteractChk.Checked then begin AReport.Add('A x B Inter. %4.0f %12.4f %12.4f %12.4f %6.3f %6.3f', [DFF1F2, SSF1F2, MSF1F2, FF1F2, ProbF1F2, OmegaF1F2]); AReport.Add('A x C Inter. %4.0f %12.4f %12.4f %12.4f %6.3f %6.3f', [DFF1F3, SSF1F3, MSF1F3, FF1F3, ProbF1F3, OmegaF1F3]); @@ -1260,6 +1237,7 @@ begin AReport.Add(''); end; + procedure TOneCaseAnovaForm.ThreeWayPlot; var i, j, k: integer; @@ -1270,7 +1248,7 @@ begin if CompError then exit; - case PlotOptionsBox.ItemIndex of + case PlotOptionsGroup.ItemIndex of 0: exit; 1: plotType := 2; // 3D bars 2: plotType := 1; // 2D bars @@ -1295,8 +1273,8 @@ begin end; GraphFrm.nosets := 1; GraphFrm.nbars := Nf1cells; - GraphFrm.Heading := Factor1.Text; - GraphFrm.XTitle := Factor1.Text + ' Codes'; + GraphFrm.Heading := Factor1Edit.Text; + GraphFrm.XTitle := Factor1Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -1326,8 +1304,8 @@ begin end; GraphFrm.nosets := 1; GraphFrm.nbars := Nf2cells; - GraphFrm.Heading := Factor2.Text; - GraphFrm.XTitle := Factor2.Text + ' Codes'; + GraphFrm.Heading := Factor2Edit.Text; + GraphFrm.XTitle := Factor2Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -1357,8 +1335,8 @@ begin end; GraphFrm.nosets := 1; GraphFrm.nbars := Nf3cells; - GraphFrm.Heading := Factor3.Text; - GraphFrm.XTitle := Factor2.Text + ' Codes'; + GraphFrm.Heading := Factor3Edit.Text; + GraphFrm.XTitle := Factor2Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.5; GraphFrm.AutoScaled := false; @@ -1381,7 +1359,7 @@ begin maxmean := 0.0; for i := 0 to Nf1cells - 1 do begin - GraphFrm.SetLabels[i+1] := Factor1.Text + ' ' + IntToStr(i+1); + GraphFrm.SetLabels[i+1] := Factor1Edit.Text + ' ' + IntToStr(i+1); for j := 0 to Nf2cells - 1 do begin XBar := wsum[i,j,k] / ncnt[i,j,k]; @@ -1398,7 +1376,7 @@ begin GraphFrm.nosets := Nf1cells; GraphFrm.nbars := Nf2cells; GraphFrm.Heading := 'Factor A x Factor B Within C ' + IntToStr(k+1); - GraphFrm.XTitle := Factor2.Text + ' Codes'; + GraphFrm.XTitle := Factor2Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.2; GraphFrm.AutoScaled := false; @@ -1422,7 +1400,7 @@ begin maxmean := 0.0; for i := 0 to Nf1cells - 1 do begin - GraphFrm.SetLabels[i+1] := Factor1.Text + ' ' + IntToStr(i+1); + GraphFrm.SetLabels[i+1] := Factor1Edit.Text + ' ' + IntToStr(i+1); for k := 0 to Nf3cells - 1 do begin XBar := wsum[i,j,k] / ncnt[i,j,k]; @@ -1439,7 +1417,7 @@ begin GraphFrm.nosets := Nf1cells; GraphFrm.nbars := Nf3cells; GraphFrm.Heading := 'Factor A x Factor C Within B ' + IntToStr(j+1); - GraphFrm.XTitle := Factor3.Text + ' Codes'; + GraphFrm.XTitle := Factor3Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.2; GraphFrm.AutoScaled := false; @@ -1463,7 +1441,7 @@ begin maxmean := 0.0; for j := 0 to Nf2cells - 1 do begin - GraphFrm.SetLabels[j+1] := Factor2.Text + ' ' + IntToStr(j+1); + GraphFrm.SetLabels[j+1] := Factor2Edit.Text + ' ' + IntToStr(j+1); for k := 0 to Nf3cells - 1 do begin XBar := wsum[i,j,k] / ncnt[i,j,k]; @@ -1480,7 +1458,7 @@ begin GraphFrm.nosets := Nf2cells; GraphFrm.nbars := Nf3cells; GraphFrm.Heading := 'Factor B x Factor C Within A ' + IntToStr(i+1); - GraphFrm.XTitle := Factor3.Text + ' Codes'; + GraphFrm.XTitle := Factor3Edit.Text + ' Codes'; GraphFrm.YTitle := 'Mean'; GraphFrm.barwideprop := 0.2; GraphFrm.AutoScaled := false; @@ -1498,6 +1476,7 @@ begin XValue := nil; end; + procedure TOneCaseAnovaForm.TwoWayContrasts(AReport: TStrings); var i, j: integer; @@ -1511,7 +1490,7 @@ begin exit; SetLength(variances, totcells); - alpha := StrToFloat(PostAlpha.Text); + alpha := StrToFloat(PostAlphaEdit.Text); // row comparisons if (Nf1cells > 2) and (ProbF1 < Overall) then @@ -1656,6 +1635,7 @@ begin variances := nil; end; + procedure TOneCaseAnovaForm.ThreeWayContrasts(AReport: TStrings); var i, j, k: integer; @@ -1668,7 +1648,7 @@ begin if CompError then exit; - alpha := StrToFloat(PostAlpha.Text); + alpha := StrToFloat(PostAlphaEdit.Text); if not (ScheffeChk.Checked or TukeyHSDChk.Checked or TukeyBChk.Checked or TukeyKramerChk.Checked or NewmanKeulsChk.Checked) then exit; @@ -1940,11 +1920,14 @@ begin variances := nil; end; + procedure TOneCaseAnovaForm.UpdateBtnStates; var i: Integer; lSelected: Boolean; begin + inherited; + lSelected := false; for i:=0 to VarList.Items.Count-1 do if VarList.Selected[i] then @@ -1952,49 +1935,44 @@ begin lSelected := true; break; end; - DepIn.Enabled := lSelected and (DepVar.Text = ''); - Fact1In.Enabled := lSelected and (Factor1.Text = ''); - Fact2In.Enabled := lSelected and (Factor2.Text = ''); - Fact3In.Enabled := lSelected and (Factor3.Text = ''); - DepOut.Enabled := DepVar.Text <> ''; - Fact1Out.Enabled := Factor1.Text <> ''; - Fact2Out.Enabled := Factor2.Text <> ''; - Fact3Out.Enabled := Factor3.Text <> ''; + DepIn.Enabled := lSelected and (DepVarEdit.Text = ''); + Fact1In.Enabled := lSelected and (Factor1Edit.Text = ''); + Fact2In.Enabled := lSelected and (Factor2Edit.Text = ''); + Fact3In.Enabled := lSelected and (Factor3Edit.Text = ''); + DepOut.Enabled := DepVarEdit.Text <> ''; + Fact1Out.Enabled := Factor1Edit.Text <> ''; + Fact2Out.Enabled := Factor2Edit.Text <> ''; + Fact3Out.Enabled := Factor3Edit.Text <> ''; end; -procedure TOneCaseAnovaForm.VarListSelectionChange(Sender: TObject; - User: boolean); -begin - UpdateBtnStates; -end; function TOneCaseAnovaForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean; var X: Double; begin Result := false; - if (OverallAlpha.Text = '') then + if (OverAllAlphaEdit.Text = '') then begin - AControl := OverallAlpha; + AControl := OverAllAlphaEdit; AMsg := 'No value specified for overall alpha.'; exit; end; - if not TryStrToFloat(OverallAlpha.Text, X) then + if not TryStrToFloat(OverAllAlphaEdit.Text, X) then begin - AControl := OverallAlpha; + AControl := OverAllAlphaEdit; AMsg := 'Overall alpha is not a valid number.'; exit; end; - if (PostAlpha.Text = '') then + if (PostAlphaEdit.Text = '') then begin - AControl := PostAlpha; + AControl := PostAlphaEdit; AMsg := 'No value specified for post-hoc alpha.'; exit; end; - if not TryStrToFloat(PostAlpha.Text, x) then + if not TryStrToFloat(PostAlphaEdit.Text, x) then begin - AControl := PostAlpha; + AControl := PostAlphaEdit; AMsg := 'Post-hoc alpha is not a valid number.'; exit; end; @@ -2002,8 +1980,40 @@ begin Result := true; end; -initialization - {$I onecaseanovaunit.lrs} + +procedure TOneCaseAnovaForm.VarListDblClick(Sender: TObject); +var + index: Integer; + s: String; +begin + index := VarList.ItemIndex; + if index > -1 then + begin + s := VarList.Items[index]; + if DepVarEdit.Text = '' then + DepVarEdit.Text := s + else + if Factor1Edit.Text = '' then + Factor1Edit.Text := s + else + if Factor2Edit.Text = '' then + Factor2Edit.Text := s + else + if Factor3Edit.Text = '' then + Factor3Edit.Text := s; + VarList.Items.Delete(index); + + UpdateBtnStates; + end; +end; + + +procedure TOneCaseAnovaForm.VarListSelectionChange(Sender: TObject; + User: boolean); +begin + UpdateBtnStates; +end; + end. diff --git a/applications/lazstats/source/forms/mainunit.pas b/applications/lazstats/source/forms/mainunit.pas index 8134a4ddb..ae1dc8cf5 100644 --- a/applications/lazstats/source/forms/mainunit.pas +++ b/applications/lazstats/source/forms/mainunit.pas @@ -1896,7 +1896,7 @@ procedure TOS3MainFrm.mnuAnalysisComp_OneCaseAnovaClick(Sender: TObject); begin if OneCaseAnovaForm = nil then Application.CreateForm(TOneCaseAnovaForm, OneCaseAnovaForm); - OneCaseAnovaForm.ShowModal; + OneCaseAnovaForm.Show; end; // Menu "Analysis" > "Comparisons" > "Difference beween Proportions" @@ -1915,7 +1915,7 @@ begin TTestForm.Show; end; -// Menu "Analysis" > "Comparisons" > "Within Subjects mnuAnalysisComp_Anova" +// Menu "Analysis" > "Comparisons" > "Within Subjects Anova" procedure TOS3MainFrm.mnuAnalysisComp_WithinAnovaClick(Sender: TObject); begin if WithinANOVAFrm = nil then