You've already forked lazarus-ccr
LazStats: Inherit TwoPropUnit from TBasicStatsReportForm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7842 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -315,7 +315,7 @@
|
|||||||
<Unit26>
|
<Unit26>
|
||||||
<Filename Value="forms\analysis\comparisons\twopropunit.pas"/>
|
<Filename Value="forms\analysis\comparisons\twopropunit.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="TwoPropFrm"/>
|
<ComponentName Value="TwoPropForm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="TwoPropUnit"/>
|
<UnitName Value="TwoPropUnit"/>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,43 +5,41 @@ unit TwoPropUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls,
|
Classes, SysUtils, Forms, Controls,
|
||||||
Graphics, Dialogs, ExtCtrls, StdCtrls, ComCtrls, MainUnit, Globals,
|
Graphics, Dialogs, ExtCtrls, StdCtrls, ComCtrls, Buttons, MainUnit, Globals,
|
||||||
FunctionsLib, OutPutUnit, DataProcs, contexthelpunit;
|
FunctionsLib, DataProcs, BasicStatsReportFormUnit;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TTwoPropFrm }
|
{ TTwoPropForm }
|
||||||
|
|
||||||
TTwoPropFrm = class(TForm)
|
TTwoPropForm = class(TBasicStatsReportForm)
|
||||||
Bevel1: TBevel;
|
|
||||||
Bevel2: TBevel;
|
Bevel2: TBevel;
|
||||||
Bevel3: TBevel;
|
Bevel3: TBevel;
|
||||||
Bevel4: TBevel;
|
|
||||||
Bevel5: TBevel;
|
Bevel5: TBevel;
|
||||||
HelpBtn: TButton;
|
|
||||||
LabelCorner: TLabel;
|
LabelCorner: TLabel;
|
||||||
Notebook1: TNotebook;
|
Notebook: TNotebook;
|
||||||
Page1: TPage;
|
Page1: TPage;
|
||||||
Page2: TPage;
|
Page2: TPage;
|
||||||
Page3: TPage;
|
Page3: TPage;
|
||||||
Panel1: TPanel;
|
|
||||||
Panel3: TPanel;
|
Panel3: TPanel;
|
||||||
Panel4: TPanel;
|
Panel4: TPanel;
|
||||||
ResetBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
DepFreq00: TEdit;
|
DepFreq00: TEdit;
|
||||||
DepFreq10: TEdit;
|
DepFreq10: TEdit;
|
||||||
DepFreq01: TEdit;
|
DepFreq01: TEdit;
|
||||||
DepFreq11: TEdit;
|
DepFreq11: TEdit;
|
||||||
CInterval: TEdit;
|
CIntervalEdit: TEdit;
|
||||||
Grp: TEdit;
|
GrpEdit: TEdit;
|
||||||
GrpLabel: TLabel;
|
GrpLabel: TLabel;
|
||||||
ConfLabel: TLabel;
|
ConfLabel: TLabel;
|
||||||
Var2: TEdit;
|
Var1In: TBitBtn;
|
||||||
SecdVarLabel: TLabel;
|
Var2In: TBitBtn;
|
||||||
Var1: TEdit;
|
Var1Out: TBitBtn;
|
||||||
|
GrpIn: TBitBtn;
|
||||||
|
Var2Out: TBitBtn;
|
||||||
|
Var2Edit: TEdit;
|
||||||
|
Var2Label: TLabel;
|
||||||
|
Var1Edit: TEdit;
|
||||||
IndSize2: TEdit;
|
IndSize2: TEdit;
|
||||||
IndSize1: TEdit;
|
IndSize1: TEdit;
|
||||||
IndFreq2: TEdit;
|
IndFreq2: TEdit;
|
||||||
@ -49,7 +47,7 @@ type
|
|||||||
Samp1Label: TLabel;
|
Samp1Label: TLabel;
|
||||||
Samp21Label: TLabel;
|
Samp21Label: TLabel;
|
||||||
Label11: TLabel;
|
Label11: TLabel;
|
||||||
FirstVarLabel: TLabel;
|
Var1Label: TLabel;
|
||||||
Samp2Label: TLabel;
|
Samp2Label: TLabel;
|
||||||
Samp1SizeLabel: TLabel;
|
Samp1SizeLabel: TLabel;
|
||||||
Samp2SizeLabel: TLabel;
|
Samp2SizeLabel: TLabel;
|
||||||
@ -58,106 +56,70 @@ type
|
|||||||
Samp10Label: TLabel;
|
Samp10Label: TLabel;
|
||||||
Samp11Label: TLabel;
|
Samp11Label: TLabel;
|
||||||
Samp20Label: TLabel;
|
Samp20Label: TLabel;
|
||||||
|
GrpOut: TBitBtn;
|
||||||
VarList: TListBox;
|
VarList: TListBox;
|
||||||
RadioGroup1: TRadioGroup;
|
RadioGroup1: TRadioGroup;
|
||||||
RadioGroup2: TRadioGroup;
|
DepIndepGroup: TRadioGroup;
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
procedure GrpInClick(Sender: TObject);
|
||||||
procedure FormActivate(Sender: TObject);
|
procedure GrpOutClick(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
procedure FormShow(Sender: TObject);
|
|
||||||
procedure HelpBtnClick(Sender: TObject);
|
|
||||||
procedure RadioGroup1Click(Sender: TObject);
|
procedure RadioGroup1Click(Sender: TObject);
|
||||||
procedure RadioGroup2Click(Sender: TObject);
|
procedure DepIndepGroupClick(Sender: TObject);
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
procedure Var1InClick(Sender: TObject);
|
||||||
procedure VarListClick(Sender: TObject);
|
procedure Var1OutClick(Sender: TObject);
|
||||||
|
procedure Var2InClick(Sender: TObject);
|
||||||
|
procedure Var2OutClick(Sender: TObject);
|
||||||
|
procedure VarListDblClick(Sender: TObject);
|
||||||
|
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||||
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
|
||||||
FAutoSized: Boolean;
|
|
||||||
independent: boolean;
|
independent: boolean;
|
||||||
griddata: boolean;
|
griddata: boolean;
|
||||||
function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
|
||||||
|
protected
|
||||||
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
procedure UpdateBtnStates; override;
|
||||||
|
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
|
||||||
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure Reset; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
TwoPropFrm: TTwoPropFrm;
|
TwoPropForm: TTwoPropForm;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math;
|
||||||
|
|
||||||
{ TTwoPropFrm }
|
|
||||||
|
|
||||||
procedure TTwoPropFrm.ResetBtnClick(Sender: TObject);
|
{ TTwoPropForm }
|
||||||
var
|
|
||||||
i: integer;
|
constructor TTwoPropForm.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
CInterval.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT);
|
inherited;
|
||||||
|
CIntervalEdit.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT);
|
||||||
RadioGroup1.ItemIndex := 0;
|
|
||||||
RadioGroup2.ItemIndex := 0;
|
|
||||||
VarList.Clear;
|
|
||||||
Var1.Text := '';
|
|
||||||
Var2.Text := '';
|
|
||||||
independent := true;
|
|
||||||
griddata := false;
|
|
||||||
for i := 1 to NoVariables do
|
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
|
||||||
GrpLabel.Visible := true;
|
|
||||||
Grp.Visible := true;
|
|
||||||
Grp.Text := '';
|
|
||||||
Var2.Visible := false;
|
|
||||||
SecdVarLabel.Visible := false;
|
|
||||||
DepFreq00.Text := '';
|
|
||||||
DepFreq01.Text := '';
|
|
||||||
DepFreq10.Text := '';
|
|
||||||
DepFreq11.Text := '';
|
|
||||||
IndFreq1.Text := '';
|
|
||||||
IndFreq2.Text := '';
|
|
||||||
IndSize1.Text := '';
|
|
||||||
IndSize2.Text := '';
|
|
||||||
|
|
||||||
Notebook1.PageIndex := 1;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.VarListClick(Sender: TObject);
|
|
||||||
var
|
|
||||||
index: integer;
|
|
||||||
begin
|
|
||||||
index := VarList.ItemIndex;
|
|
||||||
if not independent then
|
|
||||||
begin
|
|
||||||
if Var1.Text <> '' then
|
|
||||||
Var2.Text := VarList.Items[index]
|
|
||||||
else
|
|
||||||
Var1.Text := VarList.Items[index];
|
|
||||||
end;
|
|
||||||
|
|
||||||
if independent then
|
procedure TTwoPropForm.AdjustConstraints;
|
||||||
begin
|
begin
|
||||||
if Var1.Text <> '' then
|
inherited;
|
||||||
Grp.Text := VarList.Items[index]
|
ParamsPanel.Constraints.MinWidth := Max(
|
||||||
else
|
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
|
||||||
Var1.Text := VarList.Items[index];
|
RadioGroup1.Width + Bevel5.Width + DepIndepGroup.Width
|
||||||
end;
|
);
|
||||||
|
ParamsPanel.Constraints.MinHeight := GrpOut.Top + GrpOut.Height +
|
||||||
|
Notebook.BorderSpacing.Bottom + CIntervalEdit.Height + ButtonBevel.Height +
|
||||||
|
CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.FormShow(Sender: TObject);
|
|
||||||
begin
|
|
||||||
ResetBtnClick(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TTwoPropFrm.HelpBtnClick(Sender: TObject);
|
procedure TTwoPropForm.Compute;
|
||||||
begin
|
|
||||||
if ContextHelpForm = nil then
|
|
||||||
Application.CreateForm(TContextHelpForm, ContextHelpForm);
|
|
||||||
ContextHelpForm.HelpMessage((Sender as TButton).tag);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TTwoPropFrm.ComputeBtnClick(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
ConfInt, Prop1, Prop2, zstatistic, zprobability: double;
|
ConfInt, Prop1, Prop2, zstatistic, zprobability: double;
|
||||||
PropDif, stderr, UCL, LCL, value1, value2, ztest: double;
|
PropDif, stderr, UCL, LCL, value1, value2, ztest: double;
|
||||||
@ -165,18 +127,8 @@ var
|
|||||||
i, v1, v2, NoSelected, f1, f2, f3, f4, ncases1, ncases2: integer;
|
i, v1, v2, NoSelected, f1, f2, f3, f4, ncases1, ncases2: integer;
|
||||||
min, max, group, AB, AC, CD, BD: integer;
|
min, max, group, AB, AC, CD, BD: integer;
|
||||||
ColNoSelected: IntDyneVec = nil;
|
ColNoSelected: IntDyneVec = nil;
|
||||||
msg: String;
|
|
||||||
C: TWinControl;
|
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
if not Validate(msg, C) then
|
|
||||||
begin
|
|
||||||
C.SetFocus;
|
|
||||||
MessageDlg(msg, mtError, [mbOK], 0);
|
|
||||||
ModalResult := mrNone;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Initialize output form
|
// Initialize output form
|
||||||
stderr := 0.0;
|
stderr := 0.0;
|
||||||
PropDif := 0.0;
|
PropDif := 0.0;
|
||||||
@ -193,7 +145,7 @@ begin
|
|||||||
|
|
||||||
SetLength(ColNoSelected,NoVariables);
|
SetLength(ColNoSelected,NoVariables);
|
||||||
|
|
||||||
ConfInt := (100.0 - StrToFloat(CInterval.Text)) / 2.0 ;
|
ConfInt := (100.0 - StrToFloat(CIntervalEdit.Text)) / 2.0 ;
|
||||||
ConfInt := (100.0 - ConfInt) / 100.0; // one tail
|
ConfInt := (100.0 - ConfInt) / 100.0; // one tail
|
||||||
ncases1 := 0;
|
ncases1 := 0;
|
||||||
ncases2 := 0;
|
ncases2 := 0;
|
||||||
@ -202,19 +154,19 @@ begin
|
|||||||
f3 := 0;
|
f3 := 0;
|
||||||
f4 := 0;
|
f4 := 0;
|
||||||
if independent then
|
if independent then
|
||||||
Var2.Text := Grp.Text;
|
Var2Edit.Text := GrpEdit.Text;
|
||||||
|
|
||||||
if griddata then // data read from grid
|
if griddata then // data read from grid
|
||||||
begin
|
begin
|
||||||
for i := 1 to NoVariables do
|
for i := 1 to NoVariables do
|
||||||
begin
|
begin
|
||||||
if Var1.Text = OS3MainFrm.DataGrid.Cells[i,0] then
|
if Var1Edit.Text = OS3MainFrm.DataGrid.Cells[i,0] then
|
||||||
begin
|
begin
|
||||||
v1 := i;
|
v1 := i;
|
||||||
ColNoSelected[0] := i;
|
ColNoSelected[0] := i;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Var2.Text = OS3MainFrm.DataGrid.Cells[i,0] then
|
if Var2Edit.Text = OS3MainFrm.DataGrid.Cells[i,0] then
|
||||||
begin
|
begin
|
||||||
v2 := i;
|
v2 := i;
|
||||||
ColNoSelected[1] := i;
|
ColNoSelected[1] := i;
|
||||||
@ -244,7 +196,7 @@ begin
|
|||||||
PropDif := Prop1 - Prop2;
|
PropDif := Prop1 - Prop2;
|
||||||
zstatistic := PropDif / stderr;
|
zstatistic := PropDif / stderr;
|
||||||
ztest := inversez(ConfInt);
|
ztest := inversez(ConfInt);
|
||||||
zprobability := 1.0 - probz(abs(zstatistic));
|
zprobability := 1.0 - ProbZ(abs(zstatistic));
|
||||||
UCL := PropDif + stderr * ztest;
|
UCL := PropDif + stderr * ztest;
|
||||||
LCL := PropDif - stderr * ztest;
|
LCL := PropDif - stderr * ztest;
|
||||||
end; // if not independent
|
end; // if not independent
|
||||||
@ -355,13 +307,14 @@ begin
|
|||||||
lReport.Add(' --------|-------|------');
|
lReport.Add(' --------|-------|------');
|
||||||
lReport.Add(' sum | %5d %5d %5d |', [AC, BD, ncases1]);
|
lReport.Add(' sum | %5d %5d %5d |', [AC, BD, ncases1]);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add('Confidence Level selected: %s', [CInterval.Text]);
|
lReport.Add('Confidence Level selected: %s', [CIntervalEdit.Text]);
|
||||||
lReport.Add('Proportion 1 = %.3f and Proportion 2 = %.3f with %d cases', [Prop1, Prop2, ncases1]);
|
lReport.Add('Proportion 1 = %.3f and Proportion 2 = %.3f with %d cases', [Prop1, Prop2, ncases1]);
|
||||||
lReport.Add('Difference in proportions: %9.3f', [PropDif]);
|
lReport.Add('Difference in proportions: %9.3f', [PropDif]);
|
||||||
lReport.Add('Standard Error of Difference: %9.3f', [stderr]);
|
lReport.Add('Standard Error of Difference: %9.3f', [stderr]);
|
||||||
lReport.Add('z test statistic: %9.3f with probability = %.4f', [zstatistic, zprobability]);
|
lReport.Add('z test statistic: %9.3f', [zStatistic]);
|
||||||
lReport.Add('z value for confidence interval: %9.3f', [ztest]);
|
lReport.Add(' with probability %9.4f', [zProbability]);
|
||||||
lReport.Add('Confidence Interval: (%.3f, %.3f)', [LCL, UCL]);
|
lReport.Add('z value for confidence interval: %9.3f', [zTest]);
|
||||||
|
lReport.Add('Confidence Interval: %9.3f ... %.3f', [LCL, UCL]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if independent then
|
if independent then
|
||||||
@ -377,114 +330,217 @@ begin
|
|||||||
lReport.Add('Proportion 2: %9.3f', [Prop2]);
|
lReport.Add('Proportion 2: %9.3f', [Prop2]);
|
||||||
lReport.Add('Difference: %9.3f', [PropDif]);
|
lReport.Add('Difference: %9.3f', [PropDif]);
|
||||||
lReport.Add('Standard Error of Difference: %9.3f', [stderr]);
|
lReport.Add('Standard Error of Difference: %9.3f', [stderr]);
|
||||||
lReport.Add('Confidence Level selected: %9s', [CInterval.Text]);
|
lReport.Add('Confidence Level selected: %-9s', [CIntervalEdit.Text]);
|
||||||
lReport.Add('z test statistic: %9.3f with probability = %.4f', [zstatistic, zprobability]);
|
lReport.Add('z test statistic: %9.3f', [zStatistic]);
|
||||||
|
lReport.Add(' with probability %9.4f', [zProbability]);
|
||||||
lReport.Add('z value for confidence interval: %9.3f', [ztest]);
|
lReport.Add('z value for confidence interval: %9.3f', [ztest]);
|
||||||
lReport.Add('Confidence Interval: (%.3f, %.3f)', [LCL, UCL]);
|
lReport.Add('Confidence Interval: %9.3f ... %.3f', [LCL, UCL]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DisplayReport(lReport);
|
FReportFrame.DisplayReport(lReport);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
lReport.Free;
|
lReport.Free;
|
||||||
ColNoSelected := nil;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.FormActivate(Sender: TObject);
|
|
||||||
|
procedure TTwoPropForm.GrpInClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
w: Integer;
|
index: Integer;
|
||||||
begin
|
begin
|
||||||
if FAutoSized then
|
index := VarList.ItemIndex;
|
||||||
exit;
|
if (index > -1) and (GrpEdit.Text = '') then
|
||||||
|
begin
|
||||||
RadioGroup2.Constraints.MinWidth := RadioGroup1.Width;
|
GrpEdit.Text := VarList.Items[index];
|
||||||
|
VarList.Items.Delete(index);
|
||||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
UpdateBtnStates;
|
||||||
HelpBtn.Constraints.MinWidth := w;
|
end;
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
|
||||||
ComputeBtn.Constraints.MinWidth := w;
|
|
||||||
CloseBtn.Constraints.MinWidth := w;
|
|
||||||
|
|
||||||
Width := Max(
|
|
||||||
RadioGroup2.Left + RadioGroup2.Width + RadioGroup2.BorderSpacing.Right,
|
|
||||||
Width - HelpBtn.Left + HelpBtn.BorderSpacing.Left
|
|
||||||
);
|
|
||||||
Constraints.MinWidth := Width;
|
|
||||||
Constraints.MinHeight := Height;
|
|
||||||
|
|
||||||
FAutoSized := true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.FormCreate(Sender: TObject);
|
|
||||||
|
procedure TTwoPropForm.GrpOutClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Assert(OS3MainFrm <> nil);
|
if GrpEdit.Text <> '' then
|
||||||
|
begin
|
||||||
|
VarList.Items.Add(GrpEdit.Text);
|
||||||
|
GrpEdit.Text := '';
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.RadioGroup1Click(Sender: TObject);
|
|
||||||
|
procedure TTwoPropForm.RadioGroup1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
griddata := RadioGroup1.ItemIndex = 1;
|
griddata := (RadioGroup1.ItemIndex = 1);
|
||||||
RadioGroup2Click(nil);
|
DepIndepGroupClick(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTwoPropFrm.RadioGroup2Click(Sender: TObject);
|
|
||||||
|
procedure TTwoPropForm.DepIndepGroupClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
case RadioGroup2.ItemIndex of
|
case DepIndepGroup.ItemIndex of
|
||||||
0: begin
|
0: begin
|
||||||
independent := true;
|
independent := true;
|
||||||
if griddata then begin
|
if griddata then
|
||||||
Notebook1.PageIndex := 0;
|
Notebook.PageIndex := 0
|
||||||
Var2.Visible := false;
|
else
|
||||||
Grp.Visible := true;
|
Notebook.PageIndex := 1;
|
||||||
SecdVarLabel.Visible := Var2.Visible;
|
end;
|
||||||
GrpLabel.Visible := Grp.Visible;
|
1: begin
|
||||||
end else
|
independent := false;
|
||||||
Notebook1.PageIndex := 1;
|
if griddata then
|
||||||
end;
|
Notebook.PageIndex := 0
|
||||||
1: begin
|
else
|
||||||
independent := false;
|
Notebook.PageIndex := 2;
|
||||||
if griddata then begin
|
end;
|
||||||
Notebook1.PageIndex := 0;
|
end;
|
||||||
Var2.Visible := true;
|
|
||||||
Grp.Visible := false;
|
Var2Edit.Visible := independent;
|
||||||
SecdVarLabel.Visible := Var2.Visible;
|
Var2Label.Visible := independent;
|
||||||
GrpLabel.Visible := Grp.Visible;
|
Var2In.Visible := independent;
|
||||||
end else
|
Var2Out.Visible := independent;
|
||||||
Notebook1.PageIndex := 2;
|
|
||||||
end;
|
GrpEdit.Visible := not independent;
|
||||||
end;
|
GrpLabel.Visible := not independent;
|
||||||
|
GrpIn.Visible := not independent;
|
||||||
|
GrpOut.Visible := not independent;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTwoPropFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
|
||||||
|
procedure TTwoPropForm.Reset;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
RadioGroup1.ItemIndex := 0;
|
||||||
|
DepIndepGroup.ItemIndex := 0;
|
||||||
|
|
||||||
|
VarList.Clear;
|
||||||
|
for i := 1 to NoVariables do
|
||||||
|
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||||
|
|
||||||
|
Var1Edit.Clear;
|
||||||
|
Var2Edit.Clear;
|
||||||
|
independent := true;
|
||||||
|
griddata := false;
|
||||||
|
GrpLabel.Visible := true;
|
||||||
|
GrpEdit.Visible := true;
|
||||||
|
GrpIn.Visible := true;
|
||||||
|
GrpOut.Visible := true;
|
||||||
|
GrpEdit.Clear;
|
||||||
|
Var2Edit.Visible := false;
|
||||||
|
Var2Label.Visible := false;
|
||||||
|
Var2In.Visible := false;
|
||||||
|
Var2Out.Visible := false;
|
||||||
|
DepFreq00.Clear;
|
||||||
|
DepFreq01.Clear;
|
||||||
|
DepFreq10.Clear;
|
||||||
|
DepFreq11.Clear;
|
||||||
|
IndFreq1.Clear;
|
||||||
|
IndFreq2.Clear;
|
||||||
|
IndSize1.Clear;
|
||||||
|
IndSize2.Clear;
|
||||||
|
|
||||||
|
Notebook.PageIndex := 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.Var1InClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
index: Integer;
|
||||||
|
begin
|
||||||
|
index := VarList.ItemIndex;
|
||||||
|
if (index > -1) and (Var1Edit.Text = '') then
|
||||||
|
begin
|
||||||
|
Var1Edit.Text := VarList.Items[index];
|
||||||
|
VarList.Items.Delete(index);
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.Var1OutClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Var1Edit.Text <> '' then
|
||||||
|
begin
|
||||||
|
VarList.Items.Add(Var1Edit.Text);
|
||||||
|
Var1Edit.Text := '';
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.Var2InClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
index: Integer;
|
||||||
|
begin
|
||||||
|
index := VarList.ItemIndex;
|
||||||
|
if (index > -1) and (Var2Edit.Text = '') then
|
||||||
|
begin
|
||||||
|
Var2Edit.Text := VarList.Items[index];
|
||||||
|
VarList.Items.Delete(index);
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.Var2OutClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Var2Edit.Text <> '' then
|
||||||
|
begin
|
||||||
|
VarList.Items.Add(Var2Edit.Text);
|
||||||
|
Var2Edit.Text := '';
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.UpdateBtnStates;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
Var1In.Enabled := (VarList.ItemIndex > -1) and (Var1Edit.Text = '');
|
||||||
|
Var2In.Enabled := (VarList.ItemIndex > -1) and (Var2Edit.Text = '');
|
||||||
|
GrpIn.Enabled := (VarList.ItemIndex > -1) and (GrpEdit.Text = '');
|
||||||
|
|
||||||
|
Var1Out.Enabled := Var1Edit.Text <> '';
|
||||||
|
Var2Out.Enabled := Var2Edit.Text <> '';
|
||||||
|
GrpOut.Enabled := GrpEdit.Text <> '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TTwoPropForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||||
var
|
var
|
||||||
n: Integer;
|
n: Integer;
|
||||||
begin
|
begin
|
||||||
Result := false;
|
Result := false;
|
||||||
AControl := nil;
|
AControl := nil;
|
||||||
AMsg := '';
|
AMsg := '';
|
||||||
if Notebook1.PageIndex = 0 then
|
if Notebook.PageIndex = 0 then
|
||||||
begin
|
begin
|
||||||
if Var1.Text = '' then
|
if Var1Edit.Text = '' then
|
||||||
begin
|
begin
|
||||||
AControl := Var1;
|
AControl := Var1Edit;
|
||||||
AMsg := 'First variable not specified.';
|
AMsg := 'First variable not specified.';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
case RadioGroup2.ItemIndex of
|
case DepIndepGroup.ItemIndex of
|
||||||
0: if (Grp.Text = '') then
|
0: if (GrpEdit.Text = '') then
|
||||||
begin
|
begin
|
||||||
AControl := Grp;
|
AControl := GrpEdit;
|
||||||
AMsg := 'Group code not specified';
|
AMsg := 'Group code not specified';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
1: if (Var2.Text = '') then begin
|
1: if (Var2Edit.Text = '') then begin
|
||||||
AControl := Var2;
|
AControl := Var2Edit;
|
||||||
AMsg := 'Second variable not specified.';
|
AMsg := 'Second variable not specified.';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
if Notebook1.PageIndex = 1 then
|
if Notebook.PageIndex = 1 then
|
||||||
begin
|
begin
|
||||||
if (IndFreq1.Text = '') or not TryStrToInt(IndFreq1.Text, n) or (n < 0) then
|
if (IndFreq1.Text = '') or not TryStrToInt(IndFreq1.Text, n) or (n < 0) then
|
||||||
begin
|
begin
|
||||||
@ -511,7 +567,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
if Notebook1.PageIndex = 2 then
|
if Notebook.PageIndex = 2 then
|
||||||
begin
|
begin
|
||||||
if (DepFreq00.Text = '') or not TryStrToInt(DepFreq00.Text, n) or (n < 0) then
|
if (DepFreq00.Text = '') or not TryStrToInt(DepFreq00.Text, n) or (n < 0) then
|
||||||
AControl := DepFreq00
|
AControl := DepFreq00
|
||||||
@ -534,8 +590,40 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
procedure TTwoPropForm.VarListDblClick(Sender: TObject);
|
||||||
{$I twopropunit.lrs}
|
var
|
||||||
|
index: integer;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
index := VarList.ItemIndex;
|
||||||
|
if index > -1 then
|
||||||
|
begin
|
||||||
|
s := VarList.Items[index];
|
||||||
|
if Var1Edit.Text = '' then
|
||||||
|
Var1Edit.Text := s
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if independent then
|
||||||
|
begin
|
||||||
|
if GrpEdit.Text = '' then
|
||||||
|
GrpEdit.Text := s;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if Var2Edit.Text = '' then
|
||||||
|
Var2Edit.Text := s;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TTwoPropForm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||||
|
begin
|
||||||
|
UpdateBtnStates;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ inherited WithinANOVAFrm: TWithinANOVAFrm
|
|||||||
Top = 25
|
Top = 25
|
||||||
Width = 124
|
Width = 124
|
||||||
Caption = 'Test Assumptions'
|
Caption = 'Test Assumptions'
|
||||||
TabOrder = 1
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object PlotChk: TCheckBox
|
object PlotChk: TCheckBox
|
||||||
Left = 156
|
Left = 156
|
||||||
@ -149,7 +149,7 @@ inherited WithinANOVAFrm: TWithinANOVAFrm
|
|||||||
Top = 6
|
Top = 6
|
||||||
Width = 79
|
Width = 79
|
||||||
Caption = 'Plot Means'
|
Caption = 'Plot Means'
|
||||||
TabOrder = 2
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object SelList: TListBox[11]
|
object SelList: TListBox[11]
|
||||||
|
@ -911,9 +911,9 @@ end;
|
|||||||
// Menu "Analysis" > "Comparisons" > "Difference beween Proportions"
|
// Menu "Analysis" > "Comparisons" > "Difference beween Proportions"
|
||||||
procedure TOS3MainFrm.mnuAnalysisComp_PropDiffClick(Sender: TObject);
|
procedure TOS3MainFrm.mnuAnalysisComp_PropDiffClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if TwoPropFrm = nil then
|
if TwoPropForm = nil then
|
||||||
Application.CreateForm(TTwoPropFrm, TwoPropFrm);
|
Application.CreateForm(TTwoPropForm, TwoPropForm);
|
||||||
TwoPropFrm.ShowModal;
|
TwoPropForm.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Comparisons" > "t-tests"
|
// Menu "Analysis" > "Comparisons" > "t-tests"
|
||||||
@ -924,14 +924,6 @@ begin
|
|||||||
TTestFrm.ShowModal;
|
TTestFrm.ShowModal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "Kappa and Weighted Kappa"
|
|
||||||
procedure TOS3MainFrm.mnuAnalysisNonPar_WeightedKappaClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if WeightedKappaFrm = nil then
|
|
||||||
Application.CreateForm(TWeightedKappaFrm, WeightedKappaFrm);
|
|
||||||
WeightedKappaFrm.ShowModal;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Menu "Analysis" > "Comparisons" > "Within Subjects mnuAnalysisComp_Anova"
|
// Menu "Analysis" > "Comparisons" > "Within Subjects mnuAnalysisComp_Anova"
|
||||||
procedure TOS3MainFrm.mnuAnalysisComp_WithinAnovaClick(Sender: TObject);
|
procedure TOS3MainFrm.mnuAnalysisComp_WithinAnovaClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
@ -1661,14 +1653,6 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "Generalized Kappa"
|
|
||||||
procedure TOS3MainFrm.mnuAnalysisNonPar_GenKappaClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if GenKappaFrm = nil then
|
|
||||||
Application.CreateForm(TGenKappaFrm, GenKappaFrm);
|
|
||||||
GenKappaFrm.ShowModal;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "General Linear Model"
|
// Menu "Analysis" > "Nonparametric" > "General Linear Model"
|
||||||
procedure TOS3MainFrm.mnuAnalysisComp_GLMClick(Sender: TObject);
|
procedure TOS3MainFrm.mnuAnalysisComp_GLMClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
@ -1717,14 +1701,6 @@ begin
|
|||||||
LatinSqrsFrm.ShowModal;
|
LatinSqrsFrm.ShowModal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "Life table"
|
|
||||||
procedure TOS3MainFrm.mnuAnalysisNonPar_LifeTableClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if LifeTableForm = nil then
|
|
||||||
Application.CreateForm(TLifeTableForm, LifeTableForm);
|
|
||||||
LifeTableForm.ShowModal;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TOS3MainFrm.MatManMnuClick(Sender: TObject);
|
procedure TOS3MainFrm.MatManMnuClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if MatManFrm = nil then
|
if MatManFrm = nil then
|
||||||
@ -1919,6 +1895,30 @@ begin
|
|||||||
SRHTestForm.Show;
|
SRHTestForm.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Menu "Analysis" > "Nonparametric" > "Generalized Kappa"
|
||||||
|
procedure TOS3MainFrm.mnuAnalysisNonPar_GenKappaClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if GenKappaFrm = nil then
|
||||||
|
Application.CreateForm(TGenKappaFrm, GenKappaFrm);
|
||||||
|
GenKappaFrm.ShowModal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Menu "Analysis" > "Nonparametric" > "Kappa and Weighted Kappa"
|
||||||
|
procedure TOS3MainFrm.mnuAnalysisNonPar_WeightedKappaClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if WeightedKappaFrm = nil then
|
||||||
|
Application.CreateForm(TWeightedKappaFrm, WeightedKappaFrm);
|
||||||
|
WeightedKappaFrm.ShowModal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Menu "Analysis" > "Nonparametric" > "Life table"
|
||||||
|
procedure TOS3MainFrm.mnuAnalysisNonPar_LifeTableClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if LifeTableForm = nil then
|
||||||
|
Application.CreateForm(TLifeTableForm, LifeTableForm);
|
||||||
|
LifeTableForm.ShowModal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ Descriptive statistics commands }
|
{ Descriptive statistics commands }
|
||||||
|
Reference in New Issue
Block a user