Daily Speculations The Web Site of Victor Niederhoffer & Laurel Kenner Dedicated to the scientific method, free markets, deflating ballyhoo, creating value, and laughter;  a forum for us to use our meager abilities to make the world of specinvestments a better place.

Write to us at: (address is not clickable)

integer ivec(6000)
npop=6000
nattack=41
nth=20
monte=10000
nsig=0
call RSEED(23,1554,9001)
call SMP0INI(npop,ivec)
do 1000 i=1,monte
c select 'nattack' persons without replacement from 'npop'
call SMPL3(npop,nattack,ivec,ier)
itot1=0
itot2=0
itot3=0
c check whether each person having attack is in group 1, 2 or 3
do 50 k=1,nattack
ipers=ivec(k)
if (ipers.ge.1 .and. ipers.le.2000) itot1=itot1+1
if (ipers.ge.2001 .and. ipers.le.4000) itot2=itot2+1
if (ipers.ge.4001 .and. ipers.le.6000) itot3=itot3+1
if (ipers.gt.npop) stop
50 continue
c test whether of the three groups exceeds threshold 'nth'
isaw=0
if (itot1.ge.nth .or. itot2.ge.nth .or. itot3.ge.nth) isaw=1
if (isaw.gt.0) nsig=nsig+1
1000 continue
write(6,1010) nsig,monte
1010 format(i6,' cases found in ',i6,' random trials')
end