repl.txt (1864B)
1 2 {{alias}}( [p] ) 3 Returns a Bernoulli distribution object. 4 5 Parameters 6 ---------- 7 p: number (optional) 8 Success probability. Must be between `0` and `1`. Default: `0.5`. 9 10 Returns 11 ------- 12 bernoulli: Object 13 Distribution instance. 14 15 bernoulli.p: number 16 Success probability. If set, the value must be between `0` and `1`. 17 18 bernoulli.entropy: number 19 Read-only property which returns the differential entropy. 20 21 bernoulli.kurtosis: number 22 Read-only property which returns the excess kurtosis. 23 24 bernoulli.mean: number 25 Read-only property which returns the expected value. 26 27 bernoulli.median: number 28 Read-only property which returns the median. 29 30 bernoulli.skewness: number 31 Read-only property which returns the skewness. 32 33 bernoulli.stdev: number 34 Read-only property which returns the standard deviation. 35 36 bernoulli.variance: number 37 Read-only property which returns the variance. 38 39 bernoulli.cdf: Function 40 Evaluates the cumulative distribution function (CDF). 41 42 bernoulli.mgf: Function 43 Evaluates the moment-generating function (MGF). 44 45 bernoulli.pmf: Function 46 Evaluates the probability mass function (PMF). 47 48 bernoulli.quantile: Function 49 Evaluates the quantile function at probability `p`. 50 51 Examples 52 -------- 53 > var bernoulli = {{alias}}( 0.6 ); 54 > bernoulli.p 55 0.6 56 > bernoulli.entropy 57 ~0.673 58 > bernoulli.kurtosis 59 ~-1.833 60 > bernoulli.mean 61 0.6 62 > bernoulli.median 63 1.0 64 > bernoulli.skewness 65 ~-0.408 66 > bernoulli.stdev 67 ~0.49 68 > bernoulli.variance 69 ~0.24 70 > bernoulli.cdf( 0.5 ) 71 0.4 72 > bernoulli.mgf( 3.0 ) 73 ~12.451 74 > bernoulli.pmf( 0.0 ) 75 0.4 76 > bernoulli.quantile( 0.7 ) 77 1.0 78 79 See Also 80 -------- 81