repl.txt (2082B)
1 2 {{alias}}( x, r, p ) 3 Evaluates the natural logarithm of the probability mass function (PMF) for a 4 negative binomial distribution with number of successes until experiment is 5 stopped `r` and success probability `p` at a value `x`. 6 7 If provided `NaN` as any argument, the function returns `NaN`. 8 9 If provided a `r` which is not a positive number, the function returns 10 `NaN`. 11 12 If provided a success probability `p` outside of `[0,1]`, the function 13 returns `NaN`. 14 15 Parameters 16 ---------- 17 x: number 18 Input value. 19 20 r: number 21 Number of successes until experiment is stopped. 22 23 p: number 24 Success probability. 25 26 Returns 27 ------- 28 out: number 29 Evaluated logPMF. 30 31 Examples 32 -------- 33 > var y = {{alias}}( 5.0, 20.0, 0.8 ) 34 ~-1.853 35 > y = {{alias}}( 21.0, 20.0, 0.5 ) 36 ~-2.818 37 > y = {{alias}}( 5.0, 10.0, 0.4 ) 38 ~-4.115 39 > y = {{alias}}( 0.0, 10.0, 0.9 ) 40 ~-1.054 41 > y = {{alias}}( 21.0, 15.5, 0.5 ) 42 ~-3.292 43 > y = {{alias}}( 5.0, 7.4, 0.4 ) 44 ~-2.976 45 46 > y = {{alias}}( 2.0, 0.0, 0.5 ) 47 NaN 48 > y = {{alias}}( 2.0, -2.0, 0.5 ) 49 NaN 50 > y = {{alias}}( 2.0, 20, -1.0 ) 51 NaN 52 > y = {{alias}}( 2.0, 20, 1.5 ) 53 NaN 54 55 > y = {{alias}}( NaN, 20.0, 0.5 ) 56 NaN 57 > y = {{alias}}( 0.0, NaN, 0.5 ) 58 NaN 59 > y = {{alias}}( 0.0, 20.0, NaN ) 60 NaN 61 62 63 {{alias}}.factory( r, p ) 64 Returns a function for evaluating the natural logarithm of the probability 65 mass function (PMF) of a negative binomial distribution with number of 66 successes until experiment is stopped `r` and success probability `p`. 67 68 Parameters 69 ---------- 70 r: number 71 Number of successes until experiment is stopped. 72 73 p: number 74 Success probability. 75 76 Returns 77 ------- 78 logpmf: Function 79 Logarithm of probability mass function (PMF). 80 81 Examples 82 -------- 83 > var mylogPMF = {{alias}}.factory( 10, 0.5 ); 84 > var y = mylogPMF( 3.0 ) 85 ~-3.617 86 > y = mylogPMF( 5.0 ) 87 ~-2.795 88 89 See Also 90 -------- 91