       subroutine starting(sig2,theta,amu)
c      set the starting values of parameters for Gibbs sampling
       real*8 sig2(1:12),theta(1:12,1:4)
       real*8 gam(12)
       real*8 amu(1:12,1:4,1:9)
       real*8 u(324),sum(12,4) 
       integer ifd(324),itp(324),itm(324)
       open(unit=16,file=
     1  'gamma.out',status='old')
       do 400 i=1,12
         read(16,*) gam(i)
         sig2(i)=(1.0d0/gam(i))**2
 400   continue
       close(16)
       open(unit=17,file=
     1  'newmuint.dat',
     1  status='old')
       do 410 i=1,324
         read(17,*) ifd(i),itp(i),itm(i),u(i)
 410   continue
c
       do 415 i=1,12
         do 416 j=1,4
          sum(i,j)=0.0d0
 416     continue
 415   continue
       do 420 i=1,324
         amu(ifd(i),itp(i),itm(i))=u(i)/gam( ifd(i) )
         sum(ifd(i),itp(i))=
     1     sum(ifd(i),itp(i))+u(i)/gam( ifd(i) )
 420   continue
       close(17)
c
       do 425 i=1,12
         theta(i,1)=sum(i,1)/9.0d0
         theta(i,2)=sum(i,2)/8.0d0
         theta(i,3)=sum(i,3)/6.0d0
         theta(i,4)=sum(i,4)/4.0d0
 425   continue
       return
       end
