time-to-botec

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

README.md (4933B)


      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 # Variance
     22 
     23 > [Kumaraswamy's double bounded][kumaraswamy-distribution] distribution [variance][variance].
     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 [variance][variance] for a [Kumaraswamy's double bounded][kumaraswamy-distribution] random variable with first shape parameter `a` and second shape parameter `b` is
     30 
     31 <!-- <equation class="equation" label="eq:kumaraswamy_variance" align="center" raw="\operatorname{Var}\left( X \right) = m_2 - m_1^2" alt="Variance for a Kumaraswamy's double bounded distribution."> -->
     32 
     33 <div class="equation" align="center" data-raw-text="\operatorname{Var}\left( X \right) = m_2 - m_1^2" data-equation="eq:kumaraswamy_variance">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/variance/docs/img/equation_kumaraswamy_variance.svg" alt="Variance for a Kumaraswamy's double bounded distribution.">
     35     <br>
     36 </div>
     37 
     38 <!-- </equation> -->
     39 
     40 where the raw moments of the distribution are given by
     41 
     42 <!-- <equation class="equation" label="eq:kumaraswamy_raw_moments" align="center" raw="m_n = b \, B\left(1+\tfrac{n}{a}, b \right)" alt="Raw moments for a Kumaraswamy's double bounded distribution."> -->
     43 
     44 <div class="equation" align="center" data-raw-text="m_n = b \, B\left(1+\tfrac{n}{a}, b \right)" data-equation="eq:kumaraswamy_raw_moments">
     45     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@591cf9d5c3a0cd3c1ceec961e5c49d73a68374cb/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/variance/docs/img/equation_kumaraswamy_raw_moments.svg" alt="Raw moments for a Kumaraswamy's double bounded distribution.">
     46     <br>
     47 </div>
     48 
     49 <!-- </equation> -->
     50 
     51 with `B` denoting the [beta function][beta-function].
     52 
     53 </section>
     54 
     55 <!-- /.intro -->
     56 
     57 <!-- Package usage documentation. -->
     58 
     59 <section class="usage">
     60 
     61 ## Usage
     62 
     63 ```javascript
     64 var variance = require( '@stdlib/stats/base/dists/kumaraswamy/variance' );
     65 ```
     66 
     67 #### variance( a, b )
     68 
     69 Returns the [variance][variance] of a [Kumaraswamy's double bounded][kumaraswamy-distribution] distribution with first shape parameter `a` and second shape parameter `b`.
     70 
     71 ```javascript
     72 var v = variance( 1.0, 1.0 );
     73 // returns ~0.083
     74 
     75 v = variance( 4.0, 12.0 );
     76 // returns ~0.017
     77 
     78 v = variance( 2.0, 8.0 );
     79 // returns ~0.021
     80 ```
     81 
     82 If provided `NaN` as any argument, the function returns `NaN`.
     83 
     84 ```javascript
     85 var v = variance( NaN, 2.0 );
     86 // returns NaN
     87 
     88 v = variance( 2.0, NaN );
     89 // returns NaN
     90 ```
     91 
     92 If provided `a <= 0`, the function returns `NaN`.
     93 
     94 ```javascript
     95 var y = variance( -1.0, 0.5 );
     96 // returns NaN
     97 
     98 y = variance( 0.0, 0.5 );
     99 // returns NaN
    100 ```
    101 
    102 If provided `b <= 0`, the function returns `NaN`.
    103 
    104 ```javascript
    105 var y = variance( 0.5, -1.0 );
    106 // returns NaN
    107 
    108 y = variance( 0.5, 0.0 );
    109 // returns NaN
    110 ```
    111 
    112 </section>
    113 
    114 <!-- /.usage -->
    115 
    116 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    117 
    118 <section class="notes">
    119 
    120 </section>
    121 
    122 <!-- /.notes -->
    123 
    124 <!-- Package usage examples. -->
    125 
    126 <section class="examples">
    127 
    128 ## Examples
    129 
    130 <!-- eslint no-undef: "error" -->
    131 
    132 ```javascript
    133 var randu = require( '@stdlib/random/base/randu' );
    134 var variance = require( '@stdlib/stats/base/dists/kumaraswamy/variance' );
    135 
    136 var a;
    137 var b;
    138 var v;
    139 var i;
    140 
    141 for ( i = 0; i < 10; i++ ) {
    142     a = randu() * 10.0;
    143     b = randu() * 10.0;
    144     v = variance( a, b );
    145     console.log( 'a: %d, b: %d, Var(X;a,b): %d', a.toFixed( 4 ), b.toFixed( 4 ), v.toFixed( 4 ) );
    146 }
    147 ```
    148 
    149 </section>
    150 
    151 <!-- /.examples -->
    152 
    153 <!-- 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. -->
    154 
    155 <section class="references">
    156 
    157 </section>
    158 
    159 <!-- /.references -->
    160 
    161 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    162 
    163 <section class="links">
    164 
    165 [beta-function]: https://en.wikipedia.org/wiki/Beta_function
    166 
    167 [kumaraswamy-distribution]: https://en.wikipedia.org/wiki/Kumaraswamy_distribution
    168 
    169 [variance]: https://en.wikipedia.org/wiki/Variance
    170 
    171 </section>
    172 
    173 <!-- /.links -->