time-to-botec

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

README.md (6559B)


      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 # Rayleigh
     22 
     23 > Rayleigh 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 Rayleigh = require( '@stdlib/stats/base/dists/rayleigh/ctor' );
     41 ```
     42 
     43 #### Rayleigh( \[sigma] )
     44 
     45 Returns an [Rayleigh][rayleigh-distribution] distribution object.
     46 
     47 ```javascript
     48 var rayleigh = new Rayleigh();
     49 
     50 var mu = rayleigh.mean;
     51 // returns ~1.253
     52 ```
     53 
     54 By default, `sigma = 1.0`. To create a distribution having a different scale parameter `sigma`, provide a parameter value.
     55 
     56 ```javascript
     57 var rayleigh = new Rayleigh( 4.0 );
     58 
     59 var mu = rayleigh.mean;
     60 // returns ~5.013
     61 ```
     62 
     63 * * *
     64 
     65 ## rayleigh
     66 
     67 A [Rayleigh][rayleigh-distribution] distribution object has the following properties and methods...
     68 
     69 ### Writable Properties
     70 
     71 #### rayleigh.sigma
     72 
     73 Scale parameter of the distribution. `sigma` **must** be a positive number.
     74 
     75 ```javascript
     76 var rayleigh = new Rayleigh( 2.0 );
     77 
     78 var sigma = rayleigh.sigma;
     79 // returns 2.0
     80 
     81 rayleigh.sigma = 3.0;
     82 
     83 sigma = rayleigh.sigma;
     84 // returns 3.0
     85 ```
     86 
     87 * * *
     88 
     89 ### Computed Properties
     90 
     91 #### Rayleigh.prototype.entropy
     92 
     93 Returns the [differential entropy][entropy].
     94 
     95 ```javascript
     96 var rayleigh = new Rayleigh( 4.0 );
     97 
     98 var entropy = rayleigh.entropy;
     99 // returns ~2.328
    100 ```
    101 
    102 #### Rayleigh.prototype.kurtosis
    103 
    104 Returns the [excess kurtosis][kurtosis].
    105 
    106 ```javascript
    107 var rayleigh = new Rayleigh( 4.0 );
    108 
    109 var kurtosis = rayleigh.kurtosis;
    110 // returns ~0.245
    111 ```
    112 
    113 #### Rayleigh.prototype.mean
    114 
    115 Returns the [median][expected-value].
    116 
    117 ```javascript
    118 var rayleigh = new Rayleigh( 4.0 );
    119 
    120 var mu = rayleigh.mean;
    121 // returns ~5.013
    122 ```
    123 
    124 #### Rayleigh.prototype.median
    125 
    126 Returns the [median][median].
    127 
    128 ```javascript
    129 var rayleigh = new Rayleigh( 4.0 );
    130 
    131 var median = rayleigh.median;
    132 // returns ~4.71
    133 ```
    134 
    135 #### Rayleigh.prototype.mode
    136 
    137 Returns the [mode][mode].
    138 
    139 ```javascript
    140 var rayleigh = new Rayleigh( 4.0 );
    141 
    142 var mode = rayleigh.mode;
    143 // returns 4.0
    144 ```
    145 
    146 #### Rayleigh.prototype.skewness
    147 
    148 Returns the [skewness][skewness].
    149 
    150 ```javascript
    151 var rayleigh = new Rayleigh( 4.0 );
    152 
    153 var skewness = rayleigh.skewness;
    154 // returns ~0.631
    155 ```
    156 
    157 #### Rayleigh.prototype.stdev
    158 
    159 Returns the [standard deviation][standard-deviation].
    160 
    161 ```javascript
    162 var rayleigh = new Rayleigh( 4.0 );
    163 
    164 var s = rayleigh.stdev;
    165 // returns ~2.62
    166 ```
    167 
    168 #### Rayleigh.prototype.variance
    169 
    170 Returns the [variance][variance].
    171 
    172 ```javascript
    173 var rayleigh = new Rayleigh( 4.0 );
    174 
    175 var s2 = rayleigh.variance;
    176 // returns ~6.867
    177 ```
    178 
    179 * * *
    180 
    181 ### Methods
    182 
    183 #### Rayleigh.prototype.cdf( x )
    184 
    185 Evaluates the [cumulative distribution function][cdf] (CDF).
    186 
    187 ```javascript
    188 var rayleigh = new Rayleigh( 2.0 );
    189 
    190 var y = rayleigh.cdf( 1.5 );
    191 // returns ~0.245
    192 ```
    193 
    194 #### Rayleigh.prototype.logcdf( x )
    195 
    196 Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF).
    197 
    198 ```javascript
    199 var rayleigh = new Rayleigh( 2.0 );
    200 
    201 var y = rayleigh.logcdf( 1.5 );
    202 // returns ~-1.406
    203 ```
    204 
    205 #### Rayleigh.prototype.logpdf( x )
    206 
    207 Evaluates the natural logarithm of the [probability density function][pdf] (PDF).
    208 
    209 ```javascript
    210 var rayleigh = new Rayleigh( 2.0 );
    211 
    212 var y = rayleigh.logpdf( 0.8 );
    213 // returns ~-1.689
    214 ```
    215 
    216 #### Rayleigh.prototype.mgf( t )
    217 
    218 Evaluates the [moment-generating function][mgf] (MGF).
    219 
    220 ```javascript
    221 var rayleigh = new Rayleigh( 2.0 );
    222 
    223 var y = rayleigh.mgf( 0.5 );
    224 // returns ~5.586
    225 ```
    226 
    227 #### Rayleigh.prototype.pdf( x )
    228 
    229 Evaluates the [probability density function][pdf] (PDF).
    230 
    231 ```javascript
    232 var rayleigh = new Rayleigh( 2.0 );
    233 
    234 var y = rayleigh.pdf( 0.8 );
    235 // returns ~0.185
    236 ```
    237 
    238 #### Rayleigh.prototype.quantile( p )
    239 
    240 Evaluates the [quantile function][quantile-function] at probability `p`.
    241 
    242 ```javascript
    243 var rayleigh = new Rayleigh( 2.0 );
    244 
    245 var y = rayleigh.quantile( 0.5 );
    246 // returns ~2.355
    247 
    248 y = rayleigh.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 Rayleigh = require( '@stdlib/stats/base/dists/rayleigh/ctor' );
    276 
    277 var rayleigh = new Rayleigh( 2.0, 4.0 );
    278 
    279 var mu = rayleigh.mean;
    280 // returns ~2.507
    281 
    282 var mode = rayleigh.mode;
    283 // returns 2.0
    284 
    285 var s2 = rayleigh.variance;
    286 // returns ~1.717
    287 
    288 var y = rayleigh.cdf( 0.8 );
    289 // returns ~0.077
    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 [rayleigh-distribution]: https://en.wikipedia.org/wiki/Rayleigh_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 -->