Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15201
| From | William Duhe <wjduhe@loyno.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Drawing in a Poission Distribution |
| Date | 2013-07-20 09:51 +0000 |
| Message-ID | <ksdmjr$4vc$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
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]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Drawing in a Poission Distribution William Duhe <wjduhe@loyno.edu> - 2013-07-20 09:51 +0000
csiph-web