time-to-botec

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

README.md (2851B)


      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 # Standard Deviation
     22 
     23 > [Normal][normal-distribution] distribution [standard deviation][standard-deviation].
     24 
     25 <!-- Package usage documentation. -->
     26 
     27 <section class="usage">
     28 
     29 ## Usage
     30 
     31 ```javascript
     32 var stdev = require( '@stdlib/stats/base/dists/normal/stdev' );
     33 ```
     34 
     35 #### stdev( mu, sigma )
     36 
     37 Returns the [standard deviation][standard-deviation] for a [normal][normal-distribution] distribution with parameters `mu` (mean) and `sigma` (standard deviation).
     38 
     39 ```javascript
     40 var y = stdev( 2.0, 1.0 );
     41 // returns 1.0
     42 
     43 y = stdev( -1.0, 4.0 );
     44 // returns 4.0
     45 ```
     46 
     47 If provided `NaN` as any argument, the function returns `NaN`.
     48 
     49 ```javascript
     50 var y = stdev( NaN, 1.0 );
     51 // returns NaN
     52 
     53 y = stdev( 0.0, NaN );
     54 // returns NaN
     55 ```
     56 
     57 If provided `sigma <= 0`, the function returns `NaN`.
     58 
     59 ```javascript
     60 var y = stdev( 0.0, 0.0 );
     61 // returns NaN
     62 
     63 y = stdev( 0.0, -1.0 );
     64 // returns NaN
     65 ```
     66 
     67 </section>
     68 
     69 <!-- /.usage -->
     70 
     71 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     72 
     73 <section class="notes">
     74 
     75 </section>
     76 
     77 <!-- /.notes -->
     78 
     79 <!-- Package usage examples. -->
     80 
     81 <section class="examples">
     82 
     83 ## Examples
     84 
     85 <!-- eslint no-undef: "error" -->
     86 
     87 ```javascript
     88 var randu = require( '@stdlib/random/base/randu' );
     89 var stdev = require( '@stdlib/stats/base/dists/normal/stdev' );
     90 
     91 var sigma;
     92 var mu;
     93 var y;
     94 var i;
     95 
     96 for ( i = 0; i < 10; i++ ) {
     97     mu = ( randu()*10.0 ) - 5.0;
     98     sigma = randu() * 20.0;
     99     y = stdev( mu, sigma );
    100     console.log( 'µ: %d, σ: %d, Var(X;µ,σ): %d', mu.toFixed( 4 ), sigma.toFixed( 4 ), y.toFixed( 4 ) );
    101 }
    102 ```
    103 
    104 </section>
    105 
    106 <!-- /.examples -->
    107 
    108 <!-- 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. -->
    109 
    110 <section class="references">
    111 
    112 </section>
    113 
    114 <!-- /.references -->
    115 
    116 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    117 
    118 <section class="links">
    119 
    120 [normal-distribution]: https://en.wikipedia.org/wiki/Normal_distribution
    121 
    122 [standard-deviation]: https://en.wikipedia.org/wiki/Standard_deviation
    123 
    124 </section>
    125 
    126 <!-- /.links -->