BHAKV
Performs a Bhapkar V test.
Required Arguments
NI — Vector of length NGROUP containing the number of responses for each of the NGROUP groups. (Input)
Y — Vector of length NI(1) + NI(2) +  + NI(NGROUP) containing the responses for each of the NGROUP groups. (Input)
Y must be sorted by group with the NI(1) observations for group 1 coming first.
V — Bhapkar V statistic. (Output)
PROB — Asymptotic probability of exceeding V under the null hypothesis that the populations are equal. (Output)
Asymptotically, V follows a chi‑squared distribution with NGROUP  1 degrees of freedom.
Optional Arguments
NGROUP — Number of groups. (Input)
Default: NGROUP = size (NI,1).
FORTRAN 90 Interface
Generic: CALL BHAKV (NI, Y, V, PROB [])
Specific: The specific interface names are S_BHAKV and D_BHAKV.
FORTRAN 77 Interface
Single: CALL BHAKV (NGROUP, NI, Y, V, PROB)
Double: The double precision name is DBHAKV.
Description
Routine BHAKV tests the hypothesis that several samples are from the same population using the Bhapkar V statistic. Let the number of samples be denoted by K = NGROUP. To compute the Bhapkar V statistic, one first computes, for each group i, the statistic ti = the number of K‑tuples that can be formed with one observation from each sample such that the element from population i is the smallest. The sample variance of the ratio of ti to the total number of such k‑tuples is then computed. The Bhapkar V statistic is then a constant c multiplied by this variance, where c = n(2m  1), m = NGROUP, and n is the sum of the sample sizes (after missing values are eliminated).
Comments
Workspace may be explicitly provided, if desired, by use of B2AKV/DB2AKV. The reference is
CALL B2AKV (NGROUP, NI, Y, V, PROB, IWK, WK, YWK)
The additional arguments are as follows:
IWK — Integer work vector of length NI(1) +  + NI(NGROUP) + NGROUP
WK — Work vector of length NGROUP
YWK — Work vector of length NI(1) +  + NI(NGROUP). If Y is not needed, Y and YWK can share the same storage locations.
Example
We want to test the null hypothesis that three samples of size 3, 2, and 4, respectively, are from the same population using the Bhapkar V statistic.
 
USE BHAKV_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NGROUP
PARAMETER (NGROUP=3)
!
INTEGER NI(NGROUP), NOUT
REAL PROB, V, Y(9)
!
DATA NI/3, 2, 4/
DATA Y/1, 3, 2, -1, 5, 4, 7, 2, 9/
! Perform Bhapkar V test
CALL BHAKV (NI, Y, V, PROB)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99998) V
WRITE (NOUT,99999) PROB
!
99998 FORMAT (' V = ', F12.5)
99999 FORMAT (' Prob = ', F12.5)
!
END
Output
 
V = 1.89429
Prob = 0.38785