Declaration: MedianTest (DataGrp1, DataGrp2: TDoubleArray; var Chi2, pChi2, Chi2Yates, pChi2Yates, pExact: double): integer;
The function MedianTest performs a two-sample median test. The two samples are contained in the arrays DataGrp1 and DataGrp2. The function returns the test statistic (chi-square value) in the variable parameter Chi2 and the corresponding probability in the variable parameter pChi2. In addition, Yates continuity correction is applied, the corresponding chi-square value and the probability is returned in the parameters Chi2Yates and pChi2Yates.

Further, if the total number of objects is less than or equal to 1000 it also calculates the exact probability based on Fisher's exact test and returns it in pExact. If Fisher's exact test is not calculated, a value of -1 is returned in pExact.

The function returns the following error codes:

 0 ... everything is OK, Chi2 and pChi2 are valid
-1 ... one or both data fields are empty
-2 ... one of the margin sums is zero

Hint: Some background information on Mood's median test can be found in the ebook "Fundamentals of Statistics"