time-to-botec

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

README.md (5851B)


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