You've already forked lazarus-ccr
LazStats: Inherit MannWhitUUnit from TBasicStatsReportForm
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7812 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -721,7 +721,7 @@
|
|||||||
<Unit77>
|
<Unit77>
|
||||||
<Filename Value="forms\analysis\nonparametric\mannwhituunit.pas"/>
|
<Filename Value="forms\analysis\nonparametric\mannwhituunit.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="MannWhitUFrm"/>
|
<ComponentName Value="MannWhitUForm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="MannWhitUUnit"/>
|
<UnitName Value="MannWhitUUnit"/>
|
||||||
|
@ -1,37 +1,47 @@
|
|||||||
object MannWhitUFrm: TMannWhitUFrm
|
inherited MannWhitUForm: TMannWhitUForm
|
||||||
Left = 540
|
Left = 540
|
||||||
Height = 321
|
Height = 400
|
||||||
Top = 256
|
Top = 256
|
||||||
Width = 373
|
Width = 654
|
||||||
HelpType = htKeyword
|
HelpType = htKeyword
|
||||||
HelpKeyword = 'html/Mann-WhitneyUTest.htm'
|
HelpKeyword = 'html/Mann-WhitneyUTest.htm'
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Mann-Whitney U Test'
|
Caption = 'Mann-Whitney U Test'
|
||||||
ClientHeight = 321
|
ClientHeight = 400
|
||||||
ClientWidth = 373
|
ClientWidth = 654
|
||||||
OnActivate = FormActivate
|
inherited ParamsPanel: TPanel
|
||||||
OnCreate = FormCreate
|
Height = 384
|
||||||
OnShow = FormShow
|
ClientHeight = 384
|
||||||
Position = poMainFormCenter
|
inherited CloseBtn: TButton
|
||||||
LCLVersion = '2.1.0.0'
|
Top = 359
|
||||||
object Label1: TLabel
|
end
|
||||||
AnchorSideLeft.Control = Owner
|
inherited ComputeBtn: TButton
|
||||||
AnchorSideTop.Control = Owner
|
Top = 359
|
||||||
Left = 8
|
end
|
||||||
|
inherited ResetBtn: TButton
|
||||||
|
Top = 359
|
||||||
|
end
|
||||||
|
inherited HelpBtn: TButton
|
||||||
|
Top = 359
|
||||||
|
end
|
||||||
|
inherited ButtonBevel: TBevel
|
||||||
|
Top = 343
|
||||||
|
end
|
||||||
|
object Label1: TLabel[5]
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideTop.Control = ParamsPanel
|
||||||
|
Left = 0
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 8
|
Top = 0
|
||||||
Width = 97
|
Width = 97
|
||||||
BorderSpacing.Left = 8
|
Caption = 'Available Variables'
|
||||||
BorderSpacing.Top = 8
|
|
||||||
Caption = 'Variables Available'
|
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label2: TLabel[6]
|
||||||
AnchorSideLeft.Control = GrpEdit
|
AnchorSideLeft.Control = GrpEdit
|
||||||
AnchorSideBottom.Control = GrpEdit
|
AnchorSideBottom.Control = GrpEdit
|
||||||
Left = 245
|
Left = 164
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 33
|
Top = 21
|
||||||
Width = 77
|
Width = 77
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@ -39,12 +49,12 @@ object MannWhitUFrm: TMannWhitUFrm
|
|||||||
Caption = 'Group Variable'
|
Caption = 'Group Variable'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object Label3: TLabel[7]
|
||||||
AnchorSideLeft.Control = DepEdit
|
AnchorSideLeft.Control = DepEdit
|
||||||
AnchorSideBottom.Control = DepEdit
|
AnchorSideBottom.Control = DepEdit
|
||||||
Left = 245
|
Left = 164
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 125
|
Top = 109
|
||||||
Width = 102
|
Width = 102
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@ -52,198 +62,125 @@ object MannWhitUFrm: TMannWhitUFrm
|
|||||||
Caption = 'Dependent Variable'
|
Caption = 'Dependent Variable'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object VarList: TListBox
|
object VarList: TListBox[8]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = Label1
|
AnchorSideTop.Control = Label1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = GrpIn
|
AnchorSideRight.Control = GrpIn
|
||||||
AnchorSideBottom.Control = Bevel2
|
AnchorSideBottom.Control = ButtonBevel
|
||||||
Left = 8
|
Left = 0
|
||||||
Height = 247
|
Height = 326
|
||||||
Top = 25
|
Top = 17
|
||||||
Width = 193
|
Width = 126
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Top = 2
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 6
|
||||||
Constraints.MinHeight = 200
|
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
|
OnDblClick = VarListDblClick
|
||||||
OnSelectionChange = VarListSelectionChange
|
OnSelectionChange = VarListSelectionChange
|
||||||
TabOrder = 0
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object GrpIn: TBitBtn
|
object GrpIn: TBitBtn[9]
|
||||||
AnchorSideLeft.Control = Bevel3
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = VarList
|
AnchorSideTop.Control = VarList
|
||||||
Left = 209
|
Left = 132
|
||||||
Height = 28
|
Height = 26
|
||||||
Top = 25
|
Top = 17
|
||||||
Width = 28
|
Width = 26
|
||||||
Images = MainDataModule.ImageList
|
Images = MainDataModule.ImageList
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
OnClick = GrpInClick
|
OnClick = GrpInClick
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 1
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object GrpOut: TBitBtn
|
object GrpOut: TBitBtn[10]
|
||||||
AnchorSideLeft.Control = Bevel3
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = GrpIn
|
AnchorSideTop.Control = GrpIn
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 209
|
Left = 132
|
||||||
Height = 28
|
Height = 26
|
||||||
Top = 57
|
Top = 47
|
||||||
Width = 28
|
Width = 26
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
Images = MainDataModule.ImageList
|
Images = MainDataModule.ImageList
|
||||||
ImageIndex = 0
|
ImageIndex = 0
|
||||||
OnClick = GrpOutClick
|
OnClick = GrpOutClick
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 2
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
object DepIn: TBitBtn
|
object DepIn: TBitBtn[11]
|
||||||
AnchorSideLeft.Control = Bevel3
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = GrpOut
|
AnchorSideTop.Control = GrpOut
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 209
|
Left = 132
|
||||||
Height = 28
|
Height = 26
|
||||||
Top = 117
|
Top = 105
|
||||||
Width = 28
|
Width = 26
|
||||||
BorderSpacing.Top = 32
|
BorderSpacing.Top = 32
|
||||||
Images = MainDataModule.ImageList
|
Images = MainDataModule.ImageList
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
OnClick = DepInClick
|
OnClick = DepInClick
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 3
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
object DepOut: TBitBtn
|
object DepOut: TBitBtn[12]
|
||||||
AnchorSideLeft.Control = Bevel3
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = DepIn
|
AnchorSideTop.Control = DepIn
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 209
|
Left = 132
|
||||||
Height = 28
|
Height = 26
|
||||||
Top = 149
|
Top = 135
|
||||||
Width = 28
|
Width = 26
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
Images = MainDataModule.ImageList
|
Images = MainDataModule.ImageList
|
||||||
ImageIndex = 0
|
ImageIndex = 0
|
||||||
OnClick = DepOutClick
|
OnClick = DepOutClick
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 4
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
object GrpEdit: TEdit
|
object GrpEdit: TEdit[13]
|
||||||
AnchorSideLeft.Control = GrpIn
|
AnchorSideLeft.Control = GrpIn
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = GrpOut
|
AnchorSideBottom.Control = GrpOut
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 245
|
Left = 164
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 50
|
Top = 38
|
||||||
Width = 120
|
Width = 127
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 12
|
BorderSpacing.Bottom = 12
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 5
|
TabOrder = 9
|
||||||
Text = 'GrpEdit'
|
Text = 'GrpEdit'
|
||||||
end
|
end
|
||||||
object DepEdit: TEdit
|
object DepEdit: TEdit[14]
|
||||||
AnchorSideLeft.Control = DepIn
|
AnchorSideLeft.Control = DepIn
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = DepOut
|
AnchorSideBottom.Control = DepOut
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 245
|
Left = 164
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 142
|
Top = 126
|
||||||
Width = 120
|
Width = 127
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 12
|
BorderSpacing.Bottom = 12
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 6
|
TabOrder = 10
|
||||||
Text = 'Edit1'
|
Text = 'DepEdit'
|
||||||
end
|
end
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
AnchorSideBottom.Control = Owner
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 164
|
|
||||||
Height = 25
|
|
||||||
Top = 288
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 7
|
|
||||||
end
|
end
|
||||||
object ComputeBtn: TButton
|
inherited ParamsSplitter: TSplitter
|
||||||
AnchorSideRight.Control = CloseBtn
|
Height = 400
|
||||||
AnchorSideBottom.Control = Owner
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 226
|
|
||||||
Height = 25
|
|
||||||
Top = 288
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 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 = 310
|
|
||||||
Height = 25
|
|
||||||
Top = 288
|
|
||||||
Width = 55
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Close'
|
|
||||||
ModalResult = 11
|
|
||||||
TabOrder = 9
|
|
||||||
end
|
|
||||||
object Bevel2: TBevel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = CloseBtn
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 272
|
|
||||||
Width = 373
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
|
||||||
object Bevel3: TBevel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideLeft.Side = asrCenter
|
|
||||||
Left = 163
|
|
||||||
Height = 11
|
|
||||||
Top = 7
|
|
||||||
Width = 46
|
|
||||||
Shape = bsSpacer
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -7,106 +7,76 @@ unit MannWhitUUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, Buttons, ExtCtrls,
|
StdCtrls, Buttons, ExtCtrls,
|
||||||
MainUnit, OutputUnit, FunctionslIB, Globals, DataProcs;
|
MainUnit, FunctionslIB, Globals, DataProcs, BasicStatsReportFormUnit;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TMannWhitUFrm }
|
{ TMannWhitUForm }
|
||||||
|
|
||||||
TMannWhitUFrm = class(TForm)
|
TMannWhitUForm = class(TBasicStatsReportForm)
|
||||||
Bevel2: TBevel;
|
|
||||||
Bevel3: TBevel;
|
Bevel3: TBevel;
|
||||||
GrpIn: TBitBtn;
|
GrpIn: TBitBtn;
|
||||||
GrpOut: TBitBtn;
|
GrpOut: TBitBtn;
|
||||||
DepIn: TBitBtn;
|
DepIn: TBitBtn;
|
||||||
DepOut: TBitBtn;
|
DepOut: TBitBtn;
|
||||||
ResetBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
GrpEdit: TEdit;
|
GrpEdit: TEdit;
|
||||||
DepEdit: TEdit;
|
DepEdit: TEdit;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
VarList: TListBox;
|
VarList: TListBox;
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
|
||||||
procedure DepInClick(Sender: TObject);
|
procedure DepInClick(Sender: TObject);
|
||||||
procedure DepOutClick(Sender: TObject);
|
procedure DepOutClick(Sender: TObject);
|
||||||
procedure FormActivate(Sender: TObject);
|
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
procedure FormShow(Sender: TObject);
|
|
||||||
procedure GrpInClick(Sender: TObject);
|
procedure GrpInClick(Sender: TObject);
|
||||||
procedure GrpOutClick(Sender: TObject);
|
procedure GrpOutClick(Sender: TObject);
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
procedure VarListDblClick(Sender: TObject);
|
||||||
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
|
||||||
FAutoSized: Boolean;
|
protected
|
||||||
procedure UpdateBtnStates;
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
procedure UpdateBtnStates; override;
|
||||||
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
procedure Reset; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
MannWhitUFrm: TMannWhitUFrm;
|
MannWhitUForm: TMannWhitUForm;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math,
|
||||||
|
Utils;
|
||||||
|
|
||||||
{ TMannWhitUFrm }
|
{ TMannWhitUForm }
|
||||||
|
|
||||||
procedure TMannWhitUFrm.ResetBtnClick(Sender: TObject);
|
procedure TMannWhitUForm.AdjustConstraints;
|
||||||
var
|
begin
|
||||||
i: integer;
|
inherited;
|
||||||
begin
|
|
||||||
GrpEdit.Text := '';
|
ParamsPanel.Constraints.MinWidth := 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left;
|
||||||
DepEdit.Text := '';
|
ParamsPanel.Constraints.MinHeight := DepOut.Top + DepOut.Height +
|
||||||
VarList.Items.Clear;
|
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||||
for i := 1 to NoVariables do
|
end;
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
|
||||||
UpdateBtnStates;
|
|
||||||
end;
|
procedure TMannWhitUForm.Compute;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.FormActivate(Sender: TObject);
|
|
||||||
var
|
|
||||||
w: Integer;
|
|
||||||
begin
|
|
||||||
if FAutoSized then
|
|
||||||
exit;
|
|
||||||
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
|
||||||
ComputeBtn.Constraints.MinWidth := w;
|
|
||||||
CloseBtn.Constraints.MinWidth := w;
|
|
||||||
|
|
||||||
Constraints.MinWidth := (Label3.Width + GrpIn.Width + 2 * VarList.BorderSpacing.Left + Bevel3.Width div 2) * 2;
|
|
||||||
Constraints.MinHeight := Height;
|
|
||||||
|
|
||||||
FAutoSized := true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMannWhitUFrm.FormCreate(Sender: TObject);
|
|
||||||
begin
|
|
||||||
Assert(OS3MainFrm <> nil);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMannWhitUFrm.FormShow(Sender: TObject);
|
|
||||||
begin
|
|
||||||
ResetBtnClick(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMannWhitUFrm.ComputeBtnClick(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
|
ColNoSelected: IntDyneVec = nil;
|
||||||
|
group_count: IntdyneVec = nil;
|
||||||
|
Ranks: DblDyneMat = nil;
|
||||||
|
X: DblDyneMat = nil;
|
||||||
|
RankSums: DblDyneVec = nil;
|
||||||
i, j, ind_var, dep_var, min_grp, max_grp, group, total_n : integer;
|
i, j, ind_var, dep_var, min_grp, max_grp, group, total_n : integer;
|
||||||
NoTies, NoTieGroups, n1, n2, nogroups, largestn : integer;
|
NoTies, NoTieGroups, n1, n2, nogroups, largestn : integer;
|
||||||
NoSelected : integer;
|
NoSelected : integer;
|
||||||
ColNoSelected : IntDyneVec;
|
|
||||||
group_count : IntdyneVec;
|
|
||||||
Ranks, X : DblDyneMat;
|
|
||||||
RankSums : DblDyneVec;
|
|
||||||
TieSum, score, t, SumT, Avg, z, prob, U, U2, SD, Temp : double;
|
TieSum, score, t, SumT, Avg, z, prob, U, U2, SD, Temp : double;
|
||||||
cellstring, outline : string;
|
cellstring, outline : string;
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
@ -120,12 +90,12 @@ begin
|
|||||||
// Check for data
|
// Check for data
|
||||||
if (NoVariables < 1) then
|
if (NoVariables < 1) then
|
||||||
begin
|
begin
|
||||||
MessageDlg('You must have grid data!', mtError, [mbOK], 0);
|
ErrorMsg('You must have grid data!');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// allocate space
|
// allocate space
|
||||||
SetLength(ColNoSelected,NoVariables);
|
SetLength(ColNoSelected, NoVariables);
|
||||||
|
|
||||||
// Get column numbers of the independent and dependent variables
|
// Get column numbers of the independent and dependent variables
|
||||||
ind_var := 0;
|
ind_var := 0;
|
||||||
@ -141,21 +111,21 @@ begin
|
|||||||
ColNoSelected[1] := dep_var;
|
ColNoSelected[1] := dep_var;
|
||||||
if ind_var = 0 then
|
if ind_var = 0 then
|
||||||
begin
|
begin
|
||||||
MessageDlg('No group variable.', mtError, [mbOK], 0);
|
ErrorMsg('No group variable.');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if dep_var = 0 then
|
if dep_var = 0 then
|
||||||
begin
|
begin
|
||||||
MessageDlg('No dependent variable.', mtError, [mbOk], 0);
|
ErrorMsg('No dependent variable.');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//get minimum and maximum group codes
|
//get minimum and maximum group codes
|
||||||
min_grp := 10000;
|
min_grp := MaxInt;
|
||||||
max_grp := -10000;
|
max_grp := -MaxInt;
|
||||||
for i := 1 to NoCases do
|
for i := 1 to NoCases do
|
||||||
begin
|
begin
|
||||||
if (not GoodRecord(i,NoSelected,ColNoSelected)) then continue;
|
if (not GoodRecord(i, NoSelected, ColNoSelected)) then continue;
|
||||||
group := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[ind_var,i])));
|
group := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[ind_var,i])));
|
||||||
if (group < min_grp) then min_grp := group;
|
if (group < min_grp) then min_grp := group;
|
||||||
if (group > max_grp) then max_grp := group;
|
if (group > max_grp) then max_grp := group;
|
||||||
@ -190,7 +160,7 @@ begin
|
|||||||
group := group - min_grp + 1;
|
group := group - min_grp + 1;
|
||||||
if (group > 2) then
|
if (group > 2) then
|
||||||
begin
|
begin
|
||||||
MessageDlg('Group codes must be 1 and 2!', mtError, [mbOk], 0);
|
ErrorMsg('Group codes must be 1 and 2!');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
group_count[group-1] := group_count[group-1] + 1;
|
group_count[group-1] := group_count[group-1] + 1;
|
||||||
@ -198,7 +168,7 @@ begin
|
|||||||
X[i-1,1] := group;
|
X[i-1,1] := group;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Sort all scores in ascending order
|
// Sort all scores in ascending order
|
||||||
for i := 1 to total_n - 1 do
|
for i := 1 to total_n - 1 do
|
||||||
begin
|
begin
|
||||||
for j := i + 1 to total_n do
|
for j := i + 1 to total_n do
|
||||||
@ -222,8 +192,8 @@ begin
|
|||||||
Ranks[i-1,1] := X[i-1,1];
|
Ranks[i-1,1] := X[i-1,1];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Check for ties in ranks - replace with average rank and calculate
|
// Check for ties in ranks - replace with average rank and calculate
|
||||||
//T for each tie and sum of the T's
|
// T for each tie and sum of the T's
|
||||||
i := 1;
|
i := 1;
|
||||||
while i < total_n do
|
while i < total_n do
|
||||||
begin
|
begin
|
||||||
@ -263,7 +233,7 @@ begin
|
|||||||
RankSums[group-1] := RankSums[group-1] + Ranks[i-1,0];
|
RankSums[group-1] := RankSums[group-1] + Ranks[i-1,0];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Calculate U for larger and smaller groups
|
// Calculate U for larger and smaller groups
|
||||||
n1 := group_count[0];
|
n1 := group_count[0];
|
||||||
n2 := group_count[1];
|
n2 := group_count[1];
|
||||||
if (n1 > n2) then
|
if (n1 > n2) then
|
||||||
@ -279,7 +249,7 @@ begin
|
|||||||
z := (U - n1 * n2 / 2) / SD;
|
z := (U - n1 * n2 / 2) / SD;
|
||||||
prob := 1.0 - probz(z);
|
prob := 1.0 - probz(z);
|
||||||
|
|
||||||
//Report results
|
// Report results
|
||||||
lReport.Add(' Score Rank Group');
|
lReport.Add(' Score Rank Group');
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
for i := 1 to total_n do
|
for i := 1 to total_n do
|
||||||
@ -312,19 +282,16 @@ begin
|
|||||||
lReport.Add('z test is approximate. Use tables of exact probabilities in Siegel.');
|
lReport.Add('z test is approximate. Use tables of exact probabilities in Siegel.');
|
||||||
lReport.Add('(Table J or K, pages 271-277)');
|
lReport.Add('(Table J or K, pages 271-277)');
|
||||||
end;
|
end;
|
||||||
DisplayReport(lReport);
|
|
||||||
|
FReportFrame.DisplayReport(lReport);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
lReport.Free;
|
lReport.Free;
|
||||||
group_count := nil;
|
|
||||||
X := nil;
|
|
||||||
Ranks := nil;
|
|
||||||
RankSums := nil;
|
|
||||||
ColNoSelected := nil;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.DepInClick(Sender: TObject);
|
|
||||||
|
procedure TMannWhitUForm.DepInClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
index: integer;
|
index: integer;
|
||||||
begin
|
begin
|
||||||
@ -337,7 +304,8 @@ begin
|
|||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.DepOutClick(Sender: TObject);
|
|
||||||
|
procedure TMannWhitUForm.DepOutClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if DepEdit.Text <> '' then
|
if DepEdit.Text <> '' then
|
||||||
begin
|
begin
|
||||||
@ -347,7 +315,8 @@ begin
|
|||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.GrpInClick(Sender: TObject);
|
|
||||||
|
procedure TMannWhitUForm.GrpInClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
index: integer;
|
index: integer;
|
||||||
begin
|
begin
|
||||||
@ -360,7 +329,8 @@ begin
|
|||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.GrpOutClick(Sender: TObject);
|
|
||||||
|
procedure TMannWhitUForm.GrpOutClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if GrpEdit.Text <> '' then
|
if GrpEdit.Text <> '' then
|
||||||
begin
|
begin
|
||||||
@ -370,21 +340,54 @@ begin
|
|||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.UpdateBtnStates;
|
|
||||||
|
procedure TMannWhitUForm.Reset;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
inherited;
|
||||||
|
GrpEdit.Clear;
|
||||||
|
DepEdit.clear;
|
||||||
|
VarList.Items.Clear;
|
||||||
|
for i := 1 to NoVariables do
|
||||||
|
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMannWhitUForm.UpdateBtnStates;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
GrpIn.Enabled := (VarList.ItemIndex > -1) and (GrpEdit.Text = '');
|
GrpIn.Enabled := (VarList.ItemIndex > -1) and (GrpEdit.Text = '');
|
||||||
DepIn.Enabled := (VarList.ItemIndex > -1) and (DepEdit.Text = '');
|
DepIn.Enabled := (VarList.ItemIndex > -1) and (DepEdit.Text = '');
|
||||||
GrpOut.Enabled := GrpEdit.Text <> '';
|
GrpOut.Enabled := GrpEdit.Text <> '';
|
||||||
DepOut.Enabled := DepEdit.Text <> '';
|
DepOut.Enabled := DepEdit.Text <> '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMannWhitUFrm.VarListSelectionChange(Sender: TObject; User: boolean);
|
|
||||||
|
procedure TMannWhitUForm.VarListDblClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
index: Integer;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
index := VarList.ItemIndex;
|
||||||
|
if index > -1 then
|
||||||
|
begin
|
||||||
|
s := VarList.Items[index];
|
||||||
|
if GrpEdit.Text = '' then
|
||||||
|
GrpEdit.Text := s
|
||||||
|
else if DepEdit.Text = '' then
|
||||||
|
DepEdit.Text := s;
|
||||||
|
VarList.Items.Delete(index);
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMannWhitUForm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||||
begin
|
begin
|
||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
|
||||||
{$I mannwhituunit.lrs}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object runstestform: Trunstestform
|
object runstestform: Trunstestform
|
||||||
Left = 476
|
Left = 1138
|
||||||
Height = 438
|
Height = 438
|
||||||
Top = 209
|
Top = 277
|
||||||
Width = 376
|
Width = 376
|
||||||
HelpType = htKeyword
|
HelpType = htKeyword
|
||||||
HelpKeyword = 'html/RunsTestforNormality.htm'
|
HelpKeyword = 'html/RunsTestforNormality.htm'
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
inherited SignTestFrm: TSignTestFrm
|
inherited SignTestFrm: TSignTestFrm
|
||||||
Left = 550
|
Left = 550
|
||||||
Height = 345
|
Height = 344
|
||||||
Top = 297
|
Top = 297
|
||||||
Width = 382
|
Width = 561
|
||||||
Caption = 'The Matched Pairs Sign Test'
|
Caption = 'The Matched Pairs Sign Test'
|
||||||
ClientHeight = 345
|
ClientHeight = 344
|
||||||
ClientWidth = 382
|
ClientWidth = 561
|
||||||
inherited ParamsPanel: TPanel
|
inherited ParamsPanel: TPanel
|
||||||
Height = 329
|
Height = 328
|
||||||
ClientHeight = 329
|
ClientHeight = 328
|
||||||
inherited CloseBtn: TButton
|
inherited CloseBtn: TButton
|
||||||
Top = 304
|
Top = 303
|
||||||
TabOrder = 10
|
TabOrder = 10
|
||||||
end
|
end
|
||||||
inherited ComputeBtn: TButton
|
inherited ComputeBtn: TButton
|
||||||
Top = 304
|
Top = 303
|
||||||
TabOrder = 9
|
TabOrder = 9
|
||||||
end
|
end
|
||||||
inherited ResetBtn: TButton
|
inherited ResetBtn: TButton
|
||||||
Top = 304
|
Top = 303
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
inherited HelpBtn: TButton
|
inherited HelpBtn: TButton
|
||||||
Top = 304
|
Top = 303
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
inherited ButtonBevel: TBevel
|
inherited ButtonBevel: TBevel
|
||||||
Top = 288
|
Top = 287
|
||||||
end
|
end
|
||||||
object Label1: TLabel[5]
|
object Label1: TLabel[5]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
@ -69,7 +69,7 @@ inherited SignTestFrm: TSignTestFrm
|
|||||||
AnchorSideRight.Control = Var1In
|
AnchorSideRight.Control = Var1In
|
||||||
AnchorSideBottom.Control = ButtonBevel
|
AnchorSideBottom.Control = ButtonBevel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 271
|
Height = 270
|
||||||
Top = 17
|
Top = 17
|
||||||
Width = 126
|
Width = 126
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -180,6 +180,6 @@ inherited SignTestFrm: TSignTestFrm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
inherited ParamsSplitter: TSplitter
|
inherited ParamsSplitter: TSplitter
|
||||||
Height = 345
|
Height = 344
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1824,9 +1824,9 @@ end;
|
|||||||
// Menu "Analysis" > "Nonparametric" > "Mann-Whitney U Test"
|
// Menu "Analysis" > "Nonparametric" > "Mann-Whitney U Test"
|
||||||
procedure TOS3MainFrm.mnuAnalysisNonPar_MannWhitneyClick(Sender: TObject);
|
procedure TOS3MainFrm.mnuAnalysisNonPar_MannWhitneyClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if MannWhitUFrm = nil then
|
if MannWhitUForm = nil then
|
||||||
Application.CreateForm(TMannWhitUFrm, MannWhitUFrm);
|
Application.CreateForm(TMannWhitUForm, MannWhitUForm);
|
||||||
MannWhitUFrm.ShowModal;
|
MannWhitUForm.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "Fisher's Exact Text"
|
// Menu "Analysis" > "Nonparametric" > "Fisher's Exact Text"
|
||||||
|
Reference in New Issue
Block a user