MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Drawing in a Poission Distribution

The bellow code is used to calculate the significance of an event. This code was supplied in the paper
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]

  • Prev by Date: 3D-like graph of 2D functions
  • Next by Date: Re: f'[0]=0.5 is True?
  • Previous by thread: 3D-like graph of 2D functions
  • Next by thread: keep special functions unexpanded