time-to-botec

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

README.md (4039B)


      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 # Skewness
     22 
     23 > [Discrete uniform][discrete-uniform-distribution] distribution [skewness][skewness].
     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 [skewness][skewness] for a [discrete uniform][discrete-uniform-distribution] random variable with minimum support `a` and maximum support `b` is
     30 
     31 <!-- <equation class="equation" label="eq:discrete_uniform_skewness" align="center" raw="\operatorname{skew}\left( X \right) = 0" alt="Skewness for a discrete uniform distribution."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="\operatorname{skew}\left( X \right) = 0" data-equation="eq:discrete_uniform_skewness">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@591cf9d5c3a0cd3c1ceec961e5c49d73a68374cb/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/skewness/docs/img/equation_discrete_uniform_skewness.svg" alt="Skewness for a discrete uniform 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 skewness = require( '@stdlib/stats/base/dists/discrete-uniform/skewness' );
     52 ```
     53 
     54 #### skewness( a, b )
     55 
     56 Returns the [skewness][skewness] of a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).
     57 
     58 ```javascript
     59 var v = skewness( 0, 1 );
     60 // returns 0.0
     61 
     62 v = skewness( 4, 12 );
     63 // returns 0.0
     64 
     65 v = skewness( 2, 8 );
     66 // returns 0.0
     67 ```
     68 
     69 If `a` or `b` is not an integer value, the function returns `NaN`.
     70 
     71 ```javascript
     72 var v = skewness( 0.1, 2 );
     73 // returns NaN
     74 
     75 v = skewness( 0, 2.2 );
     76 // returns NaN
     77 
     78 v = skewness( NaN, 2 );
     79 // returns NaN
     80 
     81 v = skewness( 2, NaN );
     82 // returns NaN
     83 ```
     84 
     85 If provided `a > b`, the function returns `NaN`.
     86 
     87 ```javascript
     88 var y = skewness( 3, 2 );
     89 // returns NaN
     90 
     91 y = skewness( -1, -2 );
     92 // returns NaN
     93 ```
     94 
     95 </section>
     96 
     97 <!-- /.usage -->
     98 
     99 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    100 
    101 <section class="notes">
    102 
    103 </section>
    104 
    105 <!-- /.notes -->
    106 
    107 <!-- Package usage examples. -->
    108 
    109 <section class="examples">
    110 
    111 ## Examples
    112 
    113 <!-- eslint no-undef: "error" -->
    114 
    115 ```javascript
    116 var randint = require( '@stdlib/random/base/discrete-uniform' );
    117 var skewness = require( '@stdlib/stats/base/dists/discrete-uniform/skewness' );
    118 
    119 var randa = randint.factory( 0, 10 );
    120 var randb = randint.factory();
    121 var a;
    122 var b;
    123 var v;
    124 var i;
    125 
    126 for ( i = 0; i < 10; i++ ) {
    127     a = randa();
    128     b = randb( a, a+randa() );
    129     v = skewness( a, b );
    130     console.log( 'a: %d, b: %d, skew(X;a,b): %d', a.toFixed( 4 ), b.toFixed( 4 ), v.toFixed( 4 ) );
    131 }
    132 ```
    133 
    134 </section>
    135 
    136 <!-- /.examples -->
    137 
    138 <!-- 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. -->
    139 
    140 <section class="references">
    141 
    142 </section>
    143 
    144 <!-- /.references -->
    145 
    146 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    147 
    148 <section class="links">
    149 
    150 [discrete-uniform-distribution]: https://en.wikipedia.org/wiki/Discrete_uniform_distribution
    151 
    152 [skewness]: https://en.wikipedia.org/wiki/Skewness
    153 
    154 </section>
    155 
    156 <!-- /.links -->