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.