repl.txt (1860B)
1 2 {{alias}}( x, r, p ) 3 Evaluates the moment-generating function (MGF) for a negative binomial 4 distribution with number of successes until experiment is stopped `r` and 5 success probability `p` at a value `t`. 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 MGF. 30 31 Examples 32 -------- 33 > var y = {{alias}}( 0.05, 20.0, 0.8 ) 34 ~267.839 35 > y = {{alias}}( 0.1, 20.0, 0.1 ) 36 ~9.347 37 > y = {{alias}}( 0.5, 10.0, 0.4 ) 38 ~42822.023 39 40 > y = {{alias}}( 0.1, 0.0, 0.5 ) 41 NaN 42 > y = {{alias}}( 0.1, -2.0, 0.5 ) 43 NaN 44 45 > y = {{alias}}( NaN, 20.0, 0.5 ) 46 NaN 47 > y = {{alias}}( 0.0, NaN, 0.5 ) 48 NaN 49 > y = {{alias}}( 0.0, 20.0, NaN ) 50 NaN 51 52 > y = {{alias}}( 0.2, 20, -1.0 ) 53 NaN 54 > y = {{alias}}( 0.2, 20, 1.5 ) 55 NaN 56 57 58 {{alias}}.factory( r, p ) 59 Returns a function for evaluating the moment-generating function (MGF) of a 60 negative binomial distribution with number of successes until experiment is 61 stopped `r` and success probability `p`. 62 63 Parameters 64 ---------- 65 r: number 66 Number of successes until experiment is stopped. 67 68 p: number 69 Success probability. 70 71 Returns 72 ------- 73 mgf: Function 74 Moment-generating function (MGF). 75 76 Examples 77 -------- 78 > var myMGF = {{alias}}.factory( 4.3, 0.4 ); 79 > var y = myMGF( 0.2 ) 80 ~4.696 81 > y = myMGF( 0.4 ) 82 ~30.83 83 84 See Also 85 -------- 86