Drawing in a Poission Distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg131406] Drawing in a Poission Distribution
- From: William Duhe <wjduhe at loyno.edu>
- Date: Sat, 20 Jul 2013 05:58:33 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
The bellow code is used to calculate the significance of an event. This code was supplied in the paper http://www.aanda.org/articles/aa/pdf/2005/04/aa0839.pdf and I am attempting to check its validity with the the null hypothesis. I would like non and noff to be drawn from Poisson Distributions such as: non = RandomVariate[PoissonDistribution[\[Alpha]*off], 100000]; noff = RandomVariate[PoissonDistribution[off], 100000]; thus creating a list of outputs of the different significances calculated via the algorithm bellow. Then I would fill histograms with these values and fit them against a normal distribution. I just need to be able to loop through this algorithm drawing from the values detailed above. data = {a -> 0.25, non -> 16, noff -> 10}; n = non + noff; b = non/noff; wmin = a/(1 + a); pBin[x_, n_, non_] := Binomial[n, non] x^non (1 - x)^(n - non); pRaw[x_, n_, non_] := pBin[x, n, non] (Sqrt[n/x (1 - x)]); norm = Integrate[pRaw[x, n, non], {x, wmin, 1}]; p[x_] := pRaw[x, n, non]/norm; rule = FindRoot[ Evaluate[(1 - w) (1 + a) == (wmin/w)^b /. data], {w, wmin/a, non/n, 1} /. data]; i[w0_, w1_] := Integrate[p[w], {w, w0, w1}, GenerateConditions -> False]; temp = Evaluate[(i[wmin, w /. rule]) /. data]; Print["Sigma (Bayes): "]; sigma = InverseErf[temp] Sqrt[2]