The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: none
Declaration: function PerformChi2DistComp (CountObserved, CountExpected: TIntArray; var Chi2, p: double; var df: integer; var nObs, nExp: integer): integer;

The function PerformChi2DistComp performs a chi2-test to compare two empirical distributions. The two datasets are specified by means of their frequency distributions stored in the arrays CountObserved and CountExpected. Please note that the bin limits of both frequency distributions must exactly match. The function returns the chi2-value in the variable parameter Chi2, its corresponding p-value in parameter p and the number of degrees of freedom in parameter df. The variable parameters nObs and nExp contain the number of obervations contained in CountObserved and CountExpected.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the frequency distribution arrays do not have the same size
-2 ... one of the data arrays is not intialized
-3 ... one of the frequency distributions contain zero observations

Last Update: 2020-May-14