SUBROUTINE HNRMK(NK,NT,X,LDX,Y,H,HPRI,LDHPRI,HBPRI,BETA) C This routine simulates one draw from the coefficient posterior C distribution arising from a regression model with known C heteroscedasticity and a normal prior for the coefficients. C Inputs: C NK Dimension of coefficient vector (= number of regressors) C NT Number of observations C X NTxNK matrix of regressors C LDX Leading dimension of X C Y NTx1 vector of dependent variables C H NTx1 vector of disturbance precisions C HPRI NKxNK prior precision matrix (symmetric) C LDHPRI Leading dimension of HPRI C HBPRI [HPRI]x[Coefficient prior mean vector] C Output: C BETA NKx1 Draw from posterior distribution IMPLICIT REAL*8 (A-H,O-Z) PARAMETER(LD=100) DIMENSION X(LDX,NK),Y(NT),H(NT),HPRI(LDHPRI,NK),HBPRI(NK), 1 BETA(NK) COMMON/SCRA/A1(LD,LD),A2(LD,LD),V1(LD),V2(LD) C Form posterior precision in A1. DO 10 IK=1,NK DO 10 JK=1,IK 10 A1(JK,IK)=HPRI(JK,IK) DO 20 IT=1,NT HH=H(IT) DO 20 IK=1,NK AA=HH*X(IT,IK) DO 20 JK=1,IK 20 A1(JK,IK)=A1(JK,IK)+AA*X(IT,JK) C Form data vector in V1. CALL DSET(NK,0.0D0,V1,1) DO 30 IT=1,NT AA=H(IT)*Y(IT) DO 30 IK=1,NK 30 V1(IK)=V1(IK)+AA*X(IT,IK) C Form UT Choleski factorization R of [Posterior precision]=R'R in A1. CALL DLFTDS(NK,A1,LD,A1,LD) C Invert R in place and form A2=[Posterior variance]. CALL DLINRT(NK,A1,LD,2,A1,LD) CALL DMXXTU(NK,A1,LD,A2,LD) CALL DFULL(NK,A2,LD) C Form posterior mean in V1. CALL UVADD(NK,V1,HBPRI,V1) CALL DMURRV(NK,NK,A2,LD,NK,V1,1,NK,V2) C Generate realization from distribution in BETA. CALL URNMVN(NK,A1,LD,V1) CALL UVADD(NK,V1,V2,BETA) RETURN END