Usage

For first time usage, point your web browser at http://d0.phys.washington.edu/~gwatts/prob. Once the Probability Not application has loaded enter the expected background and its width (it is always taken to be a gaussian). The gaussian and poisson distrubtions will appear representing those numbers. You can then enter the # of events or the probability (or even grab the slider next to the probability entry box). The program will fill in the one you didn't. It will also shade the plots to show the area represented by the probability.

demo.png

If you wish, you can install Probability Not localy by right-clicking on the application and selecting "Install onto this computer...". In that case, just in case I do actually update it, you might click the tiny tiny "update" button in the lower left hand corner (control-click on a Mac).

Warnings

Two warnings I can think of... I'm sure there are more. :-)
  • Currently this is using a very crude form of area-under-a-curve integration to calculate the probability. This is bad, and not accurate! I will upgrade to a real math library now that I sort-of know what I'm doing with Silverlight.
  • There is a random number generator and trials involved in this calculation (see below). As a result, you can expect repeated answers to not be exact. The trials are only thrown if you alter the # of expected background events or the expected background's width.
  • If you put in a very large wdith (say 1e5) it will appear the program has hung. This isn't what has happened, however, it will take a very long time to do the calculation, and it is being done on the main thread and that causes a hang - so just wait, or kill it and try again. :-)
  • Very small guassian widths on the expected background are not well delt with - so the answer will either come out almost right or it will come out zero... depending on how the randome number generator works. When I use a real math library this will get fixed.

The Calculation

The calculation is actually dirt simple, and contains a number of things that make the number that comes out slightly untrustworthy.
  1. A gaussian with mean and width of the specified expected background value and width is created. It is normalized to one (it could be truncated at zero - no negative probability is allowed here).
  2. A crude calculation is performed to determine the xmin and xmax of the plot.
  3. The length of the axis is sampled uniformly 1000 times, and the guassian function gives an exact weight for each sample.
  4. The Poisson distribution for the expected background is created and weighted by the gaussian weight.
  5. The ~2000 Poisson distributions are then added up (and re-normalized in order to deal with the truncated plot).

The actual number of trials is about 20 times the number of bins. The code does its best to make sure there are atleast 50 bins under the main part of the Gaussian, but for performance reasons limits itself to a total of 2000 bins for the full axis.

This is how the two curves are generated. Calculating the probability is done with simple interpolation. The Poisson distribution is really not continuous, so I use a sample interpolation (assuming P(1) is the same value from 1.0 -> 2.0).

Last edited Dec 29, 2009 at 9:01 PM by gwatts, version 7

Comments

No comments yet.