time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1812B)


      1 
      2 {{alias}}( x, n, p )
      3     Evaluates the natural logarithm of the probability mass function (PMF) for a
      4     binomial distribution with number of trials `n` and success probability `p`
      5     at a value `x`.
      6 
      7     If provided `NaN` as any argument, the function returns `NaN`.
      8 
      9     If provided a number of trials `n` which is not a nonnegative integer, the
     10     function returns `NaN`.
     11 
     12     If `p < 0` or `p > 1`, the function returns `NaN`.
     13 
     14     Parameters
     15     ----------
     16     x: number
     17         Input value.
     18 
     19     n: integer
     20         Number of trials.
     21 
     22     p: number
     23         Success probability.
     24 
     25     Returns
     26     -------
     27     out: number
     28         Evaluated logPMF.
     29 
     30     Examples
     31     --------
     32     > var y = {{alias}}( 3.0, 20, 0.2 )
     33     ~-1.583
     34     > y = {{alias}}( 21.0, 20, 0.2 )
     35     -Infinity
     36     > y = {{alias}}( 5.0, 10, 0.4 )
     37     ~-1.606
     38     > y = {{alias}}( 0.0, 10, 0.4 )
     39     ~-5.108
     40     > y = {{alias}}( NaN, 20, 0.5 )
     41     NaN
     42     > y = {{alias}}( 0.0, NaN, 0.5 )
     43     NaN
     44     > y = {{alias}}( 0.0, 20, NaN )
     45     NaN
     46     > y = {{alias}}( 2.0, 1.5, 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 
     56 {{alias}}.factory( n, p )
     57     Returns a function for evaluating the natural logarithm of the probability
     58     mass function (PMF) of a binomial distribution with number of trials `n` and
     59     success probability `p`.
     60 
     61     Parameters
     62     ----------
     63     n: integer
     64         Number of trials.
     65 
     66     p: number
     67         Success probability.
     68 
     69     Returns
     70     -------
     71     logpmf: Function
     72         Logarithm of probability mass function (PMF).
     73 
     74     Examples
     75     --------
     76     > var mylogpmf = {{alias}}.factory( 10, 0.5 );
     77     > var y = mylogpmf( 3.0 )
     78     ~-2.144
     79     > y = mylogpmf( 5.0 )
     80     ~-1.402
     81 
     82     See Also
     83     --------
     84