You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7885 8e941d3f-bd1b-0410-a28a-d453659cc2b4
66 lines
1.2 KiB
ObjectPascal
66 lines
1.2 KiB
ObjectPascal
unit ProbChiSqrUnit;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
|
StdCtrls, functionslib;
|
|
|
|
type
|
|
|
|
{ TChiSqrProbForm }
|
|
|
|
TChiSqrProbForm = class(TForm)
|
|
CancelBtn: TButton;
|
|
ChiSqrEdit: TEdit;
|
|
ComputeBtn: TButton;
|
|
DFEdit: TEdit;
|
|
ProbEdit: TEdit;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
Label3: TLabel;
|
|
ResetBtn: TButton;
|
|
ReturnBtn: TButton;
|
|
procedure ComputeBtnClick(Sender: TObject);
|
|
procedure ResetBtnClick(Sender: TObject);
|
|
private
|
|
{ private declarations }
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
var
|
|
ChiSqrProbForm: TChiSqrProbForm;
|
|
|
|
implementation
|
|
|
|
{ TChiSqrProbForm }
|
|
|
|
procedure TChiSqrProbForm.ResetBtnClick(Sender: TObject);
|
|
begin
|
|
ChiSqrEdit.Text := '';
|
|
DFEdit.Text := '';
|
|
ProbEdit.Text := '';
|
|
end;
|
|
|
|
procedure TChiSqrProbForm.ComputeBtnClick(Sender: TObject);
|
|
VAR
|
|
ChiSqr, Prob : double;
|
|
DF : integer;
|
|
outvalue : string;
|
|
begin
|
|
ChiSqr := StrToFloat(ChiSqrEdit.Text);
|
|
DF := StrToInt(DFEdit.Text);
|
|
Prob := 1.0 - chisquaredprob(ChiSqr,DF);
|
|
outvalue := format('%6.4f',[Prob]);
|
|
ProbEdit.Text := outvalue;
|
|
end;
|
|
|
|
initialization
|
|
{$I probchisqrunit.lrs}
|
|
|
|
end.
|
|
|