time-to-botec

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

README.md (6302B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2018 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # Poisson
     22 
     23 > Poisson distribution constructor.
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 </section>
     30 
     31 <!-- /.intro -->
     32 
     33 <!-- Package usage documentation. -->
     34 
     35 <section class="usage">
     36 
     37 ## Usage
     38 
     39 ```javascript
     40 var Poisson = require( '@stdlib/stats/base/dists/poisson/ctor' );
     41 ```
     42 
     43 #### Poisson( \[lambda] )
     44 
     45 Returns an [Poisson][poisson-distribution] distribution object.
     46 
     47 ```javascript
     48 var poisson = new Poisson();
     49 
     50 var lambda = poisson.mean;
     51 // returns 1.0
     52 ```
     53 
     54 By default, `lambda = 1.0`. To create a distribution having a different mean parameter `lambda`, provide a parameter value.
     55 
     56 ```javascript
     57 var poisson = new Poisson( 4.0 );
     58 
     59 var lambda = poisson.mean;
     60 // returns 4.0
     61 ```
     62 
     63 * * *
     64 
     65 ## poisson
     66 
     67 A [Poisson][poisson-distribution] distribution object has the following properties and methods...
     68 
     69 ### Writable Properties
     70 
     71 #### poisson.lambda
     72 
     73 Mean parameter of the distribution. `lambda` **must** be a positive number.
     74 
     75 ```javascript
     76 var poisson = new Poisson( 2.0 );
     77 
     78 var lambda = poisson.lambda;
     79 // returns 2.0
     80 
     81 poisson.lambda = 3.0;
     82 
     83 lambda = poisson.lambda;
     84 // returns 3.0
     85 ```
     86 
     87 * * *
     88 
     89 ### Computed Properties
     90 
     91 #### Poisson.prototype.entropy
     92 
     93 Returns the [differential entropy][entropy].
     94 
     95 ```javascript
     96 var poisson = new Poisson( 4.0 );
     97 
     98 var entropy = poisson.entropy;
     99 // returns ~2.087
    100 ```
    101 
    102 #### Poisson.prototype.kurtosis
    103 
    104 Returns the [excess kurtosis][kurtosis].
    105 
    106 ```javascript
    107 var poisson = new Poisson( 4.0 );
    108 
    109 var kurtosis = poisson.kurtosis;
    110 // returns 0.25
    111 ```
    112 
    113 #### Poisson.prototype.mean
    114 
    115 Returns the [median][expected-value].
    116 
    117 ```javascript
    118 var poisson = new Poisson( 4.0 );
    119 
    120 var mu = poisson.mean;
    121 // returns 4.0
    122 ```
    123 
    124 #### Poisson.prototype.median
    125 
    126 Returns the [median][median].
    127 
    128 ```javascript
    129 var poisson = new Poisson( 4.0 );
    130 
    131 var median = poisson.median;
    132 // returns 4.0
    133 ```
    134 
    135 #### Poisson.prototype.mode
    136 
    137 Returns the [mode][mode].
    138 
    139 ```javascript
    140 var poisson = new Poisson( 4.0 );
    141 
    142 var mode = poisson.mode;
    143 // returns 4.0
    144 ```
    145 
    146 #### Poisson.prototype.skewness
    147 
    148 Returns the [skewness][skewness].
    149 
    150 ```javascript
    151 var poisson = new Poisson( 4.0 );
    152 
    153 var skewness = poisson.skewness;
    154 // returns 0.5
    155 ```
    156 
    157 #### Poisson.prototype.stdev
    158 
    159 Returns the [standard deviation][standard-deviation].
    160 
    161 ```javascript
    162 var poisson = new Poisson( 4.0 );
    163 
    164 var s = poisson.stdev;
    165 // returns 2.0
    166 ```
    167 
    168 #### Poisson.prototype.variance
    169 
    170 Returns the [variance][variance].
    171 
    172 ```javascript
    173 var poisson = new Poisson( 4.0 );
    174 
    175 var s2 = poisson.variance;
    176 // returns 4.0
    177 ```
    178 
    179 * * *
    180 
    181 ### Methods
    182 
    183 #### Poisson.prototype.cdf( x )
    184 
    185 Evaluates the [cumulative distribution function][cdf] (CDF).
    186 
    187 ```javascript
    188 var poisson = new Poisson( 2.0 );
    189 
    190 var y = poisson.cdf( 0.5 );
    191 // returns ~0.135
    192 ```
    193 
    194 #### Poisson.prototype.logpmf( x )
    195 
    196 Evaluates the natural logarithm of the [probability mass function][pmf] (PMF).
    197 
    198 ```javascript
    199 var poisson = new Poisson( 2.0 );
    200 
    201 var y = poisson.logpmf( 3.0 );
    202 // returns ~-1.712
    203 
    204 y = poisson.logpmf( 2.3 );
    205 // returns -Infinity
    206 ```
    207 
    208 #### Poisson.prototype.mgf( t )
    209 
    210 Evaluates the [moment-generating function][mgf] (MGF).
    211 
    212 ```javascript
    213 var poisson = new Poisson( 2.0 );
    214 
    215 var y = poisson.mgf( 0.5 );
    216 // returns ~3.66
    217 ```
    218 
    219 #### Poisson.prototype.pmf( x )
    220 
    221 Evaluates the [probability mass function][pmf] (PMF).
    222 
    223 ```javascript
    224 var poisson = new Poisson( 2.0 );
    225 
    226 var y = poisson.pmf( 3.0 );
    227 // returns ~0.18
    228 
    229 y = poisson.pmf( 2.3 );
    230 // returns 0.0
    231 ```
    232 
    233 #### Poisson.prototype.quantile( p )
    234 
    235 Evaluates the [quantile function][quantile-function] at probability `p`.
    236 
    237 ```javascript
    238 var poisson = new Poisson( 2.0 );
    239 
    240 var y = poisson.quantile( 0.5 );
    241 // returns 2.0
    242 
    243 y = poisson.quantile( 1.9 );
    244 // returns NaN
    245 ```
    246 
    247 </section>
    248 
    249 <!-- /.usage -->
    250 
    251 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    252 
    253 <section class="notes">
    254 
    255 </section>
    256 
    257 <!-- /.notes -->
    258 
    259 <!-- Package usage examples. -->
    260 
    261 * * *
    262 
    263 <section class="examples">
    264 
    265 ## Examples
    266 
    267 <!-- eslint no-undef: "error" -->
    268 
    269 ```javascript
    270 var Poisson = require( '@stdlib/stats/base/dists/poisson/ctor' );
    271 
    272 var poisson = new Poisson( 2.0 );
    273 
    274 var mu = poisson.mean;
    275 // returns 2.0
    276 
    277 var mode = poisson.mode;
    278 // returns 2.0
    279 
    280 var s2 = poisson.variance;
    281 // returns 2.0
    282 
    283 var y = poisson.cdf( 0.8 );
    284 // returns ~0.135
    285 ```
    286 
    287 </section>
    288 
    289 <!-- /.examples -->
    290 
    291 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    292 
    293 <section class="references">
    294 
    295 </section>
    296 
    297 <!-- /.references -->
    298 
    299 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    300 
    301 <section class="links">
    302 
    303 [poisson-distribution]: https://en.wikipedia.org/wiki/Poisson_distribution
    304 
    305 [cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
    306 
    307 [mgf]: https://en.wikipedia.org/wiki/Moment-generating_function
    308 
    309 [pmf]: https://en.wikipedia.org/wiki/Probability_mass_function
    310 
    311 [quantile-function]: https://en.wikipedia.org/wiki/Quantile_function
    312 
    313 [entropy]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
    314 
    315 [expected-value]: https://en.wikipedia.org/wiki/Expected_value
    316 
    317 [kurtosis]: https://en.wikipedia.org/wiki/Kurtosis
    318 
    319 [median]: https://en.wikipedia.org/wiki/Median
    320 
    321 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29
    322 
    323 [skewness]: https://en.wikipedia.org/wiki/Skewness
    324 
    325 [standard-deviation]: https://en.wikipedia.org/wiki/Standard_deviation
    326 
    327 [variance]: https://en.wikipedia.org/wiki/Variance
    328 
    329 </section>
    330 
    331 <!-- /.links -->