From: shd@jolt.modeemi.cs.tut.fi (Heikki Orsila)
To: Jason Detwiler <jasondet@gmail.com>
Cc: gsl-discuss@sources.redhat.com
Subject: Re: request for Poisson CDF inverse
Date: Fri, 06 Jul 2007 09:31:00 -0000 [thread overview]
Message-ID: <20070706093002.GI24297@jolt.modeemi.cs.tut.fi> (raw)
In-Reply-To: <b1d795290707051716s4f4d00e5jeabec36855569558@mail.gmail.com>
On Thu, Jul 05, 2007 at 05:16:38PM -0700, Jason Detwiler wrote:
> I am looking to calculate the inverse of the CDF for the Poisson
> distribution. I noticed that many of the CDFs coded in gsl have
> inverse functions also coded, but this is not the case for the Poisson
> distribution (unfortunately for me). I would like to "request" these
> functions. I would try to contribute them myself, but I'm not
> confident I could code them to the standards of gsl. What are the
> chances of my wishes being fulfilled by another developer?
Are you looking for something like this?
http://zakalwe.fi/~shd/code/poisson.py
This code maps a probability from range [0, 1) into a number of
random events happening at a given invocation. This is done in
Poisson_Process.random().
Example, 1E6 invocations, probability p = 0.05 of an event. This will
give frequencies for each N (the number of random events happening):
$ ./poisson.py |sort -n |uniq -c |sort -n
...
75 3
2482 2
47754 1
949688 0
As a comparison:
1E6*0.05^1 = 50000
1E6*0.05^2 = 2500
1E6*0.05^3 = 125
So these values are pretty close to what they should be. This random
process is only an approximation. I put an intentional limit into
probabilities so that events that rarer than 1E-9 do not happen unless
the Poisson_Process constructor is suplied with a value.
--
Heikki Orsila Barbie's law:
heikki.orsila@iki.fi "Math is hard, let's go shopping!"
http://www.iki.fi/shd
next prev parent reply other threads:[~2007-07-06 9:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-06 7:30 Jason Detwiler
2007-07-06 9:31 ` Heikki Orsila [this message]
2007-07-08 21:54 ` Brian Gough
2007-07-08 23:39 ` Heikki Orsila
2007-07-10 14:49 ` Brian Gough
2011-08-31 10:51 ` Jason Detwiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070706093002.GI24297@jolt.modeemi.cs.tut.fi \
--to=shd@jolt.modeemi.cs.tut.fi \
--cc=gsl-discuss@sources.redhat.com \
--cc=jasondet@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).