Guest User

Untitled

a guest
May 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. from scipy.special import i0
  2. import numpy as np
  3.  
  4. sample_count = 100000
  5. mean = 10
  6.  
  7. samples = np.random.poisson(mean, (sample_count, 2))
  8. x = samples[:, 0]
  9. y = samples[:, 1]
  10. proportion = sum(x <= y) / sample_count
  11. predicted = (1 + np.exp(-2*mean) * i0(2*mean)) / 2
  12.  
  13. print("mean: {}".format(10))
  14. print("proportion of {} samples with x <= y: {}".format(sample_count, proportion))
  15. print("predicted proportion: {}".format(predicted))
Add Comment
Please, Sign In to add comment