Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. PoissonBinomialDistribution[ plist : { __?NumericQ } ] := With[
  2. {
  3. n = Length @ plist,
  4. c = Exp[(2 I [Pi])/(Length@plist + 1)]
  5. }
  6. ,
  7. ProbabilityDistribution[
  8. Re[ 1/(n + 1) Sum[c^(-l k) Product[1 + (c^l - 1) plist[[m]] , {m, 1, n }], {l, 0, n}] ]
  9. ,
  10. {k, 0, n, 1}
  11. ]
  12. ] /; AllTrue[ plist, 0 <= # <= 1& ]
  13.  
  14. dist = PoissonBinomialDistribution[ {0.04, 0.07, 0.07} ];
  15.  
  16. Probability[ k == 3, k [Distributed] dist ]// PercentForm
  17.  
  18. SuccessProbability[plist_,k_] := ...
  19.  
  20. SuccessProbability[{0.04, 0.07, 0.07},3]
  21.  
  22. 0.0196
  23.  
  24. SuccessProbability[plist_, k_] := Probability[k == 3, k [Distributed] (With[{n = Length@plist, c = Exp[(2 I [Pi])/(Length@plist + 1)]}, ProbabilityDistribution[Re[1/(n + 1) Sum[c^(-l k) Product[1 + (c^l - 1) plist[[m]], {m, 1, n}], {l, 0, n}]], {k, 0, n, 1}]] /; AllTrue[plist, 0 <= # <= 1 &])] // PercentForm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement