Post Reply 
(11C) Poisson distribution
12-19-2017, 08:15 PM
Post: #2
RE: (11C) Poisson distribution
(12-18-2017 09:38 AM)Gamo Wrote:  What is the chance of gold of P(k) = 0, 1, 2, 3, 4, 5, 6, 7

Gold ?-)  I assume this is supposed to mean
"What is the probability P(k) for k = 0, 1, 2, 3, 4, 5, 6 or 7 goals".

But why do you use two separate labels for k and P(k)? This way calculating the PDF always requires pressing two keys, B and C.

Here is another version that also calculates the CDF, i.e. P(k1 ≤ k ≤ k2).

Code:
LBL A
STO 0
RTN
LBL B
RCL 0
x<>y
y^x
LastX
x!
/
RCL 0
CHS
e^x
*
RTN
LBL C
ABS
INT
EEX
3
/
x<>y
ABS
INT
+
STO I
LastX
GSB B
x=0?
RTN
ENTER
ENTER
LBL 1
ISG      // (ISG I on the 15C)
GTO 2
x<>y
RTN
LBL 2
RCL 0
*
RCL I
INT
/
+
LastX
GTO 1

Example for λ = 2,5:

Code:
Enter λ

 2,5        [A]    2,5000

Calculate the probability for 1, 2 or 3 goals

  1         [B]    0,2052   P(1)
  2         [B]    0,2565   P(2)
  3         [B]    0,2138   P(3)

Calculate the probability of a match with 1 to 4 goals

1 [ENTER] 4 [C]    0,8091   P(1 ≤ k ≤ 4)

If desired: [R↓]   0,1336   P(4)
            [R↓]   0,2052   P(1)

Direct evaluation of the Poisson PDF often leads to overflow errors. Even cases where k>69 can not be handled this way. Too bad there is no lnΓ function available, this could provide an easy fix.

But there are two workarounds:

1. The recursive method of the CDF routine significantly extends the useable range for λ and k, and this can also be used for calculating the PDF:
Simply enter 0 [ENTER] k [C], and when the result is displayed press [R↓] or [x<>y] to get P(k).

Example:
Evaluate P(80) for λ=90.

Code:
   90        [A]  90,0000
   80        [B]   8,1940 -40  flashing
                   Overflow error while trying to evaluate 90^80 and 80!

0 [ENTER] 80 [C]   0,1582
            [x<>y] 0,0250   P(80)

However, the iteration with k required loops may take some time on a hardware 11C.

Also please note that for λ > 227,9559242 the expression e–λ will underflow to zero. In this case 0 is returned.

2. For large λ and k the following code may be used. It implements a Stirling-based approximation, and since there is no iteration the result is returned immediately.

Code:
LBL E
STO I
RCL 0
RCL I
/
LN
1
+
*
RCL 0
-
e^x
RCL I
6
1/x
+
Pi
*
2
*
sqrt
/
RTN

Example:
Evaluate P(80) for λ=90.

Code:
   90        [A]  90,0000
   80        [E]   0,0250   P(80)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) Poisson distribution - Gamo - 12-18-2017, 09:38 AM
RE: (11C) Poisson distribution - Dieter - 12-19-2017 08:15 PM
RE: (11C) Poisson distribution - Gamo - 12-20-2017, 01:21 AM
RE: (11C) Poisson distribution - SlideRule - 12-23-2017, 06:42 PM
RE: (11C) Poisson distribution - Dieter - 12-24-2017, 12:27 PM



User(s) browsing this thread: 1 Guest(s)