SUBROUTINE BET0(NFILE,N,TITLE,M,R,LDR,ANORM,P,LDP) C This routine reads in the parameters for multiple multivariate beta C distributions. It prints out informataion about the distributions, C computes and returns normalizing constants for the densities, C and one draw from each distribution. C Inputs: C NFILE File number for reading input information C N Number of beta distributions C TITLE Information printed at start C M Number of categories for each multivariate beta distribution C LDR Leading dimension of R matrix C LDP Leading dimension of P matrix C Outputs: C R Row i contains the M parameters of distribution i. C ANORM Log normalizing constant for joint multivariate beta distribution C P Row i has one drawing from distribution i. IMPLICIT REAL*8 (A-H,O-Z) CHARACTER*(*)TITLE PARAMETER(LD=100) COMMON/SCRA/V1(LD),V2(LD),A1(LD,LD),A2(LD,LD) DIMENSION R(LDR,M),P(LDR,M) WRITE(6,10)TITLE 10 FORMAT(/,' Multivariate beta prior distribution for ',A) AA=0.0D0 DO 50 I=1,N READ(NFILE,*,END=110,ERR=120)(V1(J),J=1,M) DO 20 J=1,M 20 IF(V1(J).LE.0.0D0)GO TO 130 AA=AA+BETN(M,V1) CALL BET(M,V1,V2) WRITE(6,30)(V1(J),J=1,M) 30 FORMAT(' Parameters:',4(1PE16.7),/,(12X,4(1PE16.7))) WRITE(6,40)(V2(J),J=1,M) 40 FORMAT(' Drawing:',4(1PE16.7),/,(12X,4(1PE16.7))) DO 50 J=1,M R(I,J)=V1(J) 50 P(I,J)=V2(J) ANORM=AA RETURN 110 CALL PEND('UNANTICIPATED END-OF-FILE READING BETA PRIOR') 120 CALL PEND('ERROR READING BETA PRIOR') 130 CALL PINTR(' BETA PRIOR PARAMETER',V1(J),0.0D0,1.0D1000) END