time-to-botec

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

README.md (6821B)


      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 # Exponential
     22 
     23 > Exponential 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 Exponential = require( '@stdlib/stats/base/dists/exponential/ctor' );
     41 ```
     42 
     43 #### Exponential( \[lambda] )
     44 
     45 Returns an [exponential][exponential-distribution] distribution object.
     46 
     47 ```javascript
     48 var exponential = new Exponential();
     49 
     50 var mu = exponential.mean;
     51 // returns 1.0
     52 ```
     53 
     54 By default, `lambda = 1.0`. To create a distribution having a different rate parameter `lambda`, provide a parameter value.
     55 
     56 ```javascript
     57 var exponential = new Exponential( 4.0 );
     58 
     59 var mu = exponential.mean;
     60 // returns 0.25
     61 ```
     62 
     63 * * *
     64 
     65 ## exponential
     66 
     67 An [exponential][exponential-distribution] distribution object has the following properties and methods...
     68 
     69 ### Writable Properties
     70 
     71 #### exponential.lambda
     72 
     73 Rate parameter of the distribution. `lambda` **must** be a positive number.
     74 
     75 ```javascript
     76 var exponential = new Exponential( 2.0 );
     77 
     78 var lambda = exponential.lambda;
     79 // returns 2.0
     80 
     81 exponential.lambda = 3.0;
     82 
     83 lambda = exponential.lambda;
     84 // returns 3.0
     85 ```
     86 
     87 * * *
     88 
     89 ### Computed Properties
     90 
     91 #### Exponential.prototype.entropy
     92 
     93 Returns the [differential entropy][entropy].
     94 
     95 ```javascript
     96 var exponential = new Exponential( 4.0 );
     97 
     98 var entropy = exponential.entropy;
     99 // returns ~-0.386
    100 ```
    101 
    102 #### Exponential.prototype.kurtosis
    103 
    104 Returns the [excess kurtosis][kurtosis].
    105 
    106 ```javascript
    107 var exponential = new Exponential( 4.0 );
    108 
    109 var kurtosis = exponential.kurtosis;
    110 // returns 6.0
    111 ```
    112 
    113 #### Exponential.prototype.mean
    114 
    115 Returns the [expected value][expected-value].
    116 
    117 ```javascript
    118 var exponential = new Exponential( 4.0 );
    119 
    120 var mu = exponential.mean;
    121 // returns 0.25
    122 ```
    123 
    124 #### Exponential.prototype.median
    125 
    126 Returns the [median][median].
    127 
    128 ```javascript
    129 var exponential = new Exponential( 4.0 );
    130 
    131 var median = exponential.median;
    132 // returns ~0.173
    133 ```
    134 
    135 #### Exponential.prototype.mode
    136 
    137 Returns the [mode][mode].
    138 
    139 ```javascript
    140 var exponential = new Exponential( 4.0 );
    141 
    142 var mode = exponential.mode;
    143 // returns 0.0
    144 ```
    145 
    146 #### Exponential.prototype.skewness
    147 
    148 Returns the [skewness][skewness].
    149 
    150 ```javascript
    151 var exponential = new Exponential( 4.0 );
    152 
    153 var skewness = exponential.skewness;
    154 // returns 2.0
    155 ```
    156 
    157 #### Exponential.prototype.stdev
    158 
    159 Returns the [standard deviation][standard-deviation].
    160 
    161 ```javascript
    162 var exponential = new Exponential( 4.0 );
    163 
    164 var s = exponential.stdev;
    165 // returns 0.25
    166 ```
    167 
    168 #### Exponential.prototype.variance
    169 
    170 Returns the [variance][variance].
    171 
    172 ```javascript
    173 var exponential = new Exponential( 4.0 );
    174 
    175 var s2 = exponential.variance;
    176 // returns ~0.063
    177 ```
    178 
    179 * * *
    180 
    181 ### Methods
    182 
    183 #### Exponential.prototype.cdf( x )
    184 
    185 Evaluates the [cumulative distribution function][cdf] (CDF).
    186 
    187 ```javascript
    188 var exponential = new Exponential( 2.0 );
    189 
    190 var y = exponential.cdf( 0.5 );
    191 // returns ~0.632
    192 ```
    193 
    194 #### Exponential.prototype.logcdf( x )
    195 
    196 Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF).
    197 
    198 ```javascript
    199 var exponential = new Exponential( 2.0 );
    200 
    201 var y = exponential.logcdf( 0.5 );
    202 // returns ~-0.459
    203 ```
    204 
    205 #### Exponential.prototype.logpdf( x )
    206 
    207 Evaluates the natural logarithm of the [probability density function][pdf] (PDF).
    208 
    209 ```javascript
    210 var exponential = new Exponential( 2.0 );
    211 
    212 var y = exponential.logpdf( 0.8 );
    213 // returns ~-0.907
    214 ```
    215 
    216 #### Exponential.prototype.mgf( t )
    217 
    218 Evaluates the [moment-generating function][mgf] (MGF).
    219 
    220 ```javascript
    221 var exponential = new Exponential( 2.0 );
    222 
    223 var y = exponential.mgf( 0.5 );
    224 // returns ~1.333
    225 ```
    226 
    227 #### Exponential.prototype.pdf( x )
    228 
    229 Evaluates the [probability density function][pdf] (PDF).
    230 
    231 ```javascript
    232 var exponential = new Exponential( 2.0 );
    233 
    234 var y = exponential.pdf( 0.8 );
    235 // returns ~0.404
    236 ```
    237 
    238 #### Exponential.prototype.quantile( p )
    239 
    240 Evaluates the [quantile function][quantile-function] at probability `p`.
    241 
    242 ```javascript
    243 var exponential = new Exponential( 2.0 );
    244 
    245 var y = exponential.quantile( 0.5 );
    246 // returns ~0.347
    247 
    248 y = exponential.quantile( 1.9 );
    249 // returns NaN
    250 ```
    251 
    252 </section>
    253 
    254 <!-- /.usage -->
    255 
    256 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    257 
    258 <section class="notes">
    259 
    260 </section>
    261 
    262 <!-- /.notes -->
    263 
    264 <!-- Package usage examples. -->
    265 
    266 * * *
    267 
    268 <section class="examples">
    269 
    270 ## Examples
    271 
    272 <!-- eslint no-undef: "error" -->
    273 
    274 ```javascript
    275 var Exponential = require( '@stdlib/stats/base/dists/exponential/ctor' );
    276 
    277 var exponential = new Exponential( 2.0 );
    278 
    279 var mu = exponential.mean;
    280 // returns 0.5
    281 
    282 var mode = exponential.mode;
    283 // returns 0.0
    284 
    285 var s2 = exponential.variance;
    286 // returns 0.25
    287 
    288 var y = exponential.cdf( 0.8 );
    289 // returns ~0.798
    290 ```
    291 
    292 </section>
    293 
    294 <!-- /.examples -->
    295 
    296 <!-- 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. -->
    297 
    298 <section class="references">
    299 
    300 </section>
    301 
    302 <!-- /.references -->
    303 
    304 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    305 
    306 <section class="links">
    307 
    308 [exponential-distribution]: https://en.wikipedia.org/wiki/Exponential_distribution
    309 
    310 [cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
    311 
    312 [mgf]: https://en.wikipedia.org/wiki/Moment-generating_function
    313 
    314 [pdf]: https://en.wikipedia.org/wiki/Probability_density_function
    315 
    316 [quantile-function]: https://en.wikipedia.org/wiki/Quantile_function
    317 
    318 [entropy]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
    319 
    320 [expected-value]: https://en.wikipedia.org/wiki/Expected_value
    321 
    322 [kurtosis]: https://en.wikipedia.org/wiki/Kurtosis
    323 
    324 [median]: https://en.wikipedia.org/wiki/Median
    325 
    326 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29
    327 
    328 [skewness]: https://en.wikipedia.org/wiki/Skewness
    329 
    330 [standard-deviation]: https://en.wikipedia.org/wiki/Standard_deviation
    331 
    332 [variance]: https://en.wikipedia.org/wiki/Variance
    333 
    334 </section>
    335 
    336 <!-- /.links -->