my Poisson simulation
"""
Created on 2010-3-18
@author: Cross
"""
from scipy.stats import poisson
p1 = poisson(1.725)
p2 = poisson(0.935)
margin_HAD = 1.12
margin_HILO = 1.08
psize = 100000
a1 = p1.rvs(psize)
a2 = p2.rvs(psize)
h=0
d=0
a=0
HI = 0
LO = 0
for i in range(psize):
if a1[i]>a2[i]:
h = h + 1
elif a1[i]
else:
d = d + 1
if a1[i] + a2[i]<2 .5:=".5:" br="br"> LO = LO + 1
else:
HI = HI + 1
print "======================="
print "HDA"
print 1/margin_HAD/(h/float(psize))
print 1/margin_HAD/(d/float(psize))
print 1/margin_HAD/(a/float(psize))
print "======================="
print "HILO 2.5"
print 1/margin_HILO/(LO/float(psize))
print 1/margin_HILO/(HI/float(psize))2>