repl.txt (2068B)
1 2 {{alias}}( x, N, K, n ) 3 Evaluates the probability mass function (PMF) for a hypergeometric 4 distribution with population size `N`, subpopulation size `K`, and number of 5 draws `n` at a value `x`. 6 7 If provided `NaN` as any argument, the function returns `NaN`. 8 9 If provided a population size `N`, subpopulation size `K` or draws `n` which 10 is not a nonnegative integer, the function returns `NaN`. 11 12 If the number of draws `n` or the subpopulation size `K` exceed population 13 size `N`, the function returns `NaN`. 14 15 Parameters 16 ---------- 17 x: number 18 Input value. 19 20 N: integer 21 Population size. 22 23 K: integer 24 Subpopulation size. 25 26 n: integer 27 Number of draws. 28 29 Returns 30 ------- 31 out: number 32 Evaluated PMF. 33 34 Examples 35 -------- 36 > var y = {{alias}}( 1.0, 8, 4, 2 ) 37 ~0.571 38 > y = {{alias}}( 2.0, 8, 4, 2 ) 39 ~0.214 40 > y = {{alias}}( 0.0, 8, 4, 2 ) 41 ~0.214 42 > y = {{alias}}( 1.5, 8, 4, 2 ) 43 0.0 44 45 > y = {{alias}}( NaN, 10, 5, 2 ) 46 NaN 47 > y = {{alias}}( 0.0, NaN, 5, 2 ) 48 NaN 49 > y = {{alias}}( 0.0, 10, NaN, 2 ) 50 NaN 51 > y = {{alias}}( 0.0, 10, 5, NaN ) 52 NaN 53 54 > y = {{alias}}( 2.0, 10.5, 5, 2 ) 55 NaN 56 > y = {{alias}}( 2.0, 5, 1.5, 2 ) 57 NaN 58 > y = {{alias}}( 2.0, 10, 5, -2.0 ) 59 NaN 60 > y = {{alias}}( 2.0, 10, 5, 12 ) 61 NaN 62 > y = {{alias}}( 2.0, 8, 3, 9 ) 63 NaN 64 65 66 {{alias}}.factory( N, K, n ) 67 Returns a function for evaluating the probability mass function (PMF) of a 68 hypergeometric distribution with population size `N`, subpopulation size 69 `K`, and number of draws `n`. 70 71 Parameters 72 ---------- 73 N: integer 74 Population size. 75 76 K: integer 77 Subpopulation size. 78 79 n: integer 80 Number of draws. 81 82 Returns 83 ------- 84 pmf: Function 85 Probability mass function (PMF). 86 87 Examples 88 -------- 89 > var myPMF = {{alias}}.factory( 30, 20, 5 ); 90 > var y = myPMF( 4.0 ) 91 ~0.34 92 > y = myPMF( 1.0 ) 93 ~0.029 94 95 See Also 96 -------- 97