diff --git a/applications/lazstats/source/LazStats.lpi b/applications/lazstats/source/LazStats.lpi index 8dacf60a9..51ea93554 100644 --- a/applications/lazstats/source/LazStats.lpi +++ b/applications/lazstats/source/LazStats.lpi @@ -125,7 +125,7 @@ - + @@ -380,1178 +380,1170 @@ - - - - - - - - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + diff --git a/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.lfm b/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.lfm deleted file mode 100644 index 87274def9..000000000 --- a/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.lfm +++ /dev/null @@ -1,581 +0,0 @@ -object LatinSpecsFrm: TLatinSpecsFrm - Left = 887 - Height = 519 - Top = 260 - Width = 420 - AutoSize = True - Caption = 'Latin Squares Analysis Specification Form' - ClientHeight = 519 - ClientWidth = 420 - OnActivate = FormActivate - OnCreate = FormCreate - OnShow = FormShow - Position = poMainFormCenter - LCLVersion = '2.1.0.0' - object Label1: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Owner - Left = 8 - Height = 15 - Top = 8 - Width = 67 - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - Caption = 'File Variables' - ParentColor = False - end - object Label8: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = nPerCellEdit - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 491 - Width = 99 - BorderSpacing.Left = 8 - Caption = 'No. Cases per cell: ' - ParentColor = False - end - object VarList: TListBox - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Label1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Panel7 - AnchorSideBottom.Control = Bevel1 - Left = 8 - Height = 445 - Top = 25 - Width = 240 - Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Top = 2 - BorderSpacing.Right = 8 - Constraints.MinWidth = 150 - ItemHeight = 0 - OnSelectionChange = VarListSelectionChange - TabOrder = 0 - end - object ResetBtn: TButton - AnchorSideRight.Control = CancelBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 226 - Height = 25 - Top = 486 - Width = 54 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 12 - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Reset' - OnClick = ResetBtnClick - TabOrder = 3 - end - object CancelBtn: TButton - AnchorSideRight.Control = OKBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 292 - Height = 25 - Top = 486 - Width = 62 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 12 - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Cancel' - ModalResult = 2 - TabOrder = 4 - end - object OKBtn: TButton - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 366 - Height = 25 - Top = 486 - Width = 42 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Left = 12 - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'OK' - ModalResult = 1 - OnClick = OKBtnClick - TabOrder = 5 - end - object nPerCellEdit: TEdit - AnchorSideLeft.Control = Label8 - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = OKBtn - AnchorSideTop.Side = asrCenter - AnchorSideRight.Side = asrBottom - Left = 115 - Height = 23 - Top = 487 - Width = 48 - Alignment = taRightJustify - BorderSpacing.Left = 8 - BorderSpacing.Right = 12 - TabOrder = 2 - Text = 'nPerCellEdit' - end - object Bevel1: TBevel - AnchorSideLeft.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = OKBtn - Left = 0 - Height = 8 - Top = 470 - Width = 420 - Anchors = [akLeft, akRight, akBottom] - Shape = bsBottomLine - end - object Panel7: TPanel - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = VarList - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Bevel1 - Left = 256 - Height = 440 - Top = 25 - Width = 156 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Right = 8 - BevelOuter = bvNone - ChildSizing.VerticalSpacing = 16 - ChildSizing.EnlargeHorizontal = crsHomogenousChildResize - ChildSizing.ShrinkHorizontal = crsHomogenousChildResize - ChildSizing.Layout = cclLeftToRightThenTopToBottom - ChildSizing.ControlsPerLine = 1 - ClientHeight = 440 - ClientWidth = 156 - TabOrder = 1 - object PanelA: TPanel - AnchorSideRight.Side = asrBottom - Left = 0 - Height = 60 - Top = 0 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 0 - object ACodeLabel: TLabel - AnchorSideLeft.Control = ACodeEdit - AnchorSideBottom.Control = ACodeEdit - Left = 37 - Height = 15 - Top = 8 - Width = 119 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Factor A Code Variable' - ParentColor = False - end - object AInBtn: TBitBtn - AnchorSideLeft.Control = PanelA - AnchorSideTop.Control = PanelA - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = AInBtnClick - Spacing = 0 - TabOrder = 0 - end - object AOutBtn: TBitBtn - AnchorSideLeft.Control = PanelA - AnchorSideTop.Control = AInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = AOutBtnClick - Spacing = 0 - TabOrder = 1 - end - object ACodeEdit: TEdit - AnchorSideLeft.Control = AInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelA - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = AOutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'ACodeEdit' - end - end - object PanelB: TPanel - Left = 0 - Height = 60 - Top = 76 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 1 - object BCodeLabel: TLabel - AnchorSideLeft.Control = BCodeEdit - AnchorSideTop.Side = asrBottom - AnchorSideBottom.Control = BCodeEdit - Left = 37 - Height = 15 - Top = 8 - Width = 118 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Factor B Code Variable' - ParentColor = False - end - object BInBtn: TBitBtn - AnchorSideLeft.Control = PanelB - AnchorSideTop.Control = PanelB - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = BInBtnClick - Spacing = 0 - TabOrder = 0 - end - object BOutBtn: TBitBtn - AnchorSideLeft.Control = PanelB - AnchorSideTop.Control = BInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = BOutBtnClick - Spacing = 0 - TabOrder = 1 - end - object BCodeEdit: TEdit - AnchorSideLeft.Control = BInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelB - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = BOutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'BCodeEdit' - end - end - object PanelC: TPanel - Left = 0 - Height = 60 - Top = 152 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 2 - object CCodeLabel: TLabel - AnchorSideLeft.Control = CCodeEdit - AnchorSideBottom.Control = CCodeEdit - Left = 37 - Height = 15 - Top = 8 - Width = 119 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Factor C Code Variable' - ParentColor = False - end - object CInBtn: TBitBtn - AnchorSideLeft.Control = PanelC - AnchorSideTop.Control = PanelC - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = CInBtnClick - Spacing = 0 - TabOrder = 0 - end - object COutBtn: TBitBtn - AnchorSideLeft.Control = PanelC - AnchorSideTop.Control = CInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = COutBtnClick - Spacing = 0 - TabOrder = 1 - end - object CCodeEdit: TEdit - AnchorSideLeft.Control = CInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelC - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = COutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'CCodeEdit' - end - end - object PanelD: TPanel - Left = 0 - Height = 60 - Top = 228 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 3 - object DCodeLabel: TLabel - AnchorSideLeft.Control = DCodeEdit - AnchorSideBottom.Control = DCodeEdit - Left = 37 - Height = 15 - Top = 8 - Width = 119 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Factor D Code Variable' - ParentColor = False - end - object DInBtn: TBitBtn - AnchorSideLeft.Control = PanelD - AnchorSideTop.Control = PanelD - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = DInBtnClick - Spacing = 0 - TabOrder = 0 - end - object DOutBtn: TBitBtn - AnchorSideLeft.Control = PanelD - AnchorSideTop.Control = DInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = DOutBtnClick - Spacing = 0 - TabOrder = 1 - end - object DCodeEdit: TEdit - AnchorSideLeft.Control = DInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelD - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = DOutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'DCodeEdit' - end - end - object PanelGrp: TPanel - Left = 0 - Height = 60 - Top = 304 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 4 - object GrpCodeLabel: TLabel - AnchorSideLeft.Control = GrpCodeEdit - AnchorSideBottom.Control = GrpCodeEdit - Left = 37 - Height = 15 - Top = 8 - Width = 108 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Group Code Variable' - ParentColor = False - end - object GrpInBtn: TBitBtn - AnchorSideLeft.Control = PanelGrp - AnchorSideTop.Control = PanelGrp - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = GrpInBtnClick - Spacing = 0 - TabOrder = 0 - end - object GrpOutBtn: TBitBtn - AnchorSideLeft.Control = PanelGrp - AnchorSideTop.Control = GrpInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = GrpOutBtnClick - Spacing = 0 - TabOrder = 1 - end - object GrpCodeEdit: TEdit - AnchorSideLeft.Control = GrpInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelGrp - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = GrpOutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'GrpCodeEdit' - end - end - object PanelDep: TPanel - Left = 0 - Height = 60 - Top = 380 - Width = 156 - AutoSize = True - BevelOuter = bvNone - ClientHeight = 60 - ClientWidth = 156 - TabOrder = 5 - object DepVarLabel: TLabel - AnchorSideLeft.Control = DepVarEdit - AnchorSideBottom.Control = DepVarEdit - Left = 37 - Height = 15 - Top = 8 - Width = 102 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Dependent Variable' - ParentColor = False - end - object DataInBtn: TBitBtn - AnchorSideLeft.Control = PanelDep - AnchorSideTop.Control = PanelDep - Left = 0 - Height = 28 - Top = 0 - Width = 29 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = DataInBtnClick - Spacing = 0 - TabOrder = 0 - end - object DataOutBtn: TBitBtn - AnchorSideLeft.Control = PanelDep - AnchorSideTop.Control = DataInBtn - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 28 - Top = 32 - Width = 29 - BorderSpacing.Top = 4 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = DataOutBtnClick - Spacing = 0 - TabOrder = 1 - end - object DepVarEdit: TEdit - AnchorSideLeft.Control = DataInBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = PanelDep - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = DataOutBtn - AnchorSideBottom.Side = asrBottom - Left = 37 - Height = 23 - Top = 25 - Width = 119 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - NumbersOnly = True - TabOrder = 2 - Text = 'DepVarEdit' - end - end - end -end diff --git a/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.pas b/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.pas deleted file mode 100644 index 4787d1b71..000000000 --- a/applications/lazstats/source/forms/analysis/comparisons/latinspecsunit.pas +++ /dev/null @@ -1,415 +0,0 @@ -unit LatinSpecsUnit; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, ExtCtrls, Buttons, - MainUnit, Globals; - -type - - { TLatinSpecsFrm } - - TLatinSpecsFrm = class(TForm) - AInBtn: TBitBtn; - nPerCellEdit: TEdit; - GrpOutBtn: TBitBtn; - DataInBtn: TBitBtn; - DataOutBtn: TBitBtn; - AOutBtn: TBitBtn; - BInBtn: TBitBtn; - BOutBtn: TBitBtn; - CInBtn: TBitBtn; - COutBtn: TBitBtn; - DInBtn: TBitBtn; - DOutBtn: TBitBtn; - GrpInBtn: TBitBtn; - Label8: TLabel; - PanelA: TPanel; - PanelB: TPanel; - PanelC: TPanel; - PanelD: TPanel; - PanelGrp: TPanel; - PanelDep: TPanel; - Panel7: TPanel; - ResetBtn: TButton; - CancelBtn: TButton; - OKBtn: TButton; - ACodeEdit: TEdit; - BCodeEdit: TEdit; - CCodeEdit: TEdit; - DCodeEdit: TEdit; - GrpCodeEdit: TEdit; - DepVarEdit: TEdit; - Label1: TLabel; - ACodeLabel: TLabel; - BCodeLabel: TLabel; - CCodeLabel: TLabel; - DCodeLabel: TLabel; - GrpCodeLabel: TLabel; - DepVarLabel: TLabel; - VarList: TListBox; - Bevel1: TBevel; - procedure AInBtnClick(Sender: TObject); - procedure AOutBtnClick(Sender: TObject); - procedure BInBtnClick(Sender: TObject); - procedure BOutBtnClick(Sender: TObject); - procedure CInBtnClick(Sender: TObject); - procedure COutBtnClick(Sender: TObject); - procedure DataInBtnClick(Sender: TObject); - procedure DataOutBtnClick(Sender: TObject); - procedure DInBtnClick(Sender: TObject); - procedure DOutBtnClick(Sender: TObject); - procedure FormActivate(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure GrpInBtnClick(Sender: TObject); - procedure GrpOutBtnClick(Sender: TObject); - procedure OKBtnClick(Sender: TObject); - procedure ResetBtnClick(Sender: TObject); - procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); - private - { private declarations } - FAutoSized: Boolean; - procedure UpdateBtnStates; - function Validate(out AMsg: String; out AControl: TWinControl): Boolean; - public - { public declarations } - procedure PrepareForPlan(APlan: integer); - end; - -var - LatinSpecsFrm: TLatinSpecsFrm; - -implementation - -uses - Math, - Utils, LatinSqrsUnit; - - -{ TLatinSpecsFrm } - -procedure TLatinSpecsFrm.PrepareForPlan(APlan: Integer); -begin - ResetBtnClick(nil); - case APlan of - 1: begin - PanelD.Visible := false; - PanelGrp.Visible := false; - end; - 2: begin - PanelD.Visible := true; - PanelGrp.Visible := false; - end; - 3: begin - PanelD.Visible := true; - PanelGrp.Visible := false; - end; - 4: begin - PanelD.Visible := true; - PanelGrp.Visible := false; - end; - 5: begin - PanelD.Visible := false; - PanelGrp.Visible := true; - end; - 6: begin - PanelD.Visible := false; - PanelGrp.Visible := true; - end; - 7: begin - PanelD.Visible := true; - PanelGrp.Visible := true; - end; - 9: begin - PanelD.Visible := true; - PanelGrp.Visible := true; - end; - end; -end; - -procedure TLatinSpecsFrm.ResetBtnClick(Sender: TObject); -var - i: integer; -begin - VarList.Clear; - for i := 1 to NoVariables do - VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); - ACodeEdit.Text := ''; - BCodeEdit.Text := ''; - CCodeEdit.Text := ''; - DCodeEdit.Text := ''; - GrpCodeEdit.Text := ''; - DepVarEdit.Text := ''; - nPerCellEdit.Text := ''; - UpdatebtnStates; -end; - -procedure TLatinSpecsFrm.FormActivate(Sender: TObject); -var - w: Integer; -begin - if FAutoSized then - exit; - w := MaxValue([ResetBtn.Width, CancelBtn.Width, OKBtn.Width]); - ResetBtn.Constraints.MinWidth := w; - CancelBtn.Constraints.MinWidth := w; - OKBtn.Constraints.MinWidth := w; - - VarList.Constraints.MinHeight := Panel7.Height; - - Constraints.MinWidth := nPerCellEdit.Left + nPerCellEdit.Width + Width - ResetBtn.Left + ResetBtn.BorderSpacing.Left; - Constraints.MinHeight := Height; - - FAutoSized := true; -end; - -procedure TLatinSpecsFrm.FormCreate(Sender: TObject); -begin - Assert(OS3MainFrm <> nil); -end; - -procedure TLatinSpecsFrm.FormShow(Sender: TObject); -begin - ResetBtnClick(Self); -end; - -procedure TLatinSpecsFrm.AInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (ACodeEdit.Text = '') then - begin - ACodeEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.AOutBtnClick(Sender: TObject); -begin - if ACodeEdit.Text <> '' then - begin - VarList.Items.Add(ACodeEdit.Text); - ACodeEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.BInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (BCodeEdit.Text = '') then - begin - BCodeEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.BOutBtnClick(Sender: TObject); -begin - if BCodeEdit.Text <> '' then - begin - VarList.Items.Add(BCodeEdit.Text); - BCodeEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.CInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (CCodeEdit.Text = '') then - begin - CCodeEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.COutBtnClick(Sender: TObject); -begin - if CCodeEdit.Text <> '' then - begin - VarList.Items.Add(CCodeEdit.Text); - CCodeEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.DataInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (DepVarEdit.Text = '') then - begin - DepVarEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.DataOutBtnClick(Sender: TObject); -begin - if DepVarEdit.Text <> '' then - begin - VarList.Items.Add(DepVarEdit.Text); - DepVarEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.DInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (DCodeEdit.Text = '') then - begin - DCodeEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.DOutBtnClick(Sender: TObject); -begin - if DCodeEdit.Text <> '' then - begin - VarList.Items.Add(DCodeEdit.Text); - DCodeEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.GrpInBtnClick(Sender: TObject); -var - index: integer; -begin - index := VarList.ItemIndex; - if (index > -1) and (GrpCodeEdit.Text = '') then - begin - GrpCodeEdit.Text := VarList.Items[index]; - VarList.Items.Delete(index); - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.GrpOutBtnClick(Sender: TObject); -begin - if GrpCodeEdit.Text <> '' then - begin - VarList.Items.Add(GrpCodeEdit.Text); - GrpCodeEdit.Text := ''; - UpdateBtnStates; - end; -end; - -procedure TLatinSpecsFrm.OKBtnClick(Sender: TObject); -var - C: TWinControl; - msg: String; -begin - if not Validate(msg, C) then begin - C.SetFocus; - ErrorMsg(msg); - ModalResult := mrNone; - end; -end; - -procedure TLatinSpecsFrm.UpdateBtnStates; -begin - AInBtn.Enabled := (VarList.ItemIndex > -1) and (ACodeEdit.Text = ''); - BInBtn.Enabled := (VarList.ItemIndex > -1) and (BCodeEdit.Text = ''); - CInBtn.Enabled := (VarList.ItemIndex > -1) and (CCodeEdit.Text = ''); - DInBtn.Enabled := (VarList.ItemIndex > -1) and (DCodeEdit.Text = ''); - GrpInBtn.Enabled := (VarList.ItemIndex > -1) and (GrpCodeEdit.Text = ''); - DataInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVarEdit.Text = ''); - - AOutBtn.Enabled := (ACodeEdit.Text <> ''); - BOutBtn.Enabled := (BCodeEdit.Text <> ''); - COutBtn.Enabled := (CCodeEdit.Text <> ''); - DOutBtn.Enabled := (DCodeEdit.Text <> ''); - GrpOutBtn.Enabled := (GrpCodeEdit.Text <> ''); - DataOutBtn.Enabled := (DepVarEdit.Text <> ''); -end; - -function TLatinSpecsFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean; -var - n: Integer; -begin - Result := false; - - if (nPerCellEdit.Text = '') then begin - AMsg := 'Please specify the number of cases per cell.'; - AControl := nPercellEdit; - exit; - end; - if not TryStrToInt(nPerCellEdit.Text, n) or (n <= 0) then begin - AMsg := 'Please specify a valid (positive) number for the cases per cell.'; - AControl := nPercellEdit; - exit; - end; - - if PanelA.Visible and (ACodeEdit.Text = '') then - begin - AMsg := 'Factor A code variable is not specified.'; - AControl := ACodeEdit; - exit; - end; - if PanelB.Visible and (BCodeEdit.Text = '') then - begin - AMsg := 'Factor B code variable is not specified.'; - Acontrol := BCodeEdit; - exit; - end; - if PanelC.Visible and (CCodeEdit.Text = '') then - begin - AMsg := 'Factor C code variable is not specified.'; - Acontrol := CCodeEdit; - exit; - end; - if PanelD.Visible and (DCodeEdit.Text = '') then - begin - AMsg := 'Factor D code variable is not specified.'; - Acontrol := DCodeEdit; - exit; - end; - if PanelGrp.Visible and (GrpCodeEdit.Text = '') then - begin - AMsg := 'Group code variable is not specified.'; - Acontrol := GrpCodeEdit; - exit; - end; - if PanelDep.Visible and (DepVarEdit.Text = '') then - begin - AMsg := 'Dependent variable is not specified.'; - Acontrol := DepVarEdit; - exit; - end; - - Result := true; -end; - -procedure TLatinSpecsFrm.VarListSelectionChange(Sender: TObject; User: boolean); -begin - UpdateBtnStates; -end; - - -initialization - {$I latinspecsunit.lrs} - -end. - diff --git a/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.lfm b/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.lfm index c7b603d0d..719c1a274 100644 --- a/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.lfm +++ b/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.lfm @@ -1,109 +1,538 @@ -object LatinSqrsFrm: TLatinSqrsFrm - Left = 199 - Height = 248 - Top = 108 - Width = 523 +inherited LatinSqrsForm: TLatinSqrsForm + Left = 225 + Height = 573 + Top = 168 + Width = 914 HelpType = htKeyword HelpKeyword = 'html/LatinandGreco-LatinSquares.htm' - ActiveControl = Plan - AutoSize = True - BorderStyle = bsDialog Caption = 'Latin and Greco-Latin Squares Analyses' - ClientHeight = 248 - ClientWidth = 523 - OnActivate = FormActivate - OnCreate = FormCreate - Position = poMainFormCenter - LCLVersion = '2.1.0.0' - object ComputeBtn: TButton - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = Plan - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = CloseBtn - Left = 372 - Height = 25 - Top = 214 - Width = 76 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Compute' - OnClick = ComputeBtnClick - TabOrder = 2 + ClientHeight = 573 + ClientWidth = 914 + inherited ParamsPanel: TPanel + Height = 557 + Width = 355 + ClientHeight = 557 + ClientWidth = 355 + inherited CloseBtn: TButton + Left = 300 + Top = 532 + end + inherited ComputeBtn: TButton + Left = 216 + Top = 532 + end + inherited ResetBtn: TButton + Left = 154 + Top = 532 + end + inherited HelpBtn: TButton + Tag = 130 + Left = 95 + Top = 532 + end + inherited ButtonBevel: TBevel + Top = 516 + Width = 355 + end + object PlanLabel: TLabel[5] + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = ParamsPanel + Left = 0 + Height = 15 + Top = 0 + Width = 73 + Caption = 'Winer''s Plans:' + ParentColor = False + end + object PlanCombo: TComboBox[6] + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = PlanLabel + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 23 + Top = 17 + Width = 355 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 2 + BorderSpacing.Bottom = 8 + DropDownCount = 16 + ItemHeight = 15 + Items.Strings = ( + 'Plan 1. Three Factors (A,B,C) with no interactions.' + 'Plan 2. Four Factors (A,B,C,D) with partial interactions.' + 'Plan 3. Like Plan 2 but different assumptions (Partial confounding of interaction ABC.)' + 'Plan 4. The Greco-Latin with no interactions assumed.' + 'Plan 5. Repeated measures Latin Square (random assignment of groups to rows.)' + 'Plan 6. Fractional replication of a three factor factorial experiment in incomplete blocks.' + 'Plan 7. Plan 5 with superimposing of an orthogonal Latin square.' + 'Plan 9. AxBxC (same square used for all levels of Factor C.)' + ) + OnChange = PlanComboChange + Style = csDropDownList + TabOrder = 4 + end + object PlanPanel: TPanel[7] + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = PlanCombo + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ButtonBevel + Left = 0 + Height = 468 + Top = 48 + Width = 355 + Anchors = [akTop, akLeft, akRight, akBottom] + BevelOuter = bvNone + ClientHeight = 468 + ClientWidth = 355 + TabOrder = 5 + Visible = False + object Label1: TLabel + AnchorSideLeft.Control = PlanPanel + AnchorSideTop.Control = PlanPanel + Left = 0 + Height = 15 + Top = 0 + Width = 67 + Caption = 'File Variables' + ParentColor = False + end + object VarList: TListBox + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = Label1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = AInBtn + AnchorSideBottom.Control = nPerCellEdit + Left = 0 + Height = 416 + Top = 17 + Width = 158 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Top = 2 + BorderSpacing.Right = 6 + BorderSpacing.Bottom = 12 + ItemHeight = 0 + OnDblClick = VarListDblClick + OnSelectionChange = VarListSelectionChange + TabOrder = 0 + end + object AInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = VarList + Left = 164 + Height = 26 + Top = 17 + Width = 26 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = AInBtnClick + Spacing = 0 + TabOrder = 1 + end + object AOutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = AInBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 47 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = AOutBtnClick + Spacing = 0 + TabOrder = 2 + end + object ACodeLabel: TLabel + AnchorSideLeft.Control = ACodeEdit + AnchorSideBottom.Control = ACodeEdit + Left = 198 + Height = 15 + Top = 21 + Width = 119 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Factor A Code Variable' + ParentColor = False + end + object ACodeEdit: TEdit + AnchorSideLeft.Control = AInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = AOutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 38 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 3 + Text = 'ACodeEdit' + end + object BInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = AOutBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 89 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = BInBtnClick + Spacing = 0 + TabOrder = 4 + end + object BOutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = BInBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 119 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = BOutBtnClick + Spacing = 0 + TabOrder = 5 + end + object BCodeLabel: TLabel + AnchorSideLeft.Control = BCodeEdit + AnchorSideTop.Side = asrBottom + AnchorSideBottom.Control = BCodeEdit + Left = 198 + Height = 15 + Top = 93 + Width = 118 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Factor B Code Variable' + ParentColor = False + end + object BCodeEdit: TEdit + AnchorSideLeft.Control = BInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = BOutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 110 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 6 + Text = 'BCodeEdit' + end + object CCodeLabel: TLabel + AnchorSideLeft.Control = CCodeEdit + AnchorSideBottom.Control = CCodeEdit + Left = 198 + Height = 15 + Top = 165 + Width = 119 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Factor C Code Variable' + ParentColor = False + end + object CCodeEdit: TEdit + AnchorSideLeft.Control = CInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = COutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 182 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 7 + Text = 'CCodeEdit' + end + object CInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = BOutBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 161 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = CInBtnClick + Spacing = 0 + TabOrder = 8 + end + object COutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = CInBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 191 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = COutBtnClick + Spacing = 0 + TabOrder = 9 + end + object DInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = COutBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 233 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = DInBtnClick + Spacing = 0 + TabOrder = 10 + end + object DOutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = DInBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 263 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = DOutBtnClick + Spacing = 0 + TabOrder = 11 + end + object DCodeLabel: TLabel + AnchorSideLeft.Control = DCodeEdit + AnchorSideBottom.Control = DCodeEdit + Left = 198 + Height = 15 + Top = 237 + Width = 119 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Factor D Code Variable' + ParentColor = False + end + object DCodeEdit: TEdit + AnchorSideLeft.Control = DInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = DOutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 254 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 12 + Text = 'DCodeEdit' + end + object GrpInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = DOutBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 305 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = GrpInBtnClick + Spacing = 0 + TabOrder = 13 + end + object GrpOutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = GrpInBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 335 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = GrpOutBtnClick + Spacing = 0 + TabOrder = 14 + end + object GrpCodeLabel: TLabel + AnchorSideLeft.Control = GrpCodeEdit + AnchorSideBottom.Control = GrpCodeEdit + Left = 198 + Height = 15 + Top = 309 + Width = 108 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Group Code Variable' + ParentColor = False + end + object GrpCodeEdit: TEdit + AnchorSideLeft.Control = GrpInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = GrpOutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 326 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 15 + Text = 'GrpCodeEdit' + end + object DataInBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = GrpOutBtn + AnchorSideTop.Side = asrBottom + Left = 164 + Height = 26 + Top = 377 + Width = 26 + BorderSpacing.Top = 16 + Images = MainDataModule.ImageList + ImageIndex = 1 + OnClick = DataInBtnClick + Spacing = 0 + TabOrder = 16 + end + object DataOutBtn: TBitBtn + AnchorSideLeft.Control = PlanPanel + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = DataInBtn + AnchorSideTop.Side = asrBottom + AnchorSideBottom.Side = asrBottom + Left = 164 + Height = 26 + Top = 407 + Width = 26 + BorderSpacing.Top = 4 + Images = MainDataModule.ImageList + ImageIndex = 0 + OnClick = DataOutBtnClick + Spacing = 0 + TabOrder = 17 + end + object DepVarLabel: TLabel + AnchorSideLeft.Control = DepVarEdit + AnchorSideBottom.Control = DepVarEdit + Left = 198 + Height = 15 + Top = 381 + Width = 102 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Dependent Variable' + ParentColor = False + end + object DepVarEdit: TEdit + AnchorSideLeft.Control = DataInBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = PlanPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = DataOutBtn + AnchorSideBottom.Side = asrBottom + Left = 198 + Height = 23 + Top = 398 + Width = 157 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + NumbersOnly = True + TabOrder = 18 + Text = 'DepVarEdit' + end + object Label8: TLabel + AnchorSideLeft.Control = PlanPanel + AnchorSideTop.Control = nPerCellEdit + AnchorSideTop.Side = asrCenter + Left = 8 + Height = 15 + Top = 449 + Width = 138 + BorderSpacing.Left = 8 + Caption = 'Number of Cases per cell: ' + ParentColor = False + end + object nPerCellEdit: TEdit + AnchorSideLeft.Control = Label8 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Side = asrCenter + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = PlanPanel + AnchorSideBottom.Side = asrBottom + Left = 154 + Height = 23 + Top = 445 + Width = 48 + Alignment = taRightJustify + Anchors = [akLeft, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Right = 12 + TabOrder = 19 + Text = 'nPerCellEdit' + end + end end - object CloseBtn: TButton - AnchorSideTop.Control = Plan - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 460 - Height = 25 - Top = 214 - Width = 55 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Close' - ModalResult = 11 - TabOrder = 3 + inherited ParamsSplitter: TSplitter + Left = 367 + Height = 573 end - object Plan: TRadioGroup - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Owner - Left = 8 - Height = 198 - Top = 8 - Width = 515 - AutoFill = True - AutoSize = True - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - Caption = 'Winer''s Plans:' - 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 = 178 - ClientWidth = 511 - Items.Strings = ( - 'Plan 1. Three Factors (A,B,C) with no interactions.' - 'Plan 2. Four Factors (A,B,C,D) with partial interactions.' - 'Plan 3. Like Plan 2 but different assumptions (Partial confounding of interaction ABC.)' - 'The Greco-Latin with no interactions assumed.' - 'Plan 5. Repeated measures Latin Square (random assignment of groups to rows.)' - 'Plan 6. Fractional replication of a three factor factorial experiment in incomplete blocks.' - 'Plan 7. Plan 5 with superimposing of an orthogonal Latin square.' - 'Plan 9. AxBxC (same square used for all levels of Factor C.)' - ) - TabOrder = 0 - end - object HelpBtn: TButton - Tag = 130 - AnchorSideTop.Control = Plan - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = ComputeBtn - Left = 313 - Height = 25 - Top = 214 - Width = 51 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Help' - OnClick = HelpBtnClick + inherited PageControl: TPageControl + Left = 376 + Height = 557 + Width = 530 + ActivePage = ReportPage + TabIndex = 0 TabOrder = 1 end end diff --git a/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.pas b/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.pas index 9925ca093..19d35e6fe 100644 --- a/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.pas +++ b/applications/lazstats/source/forms/analysis/comparisons/latinsqrsunit.pas @@ -5,28 +5,66 @@ unit LatinSqrsUnit; interface uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, ExtCtrls, - LatinSpecsUnit, MainUnit, Globals, FunctionsLib, OutputUnit, GraphLib, - MatrixLib, ContextHelpUnit; + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, + ComCtrls, Buttons, MainUnit, Globals, GraphLib, + MatrixLib, BasicStatsReportAndChartFormUnit; type - { TLatinSqrsFrm } + { TLatinSqrsForm } - TLatinSqrsFrm = class(TForm) - ComputeBtn: TButton; - HelpBtn: TButton; - CloseBtn: TButton; - Plan: TRadioGroup; - procedure ComputeBtnClick(Sender: TObject); - procedure FormActivate(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure HelpBtnClick(Sender: TObject); + TLatinSqrsForm = class(TBasicStatsReportAndChartForm) + ACodeEdit: TEdit; + ACodeLabel: TLabel; + AInBtn: TBitBtn; + AOutBtn: TBitBtn; + BCodeEdit: TEdit; + BCodeLabel: TLabel; + BInBtn: TBitBtn; + BOutBtn: TBitBtn; + CCodeEdit: TEdit; + CCodeLabel: TLabel; + CInBtn: TBitBtn; + COutBtn: TBitBtn; + DataInBtn: TBitBtn; + DataOutBtn: TBitBtn; + DCodeEdit: TEdit; + DCodeLabel: TLabel; + DepVarEdit: TEdit; + DepVarLabel: TLabel; + DInBtn: TBitBtn; + DOutBtn: TBitBtn; + GrpCodeEdit: TEdit; + GrpCodeLabel: TLabel; + GrpInBtn: TBitBtn; + GrpOutBtn: TBitBtn; + Label1: TLabel; + Label8: TLabel; + nPerCellEdit: TEdit; + PlanPanel: TPanel; + PlanCombo: TComboBox; + PlanLabel: TLabel; + VarList: TListBox; + procedure AInBtnClick(Sender: TObject); + procedure AOutBtnClick(Sender: TObject); + procedure BInBtnClick(Sender: TObject); + procedure BOutBtnClick(Sender: TObject); + procedure CInBtnClick(Sender: TObject); + procedure COutBtnClick(Sender: TObject); + procedure DataInBtnClick(Sender: TObject); + procedure DataOutBtnClick(Sender: TObject); + procedure DInBtnClick(Sender: TObject); + procedure DOutBtnClick(Sender: TObject); + procedure GrpInBtnClick(Sender: TObject); + procedure GrpOutBtnClick(Sender: TObject); + procedure PlanComboChange(Sender: TObject); + procedure VarListDblClick(Sender: TObject); + procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); private { private declarations } function CheckDataCol(ACol: Integer): boolean; function GetRange(ACol: Integer; out ARange, AMin, AMax: Integer): boolean; + procedure Plan1; procedure Plan2; procedure Plan3; @@ -37,25 +75,110 @@ type // procedure Plan8; procedure Plan9; + procedure PrepareForPlan(APlan: Integer); + procedure ResetPlan; + + protected + procedure AdjustConstraints; override; + procedure Compute; override; + procedure UpdateBtnStates; override; + function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; + public - { public declarations } + constructor Create(AOwner: TComponent); override; + procedure Reset; override; end; var - LatinSqrsFrm: TLatinSqrsFrm; + LatinSqrsForm: TLatinSqrsForm; + implementation +{$R *.lfm} + uses Math, - Utils, MathUnit; + Utils, MathUnit, GridProcs; const NO_VALID_NUMBER_ERROR = 'No valid number in row %d of variable "%s"'; -{ TLatinSqrsFrm } -function TLatinSqrsFrm.CheckDataCol(ACol: Integer): Boolean; +{ TLatinSqrsForm } + +constructor TLatinSqrsForm.Create(AOwner: TComponent); +begin + inherited; +end; + + +procedure TLatinSqrsForm.AdjustConstraints; +begin + inherited; + + ParamsPanel.Constraints.MinHeight := PlanPanel.Top + AInBtn.Top + + 12*AInBtn.Height + 6*AOutBtn.BorderSpacing.Top + 5*BInBtn.BorderSpacing.Top + + VarList.BorderSpacing.Bottom + nPerCellEdit.Height + + ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height; + + ParamsPanel.Constraints.MinWidth := MaxValue([ + 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left, + MaxValue([ACodeLabel.Width, BCodeLabel.Width, CCodeLabel.Width, DCodeLabel.Width, + GrpCodeLabel.Width, DepVarlabel.Width])*2 + AInBtn.Width + 2*VarList.BorderSpacing.Right + ]); +end; + + +procedure TLatinSqrsForm.AInBtnClick(Sender: TObject); +var + index: integer; +begin + index := VarList.ItemIndex; + if (index > -1) and (ACodeEdit.Text = '') then + begin + ACodeEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; + end; +end; + +procedure TLatinSqrsForm.AOutBtnClick(Sender: TObject); +begin + if ACodeEdit.Text <> '' then + begin + VarList.Items.Add(ACodeEdit.Text); + ACodeEdit.Text := ''; + UpdateBtnStates; + end; +end; + + +procedure TLatinSqrsForm.BInBtnClick(Sender: TObject); +var + index: integer; +begin + index := VarList.ItemIndex; + if (index > -1) and (BCodeEdit.Text = '') then + begin + BCodeEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; + end; +end; + +procedure TLatinSqrsForm.BOutBtnClick(Sender: TObject); +begin + if BCodeEdit.Text <> '' then + begin + VarList.Items.Add(BCodeEdit.Text); + BCodeEdit.Text := ''; + UpdateBtnStates; + end; +end; + + +function TLatinSqrsForm.CheckDataCol(ACol: Integer): Boolean; var i: Integer; value: Double; @@ -70,41 +193,95 @@ begin Result := true; end; -procedure TLatinSqrsFrm.ComputeBtnClick(Sender: TObject); + +procedure TLatinSqrsForm.CInBtnClick(Sender: TObject); var - btn: Integer; + index: integer; begin - btn := Plan.ItemIndex + 1; - case btn of - 1: Plan1; - 2: Plan2; - 3: Plan3; - 4: Plan4; - 5: Plan5; - 6: Plan6; - 7: Plan7; - 8: Plan9; + index := VarList.ItemIndex; + if (index > -1) and (CCodeEdit.Text = '') then + begin + CCodeEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; end; end; -procedure TLatinSqrsFrm.FormActivate(Sender: TObject); +procedure TLatinSqrsForm.COutBtnClick(Sender: TObject); +begin + if CCodeEdit.Text <> '' then + begin + VarList.Items.Add(CCodeEdit.Text); + CCodeEdit.Text := ''; + UpdateBtnStates; + end; +end; + + +procedure TLatinSqrsForm.Compute; +begin + case PlanCombo.ItemIndex of + 0: Plan1; + 1: Plan2; + 2: Plan3; + 3: Plan4; + 4: Plan5; + 5: Plan6; + 6: Plan7; + 7: Plan9; + end; +end; + + + +procedure TLatinSqrsForm.DataInBtnClick(Sender: TObject); var - w: Integer; + index: integer; begin - w := MaxValue([HelpBtn.Width, ComputeBtn.Width, CloseBtn.Width]); - HelpBtn.Constraints.MinWidth := w; - ComputeBtn.Constraints.MinWidth := w; - CloseBtn.Constraints.MinWidth := w; + index := VarList.ItemIndex; + if (index > -1) and (DepVarEdit.Text = '') then + begin + DepVarEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; + end; end; -procedure TLatinSqrsFrm.FormCreate(Sender: TObject); +procedure TLatinSqrsForm.DataOutBtnClick(Sender: TObject); begin - Assert(OS3MainFrm <> nil); - if LatinSpecsFrm = nil then - Application.CreateForm(TLatinSpecsFrm, LatinSpecsFrm); + if DepVarEdit.Text <> '' then + begin + VarList.Items.Add(DepVarEdit.Text); + DepVarEdit.Text := ''; + UpdateBtnStates; + end; end; -function TLatinSqrsFrm.GetRange(ACol: Integer; out ARange, AMin, AMax: Integer): boolean; +procedure TLatinSqrsForm.DInBtnClick(Sender: TObject); +var + index: integer; +begin + index := VarList.ItemIndex; + if (index > -1) and (DCodeEdit.Text = '') then + begin + DCodeEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; + end; +end; + +procedure TLatinSqrsForm.DOutBtnClick(Sender: TObject); +begin + if DCodeEdit.Text <> '' then + begin + VarList.Items.Add(DCodeEdit.Text); + DCodeEdit.Text := ''; + UpdateBtnStates; + end; +end; + + +function TLatinSqrsForm.GetRange(ACol: Integer; out ARange, AMin, AMax: Integer): boolean; var i: Integer; mn, mx, value: Double; @@ -130,14 +307,38 @@ begin ARange := AMax - AMin + 1; end; -procedure TLatinSqrsFrm.HelpBtnClick(Sender: TObject); + +procedure TLatinSqrsForm.GrpInBtnClick(Sender: TObject); +var + index: integer; begin - if ContextHelpForm = nil then - Application.CreateForm(TContextHelpForm, ContextHelpForm); - ContextHelpForm.HelpMessage((Sender as TButton).tag); + index := VarList.ItemIndex; + if (index > -1) and (GrpCodeEdit.Text = '') then + begin + GrpCodeEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; + end; end; -procedure TLatinSqrsFrm.Plan1; +procedure TLatinSqrsForm.GrpOutBtnClick(Sender: TObject); +begin + if GrpCodeEdit.Text <> '' then + begin + VarList.Items.Add(GrpCodeEdit.Text); + GrpCodeEdit.Text := ''; + UpdateBtnStates; + end; +end; + +procedure TLatinSqrsForm.PlanComboChange(Sender: TObject); +begin + PlanPanel.Visible := true; + PrepareForPlan(PlanCombo.ItemIndex); +end; + + +procedure TLatinSqrsForm.Plan1; var n: integer; // no. of subjects per cell Acol, Bcol, Ccol, DataCol: integer; // variable columns in grid @@ -160,17 +361,12 @@ var dfa, dfb, dfc, dfres, dfwithin, dftotal, fa, fb, fc, fpartial: double; proba, probb, probc, probpartial: double; lReport: TStrings; - begin - LatinSpecsFrm.PrepareForPlan(1); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -418,7 +614,7 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; @@ -429,7 +625,7 @@ begin end; end; -procedure TLatinSqrsFrm.Plan2; +procedure TLatinSqrsForm.Plan2; var n: integer; // no. of subjects per cell Acol, Bcol, Ccol, Dcol, DataCol: integer; // variable columns in grid @@ -446,11 +642,13 @@ var celltotals: DblDyneCube = nil; Ctotals: DblDyneVec = nil; design: StrDyneMat = nil; - G, term1, term2, term3, term4, term5, term6, term7, term8: double; + G, term1, term3, term4, term5, term6, term7, term8: double; term9, sumxsqr: double; sumAsqr, sumBsqr, sumCsqr, sumDsqr, SSA, SSB, SSC, SSD: double; sumADsqr, sumBDsqr, sumCDsqr: double; - ADmat, BDmat, CDmat: DblDyneMat; + ADmat: DblDyneMat = nil; + BDmat: DblDyneMat = nil; + CDmat: DblDyneMat = nil; SSAD, SSBD, SSCD, SSwithin, SSres, SStotal: double; MSa, MSb, MSc, MSd, MSAD, MSBD, MSCD, MSres, MSwithin: double; data, GrandMean: double; @@ -462,16 +660,12 @@ var lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(2); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - FactorD := LatinSpecsFrm.DCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + FactorD := DCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -537,7 +731,6 @@ begin sumBDsqr := 0.0; sumCDsqr := 0.0; term1 := 0.0; - term2 := 0.0; term3 := 0.0; term4 := 0.0; term5 := 0.0; @@ -623,7 +816,6 @@ begin G := GrandMean; term1 := (G * G) / (n * p * p * rangeD); - term2 := sumxsqr; term3 := sumAsqr / (n * p * rangeD); term4 := sumBsqr / (n * p * rangeD); term5 := sumCsqr / (n * p * rangeD); @@ -828,7 +1020,7 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; @@ -843,7 +1035,7 @@ begin end; end; -procedure TLatinSqrsFrm.Plan3; +procedure TLatinSqrsForm.Plan3; var n : integer; // no. of subjects per cell Acol, Bcol, Ccol, Dcol, DataCol: integer; // variable columns in grid @@ -856,16 +1048,18 @@ var i, j, k, m: integer; rangeA, rangeB, rangeC, rangeD: integer; minD, mn, mx: Integer; - cellcnts: IntDyneCube; - celltotals: DblDyneQuad; - ABmat, ACmat, BCmat: DblDyneMat; - ABCmat: DblDyneCube; - Atotals: DblDyneVec; - Btotals: DblDyneVec; - Ctotals: DblDyneVec; - Dtotals: DblDyneVec; - design: StrDyneMat; - G, term1, term2, term3, term4, term5, term6, term7, term8: double; + cellcnts: IntDyneCube = nil; + celltotals: DblDyneQuad = nil; + ABmat: DblDyneMat = nil; + ACmat: DblDyneMat = nil; + BCmat: DblDyneMat = nil; + ABCmat: DblDyneCube = nil; + Atotals: DblDyneVec = nil; + Btotals: DblDyneVec = nil; + Ctotals: DblDyneVec = nil; + Dtotals: DblDyneVec = nil; + design: StrDyneMat = nil; + G, term1, term3, term4, term5, term6, term7, term8: double; term9, term10, sumxsqr: double; sumAsqr, sumBsqr, sumCsqr, sumDsqr, SSA, SSB, SSC, SSD: double; sumABsqr, sumACsqr, sumBCsqr, sumABCsqr: double; @@ -879,16 +1073,12 @@ var probab, probac, probbc, probabc: double; lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(3); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - FactorD := LatinSpecsFrm.DCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + FactorD := DCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -969,7 +1159,6 @@ begin sumBCsqr := 0.0; sumABCsqr := 0.0; term1 := 0.0; - term2 := 0.0; term3 := 0.0; term4 := 0.0; term5 := 0.0; @@ -1061,7 +1250,6 @@ begin G := GrandMean; term1 := (G * G) / (n * p * p * p); - term2 := sumxsqr; term3 := sumAsqr / (n * p * p); term4 := sumBsqr / (n * p * p); term5 := sumCsqr / (n * p * p); @@ -1379,26 +1567,14 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally LReport.Free; - - Design := nil; - Dtotals := nil; - Ctotals := nil; - Btotals := nil; - Atotals := nil; - ABmat := nil; - ACmat := nil; - BCmat := nil; - ABCmat := nil; - celltotals := nil; - cellcnts := nil; end; end; -procedure TLatinSqrsFrm.Plan4; +procedure TLatinSqrsForm.Plan4; var n: integer; // no. of subjects per cell Acol, Bcol, Ccol, Dcol, DataCol: integer; // variable columns in grid @@ -1411,14 +1587,14 @@ var i, j, k: integer; rangeA, rangeB, rangeC, rangeD: integer; mn, mx: Integer; - cellcnts: IntDyneMat; - ABmat: DblDyneMat; - ABCmat: DblDyneCube; - Atotals: DblDyneVec; - Btotals: DblDyneVec; - Ctotals: DblDyneVec; - Dtotals: DblDyneVec; - design: StrDyneMat; + cellcnts: IntDyneMat = nil; + ABmat: DblDyneMat = nil; + ABCmat: DblDyneCube = nil; + Atotals: DblDyneVec = nil; + Btotals: DblDyneVec = nil; + Ctotals: DblDyneVec = nil; + Dtotals: DblDyneVec = nil; + design: StrDyneMat = nil; G, term1, term2, term3, term4, term5, term6, term7: double; sumxsqr: double; sumAsqr, sumBsqr, sumCsqr, sumDsqr, SSA, SSB, SSC, SSD: double; @@ -1432,16 +1608,12 @@ var lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(4); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - FactorD := LatinSpecsFrm.DCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + FactorD := DCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -1862,23 +2034,14 @@ begin for i := 1 to rangeD + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; - - Design := nil; - Dtotals := nil; - Ctotals := nil; - Btotals := nil; - Atotals := nil; - cellcnts := nil; - ABCmat := nil; - ABmat := nil; end; end; -procedure TLatinSqrsFrm.Plan5; +procedure TLatinSqrsForm.Plan5; var n: integer; // no. of subjects per cell Acol, Bcol, SbjCol, Grpcol, DataCol: integer; // variable columns in grid @@ -1891,16 +2054,16 @@ var i, j, k: integer; mn, mx: Integer; rangeA, rangeB, rangeGrp: integer; - cellcnts: IntDyneMat; - ABmat: DblDyneMat; - ABCmat: DblDyneCube; - GBmat: DblDyneMat; - Atotals: DblDyneVec; - Btotals: DblDyneVec; - Grptotals: DblDyneVec; - Subjtotals: DblDyneMat; - design: StrDyneMat; - term1, term2, term3, term4, term5, term6, term7: double; + cellcnts: IntDyneMat = nil; + ABmat: DblDyneMat = nil; + ABCmat: DblDyneCube = nil; + GBmat: DblDyneMat = nil; + Atotals: DblDyneVec = nil; + Btotals: DblDyneVec = nil; + Grptotals: DblDyneVec = nil; + Subjtotals: DblDyneMat = nil; + design: StrDyneMat = nil; + term1, term3, term4, term5, term6, term7: double; sumxsqr: double; SSbetsubj, SSgroups, SSsubwGrps, SSwithinsubj, SSa, SSb, SSab: double; SSerrwithin, SStotal, MSgroups, MSsubwGrps, MSa, MSb, MSab: double; @@ -1910,21 +2073,18 @@ var p, row, col, subject, group: integer; proba, probb, probab, probgrps: double; fa, fb, fab, fgroups: double; - RowLabels, ColLabels: StrDyneVec; + RowLabels: StrDyneVec = nil; + ColLabels: StrDyneVec = nil; Title: string; lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(5); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - SubjectFactor := LatinSpecsFrm.CCodeEdit.Text; - GroupFactor := LatinSpecsFrm.GrpCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + SubjectFactor := CCodeEdit.Text; + GroupFactor := GrpCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -1997,7 +2157,6 @@ begin sumxsqr := 0.0; term1 := 0.0; - term2 := 0.0; term3 := 0.0; term4 := 0.0; term5 := 0.0; @@ -2107,7 +2266,6 @@ begin // get correction term term1 := (GrandMean * GrandMean) / (n * p * p); - term2 := sumxsqr; // get sum of squared a's for term3 for j := 0 to p-1 do @@ -2357,26 +2515,14 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; - - GBmat := nil; - ColLabels := nil; - RowLabels := nil; - Subjtotals := nil; - Design := nil; - Grptotals := nil; - Btotals := nil; - Atotals := nil; - cellcnts := nil; - ABCmat := nil; - ABmat := nil; end; end; -procedure TLatinSqrsFrm.Plan6; +procedure TLatinSqrsForm.Plan6; var n: integer; // no. of subjects per cell Acol, Bcol, SbjCol, GrpCol, DataCol: Integer; // variable columns in grid @@ -2389,16 +2535,16 @@ var i, j, k: integer; rangeA, rangeB, rangeGrp: integer; mn, mx: Integer; - cellcnts: IntDyneMat; - ABmat: DblDyneMat; - ABCmat: DblDyneCube; - GBmat: DblDyneMat; - Atotals: DblDyneVec; - Btotals: DblDyneVec; - Grptotals: DblDyneVec; - Subjtotals: DblDyneMat; - design: StrDyneMat; - term1, term2, term3, term4, term5, term6, term7: double; + cellcnts: IntDyneMat = nil; + ABmat: DblDyneMat = nil; + ABCmat: DblDyneCube = nil; + GBmat: DblDyneMat = nil; + Atotals: DblDyneVec = nil; + Btotals: DblDyneVec = nil; + Grptotals: DblDyneVec = nil; + Subjtotals: DblDyneMat = nil; + design: StrDyneMat = nil; + term1, term3, term4, term5, term6, term7: double; sumxsqr: double; SSbetsubj, SSgroups, SSsubwGrps, SSwithinsubj, SSa, SSb, SSab: double; SSerrwithin, SStotal, MSgroups, MSsubwGrps, MSa, MSb, MSab: double; @@ -2408,21 +2554,18 @@ var p, row, col, subject, group: integer; proba, probb, probab, probgrps: double; fa, fb, fab, fgroups: double; - RowLabels, ColLabels: StrDyneVec; + RowLabels: StrDyneVec = nil; + ColLabels: StrDyneVec = nil; Title: string; lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(6); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - SubjectFactor := LatinSpecsFrm.CCodeEdit.Text; - GroupFactor := LatinSpecsFrm.GrpCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + SubjectFactor := CCodeEdit.Text; + GroupFactor := GrpCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -2495,7 +2638,6 @@ begin sumxsqr := 0.0; term1 := 0.0; - term2 := 0.0; term3 := 0.0; term4 := 0.0; term5 := 0.0; @@ -2606,7 +2748,6 @@ begin // get correction term term1 := sqr(GrandMean) / (n * p * p); - term2 := sumxsqr; // get sum of squared a's for term3 for j := 0 to p-1 do @@ -2853,26 +2994,15 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; - - GBmat := nil; - ColLabels := nil; - RowLabels := nil; - Subjtotals := nil; - Design := nil; - Grptotals := nil; - Btotals := nil; - Atotals := nil; - cellcnts := nil; - ABCmat := nil; - ABmat := nil; end; end; -procedure TLatinSqrsFrm.Plan7; + +procedure TLatinSqrsForm.Plan7; var n: integer; // no. of subjects per cell Acol, Bcol, Ccol, SbjCol, Grpcol, DataCol: integer; // variable columns in grid @@ -2886,17 +3016,17 @@ var i, j, k: integer; rangeA, rangeB, rangeC, rangeGrp: integer; mn, mx: Integer; - cellcnts: IntDyneMat; - ABmat: DblDyneMat; - ABCmat: DblDyneCube; - GBmat: DblDyneMat; - GCmat: DblDyneMat; - Atotals: DblDyneVec; - Btotals: DblDyneVec; - Ctotals: DblDyneVec; - Grptotals: DblDyneVec; - Subjtotals: DblDyneMat; - design: StrDyneMat; + cellcnts: IntDyneMat = nil; + ABmat: DblDyneMat = nil; + ABCmat: DblDyneCube = nil; + GBmat: DblDyneMat = nil; + GCmat: DblDyneMat = nil; + Atotals: DblDyneVec = nil; + Btotals: DblDyneVec = nil; + Ctotals: DblDyneVec = nil; + Grptotals: DblDyneVec = nil; + Subjtotals: DblDyneMat = nil; + design: StrDyneMat = nil; term1, term2, term3, term4, term5, term6, term7, term8, term9: double; sumxsqr: double; SSbetsubj, SSgroups, SSsubwGrps, SSwithinsubj, SSa, SSb, SSc, SSab: double; @@ -2907,22 +3037,19 @@ var p, row, col, slice, subject, group: integer; proba, probb, probc, probab, probgrps: double; fa, fb, fc, fab, fgroups: double; - RowLabels, ColLabels: StrDyneVec; + RowLabels: StrDyneVec = nil; + ColLabels: StrDyneVec = nil; Title: string; lReport: TStrings; begin - LatinSpecsFrm.PrepareForPlan(7); - if LatinSpecsFrm.ShowModal <> mrOK then - exit; - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - SubjectFactor := LatinSpecsFrm.DCodeEdit.Text; - GroupFactor := LatinSpecsFrm.GrpCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + n := StrToInt(nPerCellEdit.Text); + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + SubjectFactor := DCodeEdit.Text; + GroupFactor := GrpCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -3424,30 +3551,16 @@ begin for i := 1 to p + 1 do cellstring := cellstring + '----------'; lReport.Add(cellstring); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; - - GCmat := nil; - GBmat := nil; - ColLabels := nil; - RowLabels := nil; - Subjtotals := nil; - Design := nil; - Grptotals := nil; - Ctotals := nil; - Btotals := nil; - Atotals := nil; - cellcnts := nil; - ABCmat := nil; - ABmat := nil; end; end; -procedure TLatinSqrsFrm.Plan9; +procedure TLatinSqrsForm.Plan9; var - row, col, slice, group, index: integer; + row, col, group, index: integer; Acol, Bcol, Ccol, SbjCol, Grpcol, DataCol: integer; // variable columns in grid FactorA: string; FactorB: string; @@ -3460,15 +3573,23 @@ var mn, mx: Integer; n, subject, nosubjects, rangeA, rangeB, rangeC, rangeGrp: integer; p, q, rows: integer; - ABC, AGC: DblDyneCube; - AB, AC, BC, RC: DblDyneMat; - A, B, C, Persons, Gm, R: DblDyneVec; - cellcnts: IntDyneVec; - Design: StrDyneMat; - RowLabels: StrDyneVec; - ColLabels: StrDyneVec; - G, sumxsqr, sumAsqr, sumBsqr, sumABsqr, sumACsqr: double; - sumBCsqr, sumABCsqr, sumPsqr, sumGmsqr, sumRsqr: double; + ABC: DblDyneCube = nil; + AGC: DblDyneCube = nil; + AB: DblDyneMat = nil; + AC: DblDyneMat = nil; + BC: DblDyneMat = nil; + RC: DblDyneMat = nil; + A: DblDyneVec = nil; + B: DblDyneVec = nil; + C: DblDyneVec = nil; + Persons: DblDyneVec = nil; + Gm: DblDyneVec = nil; + R: DblDyneVec = nil; + cellcnts: IntDyneVec = nil; + Design: StrDyneMat = nil; + RowLabels: StrDyneVec = nil; + ColLabels: StrDyneVec = nil; + G, sumxsqr: double; SSbetsubj, SSc, SSrows, SScxrow, SSsubwgrps, SSa: double; SSwithinsubj, SSerrwithin: double; SSb, SSac, SSbc, SSabprime, SSABCprime, SStotal: double; @@ -3478,13 +3599,14 @@ var dfbc, dfabprime, dfabcprime,dferrwithin, dftotal, dfbetsubj: double; MSc, MSrows, MScxrow, MSsubwgrps, MSa: double; MSb, MSac, MSbc, MSabprime, MSabcprime, MSerrwithin: double; - fc, frows, fcxrow, fsubwgrps, fa, fb, fac, fbc, fabprime, fabcprime: double; - probc, probrows, probcxrow, probsubwgrps, proba, probb: double; + fc, frows, fcxrow, fa, fb, fac, fbc, fabprime, fabcprime: double; + probc, probrows, probcxrow, proba, probb: double; probac, probbc, probabprime, probabcprime: double; data, value: double; lReport: TStrings; begin + { cellstring := LatinSpecsFrm.DCodeLabel.Caption; // get current label LatinSpecsFrm.DCodeLabel.Caption := 'Subject No.'; // set new label LatinSpecsFrm.PrepareForPlan(9); @@ -3492,14 +3614,14 @@ begin exit; LatinSpecsFrm.DCodeLabel.Caption := cellstring; // restore label - - n := StrToInt(LatinSpecsFrm.nPerCellEdit.Text); // no. persons per cell - FactorA := LatinSpecsFrm.ACodeEdit.Text; - FactorB := LatinSpecsFrm.BCodeEdit.Text; - FactorC := LatinSpecsFrm.CCodeEdit.Text; - SubjectFactor := LatinSpecsFrm.DCodeEdit.Text; - GroupFactor := LatinSpecsFrm.GrpCodeEdit.Text; - DataVar := LatinSpecsFrm.DepVarEdit.Text; + } + n := StrToInt(nPerCellEdit.Text); // no. persons per cell + FactorA := ACodeEdit.Text; + FactorB := BCodeEdit.Text; + FactorC := CCodeEdit.Text; + SubjectFactor := DCodeEdit.Text; + GroupFactor := GrpCodeEdit.Text; + DataVar := DepVarEdit.Text; for i := 1 to NoVariables do begin @@ -3605,16 +3727,6 @@ begin // initialize single values G := 0.0; sumxsqr := 0.0; - sumAsqr := 0.0; - sumBsqr := 0.0; - sumABsqr := 0.0; - sumACsqr := 0.0; - sumBCsqr := 0.0; - sumABCsqr := 0.0; - sumRsqr := 0.0; - sumGmsqr := 0.0; - sumRsqr := 0.0; - sumPsqr := 0.0; term2 := 0.0; term3 := 0.0; term4 := 0.0; @@ -3881,7 +3993,6 @@ begin fc := MSc / MSsubwgrps; frows := MSrows / MSsubwgrps; fcxrow := MScxrow / MSsubwgrps; - fsubwgrps := MSsubwgrps / MSerrwithin; fa := MSa / MSerrwithin; fb := MSb / MSerrwithin; fac := MSac / MSerrwithin; @@ -3892,7 +4003,6 @@ begin probc := probf(fc,dfc,dfsubwgrps); probrows := probf(frows,dfrows,dfsubwgrps); probcxrow := probf(fcxrow,dfcxrow,dfsubwgrps); - probsubwgrps := probf(fsubwgrps,dfsubwgrps,dferrwithin); proba := probf(fa,dfa,dferrwithin); probb := probf(fb,dfb,dferrwithin); probac := probf(fac,dfac,dferrwithin); @@ -3949,7 +4059,7 @@ begin begin row := round(StrToFloat(OS3MainFrm.DataGrid.Cells[Acol,i])); // A (column) effect col := round(StrToFloat(OS3MainFrm.DataGrid.Cells[Bcol,i])); // B (cell) effect - slice := round(StrToFloat(OS3MainFrm.DataGrid.Cells[Ccol,i])); // C (cell) effect +// slice := round(StrToFloat(OS3MainFrm.DataGrid.Cells[Ccol,i])); // C (cell) effect group := round(StrToFloat(OS3MainFrm.DataGrid.Cells[Grpcol,i])); // group (row) Design[group-1, row-1] := 'B' + IntToStr(col); end; @@ -4068,32 +4178,203 @@ begin cellstring := 'Subjects Means'; DynVectorPrint(Persons, nosubjects+1, cellstring, ColLabels, n*p*p*q, lReport); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; - - ColLabels := nil; - RowLabels := nil; - Design := nil; - cellcnts := nil; - R := nil; - Gm := nil; - Persons := nil; - C := nil; - B := nil; - A := nil; - RC := nil; - BC := nil; - AC := nil; - AB := nil; - AGC := nil; - ABC := nil; end; end; -initialization - {$I latinsqrsunit.lrs} +procedure TLatinSqrsForm.PrepareForPlan(APlan: Integer); +begin + ResetPlan; + +// DInBtn.Visible := APlan in [2, 3, 4, 7, 9]; + DInBtn.Visible := APlan in [1, 2, 3, 6, 8]; + DOutBtn.Visible := DInBtn.Visible; + DCodeLabel.Visible := DInBtn.Visible; + DCodeEdit.Visible := DInBtn.Visible; + +// GrpInBtn.Visible := APlan in [5, 6, 7, 9]; + GrpInBtn.Visible := APlan in [4, 5, 6, 7]; + GrpOutBtn.Visible := GrpInBtn.Visible; + GrpCodeLabel.Visible := GrpInBtn.Visible; + GrpCodeEdit.Visible := GrpInBtn.Visible; + (* + case APlan of + 1: begin + PanelD.Visible := false; + PanelGrp.Visible := false; + end; + 2: begin + PanelD.Visible := true; + PanelGrp.Visible := false; + end; + 3: begin + PanelD.Visible := true; + PanelGrp.Visible := false; + end; + 4: begin + PanelD.Visible := true; + PanelGrp.Visible := false; + end; + 5: begin + PanelD.Visible := false; + PanelGrp.Visible := true; + end; + 6: begin + PanelD.Visible := false; + PanelGrp.Visible := true; + end; + 7: begin + PanelD.Visible := true; + PanelGrp.Visible := true; + end; + 9: begin + PanelD.Visible := true; + PanelGrp.Visible := true; + end; + end; + *) +end; + +procedure TLatinSqrsForm.Reset; +begin + inherited; +end; + + +procedure TLatinSqrsForm.ResetPlan; +begin + CollectVariableNames(OS3MainFrm.DataGrid, VarList.Items); + ACodeEdit.Clear; + BCodeEdit.Clear; + CCodeEdit.Clear; + DCodeEdit.Clear; + GrpCodeEdit.Clear; + DepVarEdit.Clear; + nPerCellEdit.Clear; + UpdateBtnStates; +end; + + +procedure TLatinSqrsForm.UpdateBtnStates; +begin + inherited; + + AInBtn.Enabled := (VarList.ItemIndex > -1) and (ACodeEdit.Text = ''); + BInBtn.Enabled := (VarList.ItemIndex > -1) and (BCodeEdit.Text = ''); + CInBtn.Enabled := (VarList.ItemIndex > -1) and (CCodeEdit.Text = ''); + DInBtn.Enabled := (VarList.ItemIndex > -1) and (DCodeEdit.Text = ''); + GrpInBtn.Enabled := (VarList.ItemIndex > -1) and (GrpCodeEdit.Text = ''); + DataInBtn.Enabled := (VarList.ItemIndex > -1) and (DepVarEdit.Text = ''); + + AOutBtn.Enabled := (ACodeEdit.Text <> ''); + BOutBtn.Enabled := (BCodeEdit.Text <> ''); + COutBtn.Enabled := (CCodeEdit.Text <> ''); + DOutBtn.Enabled := (DCodeEdit.Text <> ''); + GrpOutBtn.Enabled := (GrpCodeEdit.Text <> ''); + DataOutBtn.Enabled := (DepVarEdit.Text <> ''); +end; + + +function TLatinSqrsForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean; +var + n: Integer; +begin + Result := false; + + if (nPerCellEdit.Text = '') then begin + AMsg := 'Please specify the number of cases per cell.'; + AControl := nPercellEdit; + exit; + end; + if not TryStrToInt(nPerCellEdit.Text, n) or (n <= 0) then begin + AMsg := 'Please specify a valid (positive) number for the cases per cell.'; + AControl := nPercellEdit; + exit; + end; + + if ACodeEdit.Visible and (ACodeEdit.Text = '') then + begin + AMsg := 'Factor A code variable is not specified.'; + AControl := ACodeEdit; + exit; + end; + if BCodeEdit.Visible and (BCodeEdit.Text = '') then + begin + AMsg := 'Factor B code variable is not specified.'; + Acontrol := BCodeEdit; + exit; + end; + if CCodeEdit.Visible and (CCodeEdit.Text = '') then + begin + AMsg := 'Factor C code variable is not specified.'; + Acontrol := CCodeEdit; + exit; + end; + if DCodeEdit.Visible and (DCodeEdit.Text = '') then + begin + AMsg := 'Factor D code variable is not specified.'; + Acontrol := DCodeEdit; + exit; + end; + if GrpCodeEdit.Visible and (GrpCodeEdit.Text = '') then + begin + AMsg := 'Group code variable is not specified.'; + Acontrol := GrpCodeEdit; + exit; + end; + if DepVarEdit.Visible and (DepVarEdit.Text = '') then + begin + AMsg := 'Dependent variable is not specified.'; + Acontrol := DepVarEdit; + exit; + end; + + Result := true; +end; + + +procedure TLatinSqrsForm.VarListDblClick(Sender: TObject); +var + index: Integer; + s: String; +begin + index := VarList.ItemIndex; + if index > -1 then + begin + s := VarList.Items[index]; + if (ACodeEdit.Text = '') and ACodeEdit.Visible then + ACodeEdit.Text := s + else + if (BCodeEdit.Text = '') and BCodeEdit.Visible then + BCodeEdit.Text := s + else + if (CCodeEdit.Text = '') and CCodeEdit.Visible then + CCodeEdit.Text := s + else + if (DCodeEdit.Text = '') and DCodeEdit.Visible then + DCodeEdit.Text := s + else + if (GrpCodeEdit.Text = '') and GrpCodeEdit.Visible then + GrpCodeEdit.Text := s + else + if (DepVarEdit.Text = '') and DepVarEdit.Visible then + DepVarEdit.Text := s + else + exit; + VarList.Items.Delete(index); + UpdateBtnStates; + end; +end; + + +procedure TLatinSqrsForm.VarListSelectionChange(Sender: TObject; User: boolean); +begin + UpdateBtnStates; +end; + end. diff --git a/applications/lazstats/source/forms/analysis/cross-classification/loglinscreenunit.pas b/applications/lazstats/source/forms/analysis/cross-classification/loglinscreenunit.pas index 9d8f5ce8a..794f8bbce 100644 --- a/applications/lazstats/source/forms/analysis/cross-classification/loglinscreenunit.pas +++ b/applications/lazstats/source/forms/analysis/cross-classification/loglinscreenunit.pas @@ -963,8 +963,12 @@ Label const ZERO = 0.0; var - ISZ, MAX, LIM, I, J, NV1, M, M1, ITP, NP, NP1, L3, DF: integer; - G21, G22, G23, AVG: double; + ISZ, MAX, LIM, I, J, NV1, M, M1, ITP, NP, NP1, L3: integer; + DF: Integer = 0; + G21: Double = 0.0; + G22: Double = 0.0; + G23: Double = 0.0; + AVG: double; begin // diff --git a/applications/lazstats/source/forms/analysis/measurement_programs/raschunit.pas b/applications/lazstats/source/forms/analysis/measurement_programs/raschunit.pas index d9aa0799f..9345faa8d 100644 --- a/applications/lazstats/source/forms/analysis/measurement_programs/raschunit.pas +++ b/applications/lazstats/source/forms/analysis/measurement_programs/raschunit.pas @@ -239,7 +239,6 @@ var NoSelected : integer; ColNoSelected : IntDyneVec = nil; finished : boolean; - error : integer; lReport: TStrings; begin SetLength(ColNoSelected,NoVariables); diff --git a/applications/lazstats/source/forms/mainunit.pas b/applications/lazstats/source/forms/mainunit.pas index 18e2909a1..d06ad70de 100644 --- a/applications/lazstats/source/forms/mainunit.pas +++ b/applications/lazstats/source/forms/mainunit.pas @@ -1844,9 +1844,9 @@ end; // Menu "Analysis" > "Comparisons" > "Latin and Greco-Latin Squares" procedure TOS3MainFrm.mnuAnalysisComp_LatinSquaresClick(Sender: TObject); begin - if LatinSqrsFrm = nil then - Application.CreateForm(TLatinSqrsFrm, LatinSqrsFrm); - LatinSqrsFrm.ShowModal; + if LatinSqrsForm = nil then + Application.CreateForm(TLatinSqrsForm, LatinSqrsForm); + LatinSqrsForm.Show; end; // Menu "Analysis" > "Comparisons" > "ABC Anova with B Nested in A" diff --git a/applications/lazstats/source/units/functionslib.pas b/applications/lazstats/source/units/functionslib.pas index 0af860d6d..2bb637e2b 100644 --- a/applications/lazstats/source/units/functionslib.pas +++ b/applications/lazstats/source/units/functionslib.pas @@ -120,10 +120,10 @@ label var // vtimesw, v, ainverse : matrix; // w : vector; - ainverse : array of array of double; + ainverse : array of array of double = nil; m, nm,l,k,j,its,i: integer; z,y,x,scale,s,h,g,f,c,anorm: double; - rv1: array of double; + rv1: array of double = nil; BEGIN setlength(rv1,n); @@ -930,7 +930,9 @@ procedure SVDinverse(VAR a : DblDyneMat; N : integer); // a shorter version of the matinv routine that ignores v, w, and vtimes w // matrices in the singular value decompensation inverse procedure var - v, w, vtimesw : DblDyneMat; + v: DblDyneMat = nil; + w: DblDyneMat = nil; + vtimesw: DblDyneMat = nil; begin SetLength(v,N,N); SetLength(w,N,N); @@ -1387,8 +1389,9 @@ end; // End ord function procedure Rank(v1col : integer; VAR Values : DblDyneVec); // calculates the ranks for values stored in the data grid in column v1col var - pcntiles, CatValues : DblDyneVec; - freq : IntDyneVec; + pcntiles: DblDyneVec = nil; + CatValues : DblDyneVec = nil; + freq : IntDyneVec = nil; i, j, nocats : integer; Temp, cumfreq, upper, lower : double; @@ -1463,8 +1466,11 @@ procedure PRank(v1col: integer; var Values: DblDyneVec; AReport: TStrings); // computes the percentile ranks of values stored in the data grid // at column v1col var - pcntiles, cumfm, CatValues: DblDyneVec; - freq, cumf: IntDyneVec; + pcntiles: DblDyneVec = nil; + cumfm: DblDyneVec = nil; + CatValues: DblDyneVec = nil; + freq: IntDyneVec = nil; + cumf: IntDyneVec = nil; Temp: double; i, j, nocats, ncases: integer; begin