time-to-botec

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

README.md (2726B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2020 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 # Median
     22 
     23 > [Chi-squared][chisquare-distribution] distribution [median][median].
     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 median = require( '@stdlib/stats/base/dists/chisquare/median' );
     41 ```
     42 
     43 #### median( k )
     44 
     45 Returns the [median][median] of a [chi-squared][chisquare-distribution] distribution with degrees of freedom `k`.
     46 
     47 ```javascript
     48 var v = median( 9.0 );
     49 // returns ~8.343
     50 
     51 v = median( 2.0 );
     52 // returns ~1.386
     53 ```
     54 
     55 If provided `k < 0`, the function returns `NaN`.
     56 
     57 ```javascript
     58 var y = median( -1.0 );
     59 // returns NaN
     60 ```
     61 
     62 </section>
     63 
     64 <!-- /.usage -->
     65 
     66 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     67 
     68 <section class="notes">
     69 
     70 </section>
     71 
     72 <!-- /.notes -->
     73 
     74 <!-- Package usage examples. -->
     75 
     76 <section class="examples">
     77 
     78 ## Examples
     79 
     80 <!-- eslint no-undef: "error" -->
     81 
     82 ```javascript
     83 var randu = require( '@stdlib/random/base/randu' );
     84 var round = require( '@stdlib/math/base/special/round' );
     85 var median = require( '@stdlib/stats/base/dists/chisquare/median' );
     86 
     87 var k;
     88 var y;
     89 var i;
     90 
     91 for ( i = 0; i < 10; i++ ) {
     92     k = randu() * 20.0;
     93     y = median( k );
     94     console.log( 'k: %d, Median(X,k): %d', k.toFixed( 4 ), y.toFixed( 4 ) );
     95 }
     96 ```
     97 
     98 </section>
     99 
    100 <!-- /.examples -->
    101 
    102 <!-- 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. -->
    103 
    104 <section class="references">
    105 
    106 </section>
    107 
    108 <!-- /.references -->
    109 
    110 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    111 
    112 <section class="links">
    113 
    114 [chisquare-distribution]: https://en.wikipedia.org/wiki/Chi-squared_distribution
    115 
    116 [median]: https://en.wikipedia.org/wiki/Median
    117 
    118 </section>
    119 
    120 <!-- /.links -->