time-to-botec

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

README.md (3660B)


      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 # Mode
     22 
     23 > [Gumbel][gumbel-distribution] distribution [mode][mode].
     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 The [mode][mode] for a [Gumbel][gumbel-distribution] random variable with location `μ` and scale `β` is
     30 
     31 <!-- <equation class="equation" label="eq:gumbel_mode" align="center" raw="\operatorname{mode}\left( X \right) = \mu" alt="Mode for a Gumbel distribution."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="\operatorname{mode}\left( X \right) = \mu" data-equation="eq:gumbel_mode">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/gumbel/mode/docs/img/equation_gumbel_mode.svg" alt="Mode for a Gumbel distribution.">
     35     <br>
     36 </div>
     37 
     38 <!-- </equation> -->
     39 
     40 </section>
     41 
     42 <!-- /.intro -->
     43 
     44 <!-- Package usage documentation. -->
     45 
     46 <section class="usage">
     47 
     48 ## Usage
     49 
     50 ```javascript
     51 var mode = require( '@stdlib/stats/base/dists/gumbel/mode' );
     52 ```
     53 
     54 #### mode( mu, beta )
     55 
     56 Returns the [mode][mode] for a [Gumbel][gumbel-distribution] distribution with location parameter `mu` and scale parameter `beta`.
     57 
     58 ```javascript
     59 var y = mode( 2.0, 1.0 );
     60 // returns 2.0
     61 
     62 y = mode( 0.0, 1.0 );
     63 // returns 0.0
     64 
     65 y = mode( -1.0, 4.0 );
     66 // returns -1.0
     67 ```
     68 
     69 If provided `NaN` as any argument, the function returns `NaN`.
     70 
     71 ```javascript
     72 var y = mode( NaN, 1.0 );
     73 // returns NaN
     74 
     75 y = mode( 0.0, NaN );
     76 // returns NaN
     77 ```
     78 
     79 If provided `beta <= 0`, the function returns `NaN`.
     80 
     81 ```javascript
     82 var y = mode( 0.0, 0.0 );
     83 // returns NaN
     84 
     85 y = mode( 0.0, -1.0 );
     86 // returns NaN
     87 ```
     88 
     89 </section>
     90 
     91 <!-- /.usage -->
     92 
     93 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     94 
     95 <section class="notes">
     96 
     97 </section>
     98 
     99 <!-- /.notes -->
    100 
    101 <!-- Package usage examples. -->
    102 
    103 <section class="examples">
    104 
    105 ## Examples
    106 
    107 <!-- eslint no-undef: "error" -->
    108 
    109 ```javascript
    110 var randu = require( '@stdlib/random/base/randu' );
    111 var mode = require( '@stdlib/stats/base/dists/gumbel/mode' );
    112 
    113 var beta;
    114 var mu;
    115 var y;
    116 var i;
    117 
    118 for ( i = 0; i < 10; i++ ) {
    119     mu = ( randu()*10.0 ) - 5.0;
    120     beta = randu() * 20.0;
    121     y = mode( mu, beta );
    122     console.log( 'µ: %d, β: %d, mode(X;µ,β): %d', mu.toFixed( 4 ), beta.toFixed( 4 ), y.toFixed( 4 ) );
    123 }
    124 ```
    125 
    126 </section>
    127 
    128 <!-- /.examples -->
    129 
    130 <!-- 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. -->
    131 
    132 <section class="references">
    133 
    134 </section>
    135 
    136 <!-- /.references -->
    137 
    138 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    139 
    140 <section class="links">
    141 
    142 [gumbel-distribution]: https://en.wikipedia.org/wiki/Gumbel_distribution
    143 
    144 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29
    145 
    146 </section>
    147 
    148 <!-- /.links -->