time-to-botec

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

README.md (3061B)


      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 # Quantile Function
     22 
     23 > [Degenerate distribution][degenerate-distribution] [quantile function][quantile-function].
     24 
     25 <section class="intro">
     26 
     27 The [quantile function][quantile-function] for a [degenerate][degenerate-distribution] random variable is
     28 
     29 <!-- <equation class="equation" label="eq:degenerate_quantile_function" align="center" raw="Q(p;\mu) = \inf \left\{x \in {\mathbb {R}}:p \leq F(x;\mu)\right\} = \mu" alt="Quantile function for a degenerate distribution."> -->
     30 
     31 <div class="equation" align="center" data-raw-text="Q(p;\mu) = \inf \left\{x \in {\mathbb {R}}:p \leq F(x;\mu)\right\} = \mu" data-equation="eq:degenerate_quantile_function">
     32     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@e1fbdee688c5409e4cc6b0cd06d90b1cd2abd67c/lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile/docs/img/equation_degenerate_quantile_function.svg" alt="Quantile function for a degenerate distribution.">
     33     <br>
     34 </div>
     35 
     36 <!-- </equation> -->
     37 
     38 for `0 <= p <= 1` and where `µ` is the constant value of the distribution.
     39 
     40 </section>
     41 
     42 <!-- /.intro -->
     43 
     44 <section class="usage">
     45 
     46 ## Usage
     47 
     48 ```javascript
     49 var quantile = require( '@stdlib/stats/base/dists/degenerate/quantile' );
     50 ```
     51 
     52 #### quantile( p, mu )
     53 
     54 Evaluates the [quantile function][quantile-function] of a [degenerate distribution][degenerate-distribution] centered at `mu`.
     55 
     56 ```javascript
     57 var y = quantile( 0.3, 8.0 );
     58 // returns 8.0
     59 
     60 y = quantile( 0.9, 8.0 );
     61 // returns 8.0
     62 ```
     63 
     64 #### quantile.factory( mu )
     65 
     66 Returns a function for evaluating the [quantile function][quantile-function] of a [degenerate distribution][degenerate-distribution] centered at `mu`.
     67 
     68 ```javascript
     69 var myquantile = quantile.factory( 10.0 );
     70 
     71 var y = myquantile( 0.2 );
     72 // returns 10.0
     73 
     74 y = myquantile( 1.1 );
     75 // returns NaN
     76 ```
     77 
     78 </section>
     79 
     80 <!-- /.usage -->
     81 
     82 <section class="examples">
     83 
     84 ## Examples
     85 
     86 <!-- eslint no-undef: "error" -->
     87 
     88 ```javascript
     89 var randu = require( '@stdlib/random/base/randu' );
     90 var quantile = require( '@stdlib/stats/base/dists/degenerate/quantile' );
     91 
     92 var mu;
     93 var p;
     94 var y;
     95 var i;
     96 
     97 for ( i = 0; i < 10; i++ ) {
     98     p = randu();
     99     mu = ( randu()*10.0 ) - 5.0;
    100     y = quantile( p, mu );
    101     console.log( 'p: %d, µ: %d, Q(p;µ): %d', p, mu, y );
    102 }
    103 ```
    104 
    105 </section>
    106 
    107 <!-- /.examples -->
    108 
    109 <section class="links">
    110 
    111 [quantile-function]: https://en.wikipedia.org/wiki/Quantile_function
    112 
    113 [degenerate-distribution]: https://en.wikipedia.org/wiki/Degenerate_distribution
    114 
    115 </section>
    116 
    117 <!-- /.links -->