C--------------------------------------------------C
C     PVMCBV.F COMPUTES VECTOR OF P-VALUES         C
C       FOR MCB INFERENCE                          C
C     LAST REVISION: 06/12/93 BY JCH               C
C--------------------------------------------------C
      SUBROUTINE PVMCBV(KM1,FACT1,DNU,D,PVAL)
      IMPLICIT DOUBLEPRECISION (A-H,O-Z)
C6    IMPLICIT REAL*8 (A-H,O-Z)
      EXTERNAL GLV,GHB1
      DIMENSION D(KM1),PVAL(KM1)
      DIMENSION FACT1(KM1)
      DIMENSION A(100),B(100),C(100)
      DIMENSION PH(48),WH(48),WHLN(48),ZH(48)
      DIMENSION PL(48),WL(48)
      DIMENSION AH(7),BH(12)
      COMMON/LIST2/A,B,C
      COMMON/LIST5/DINFNU
      COMMON/LIST6/PH,WH,ZH,WHLN
      COMMON/LIST7/PL,WL
      COMMON/LIST8/ZERO,ZSR,ZLOG,ZLN
      COMMON/LIST9/SR2,PI,SRPI,PIB2
      COMMON/LIST10/IIN,IOUT,IOUTI
      COMMON/LIST12/AH,BH
C     ----------------------------------
C     INITIALIZE COMMONLY USED CONSTANTS
C     ----------------------------------
      CALL COMMGQ
      IMC=21
C
C     -----------------------
C     INITIALIZE CORRELATIONS
C     -----------------------
      DO 10 J=1,KM1
C       ----------------------
C       A = FACTOR PATTERN
C       C = 1/SQRT(UNIQUENESS)
C       ----------------------
        A(J)=DBLE(FACT1(J))
        C(J)=1.0D0/DSQRT(1.0D0-A(J)*A(J))
 10     CONTINUE
C
C     ----------------
C     COMPUTE P-VALUES
C     ----------------
      K=KM1+1
      DO 1000,I=1,KM1
            PVAL(I)=1.0D0-GLV(GHB1,IMC,K,D(I),DNU,-1.0D0)
 1000 CONTINUE
      RETURN
      END
