time-to-botec

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

README.md (5307B)


      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 # Cauchy
     22 
     23 > Cauchy distribution constructor.
     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 Cauchy = require( '@stdlib/stats/base/dists/cauchy/ctor' );
     41 ```
     42 
     43 #### Cauchy( \[x0, gamma] )
     44 
     45 Returns a [Cauchy][cauchy-distribution] distribution object.
     46 
     47 ```javascript
     48 var cauchy = new Cauchy();
     49 
     50 var median = cauchy.median;
     51 // returns 0.0
     52 ```
     53 
     54 By default, `x0 = 0.0` and `gamma = 1.0`. To create a distribution having a different `x0` (location parameter) and `gamma` (scale parameter), provide the corresponding arguments.
     55 
     56 ```javascript
     57 var cauchy = new Cauchy( 2.0, 4.0 );
     58 
     59 var median = cauchy.median;
     60 // returns 2.0
     61 ```
     62 
     63 * * *
     64 
     65 ## cauchy
     66 
     67 A [Cauchy][cauchy-distribution] distribution object has the following properties and methods...
     68 
     69 ### Writable Properties
     70 
     71 #### cauchy.x0
     72 
     73 Location parameter of the distribution.
     74 
     75 ```javascript
     76 var cauchy = new Cauchy();
     77 
     78 var x0 = cauchy.x0;
     79 // returns 0.0
     80 
     81 cauchy.x0 = 3.0;
     82 
     83 x0 = cauchy.x0;
     84 // returns 3.0
     85 ```
     86 
     87 #### cauchy.gamma
     88 
     89 Scale parameter of the distribution. `gamma` **must** be a positive number.
     90 
     91 ```javascript
     92 var cauchy = new Cauchy( 2.0, 4.0 );
     93 
     94 var gamma = cauchy.gamma;
     95 // returns 4.0
     96 
     97 cauchy.gamma = 3.0;
     98 
     99 gamma = cauchy.gamma;
    100 // returns 3.0
    101 ```
    102 
    103 * * *
    104 
    105 ### Computed Properties
    106 
    107 #### Cauchy.prototype.entropy
    108 
    109 Returns the [differential entropy][entropy].
    110 
    111 ```javascript
    112 var cauchy = new Cauchy( 4.0, 12.0 );
    113 
    114 var entropy = cauchy.entropy;
    115 // returns ~5.016
    116 ```
    117 
    118 #### Cauchy.prototype.median
    119 
    120 Returns the [median][median].
    121 
    122 ```javascript
    123 var cauchy = new Cauchy( 4.0, 12.0 );
    124 
    125 var median = cauchy.median;
    126 // returns 4.0
    127 ```
    128 
    129 #### Cauchy.prototype.mode
    130 
    131 Returns the [mode][mode].
    132 
    133 ```javascript
    134 var cauchy = new Cauchy( 4.0, 12.0 );
    135 
    136 var mode = cauchy.mode;
    137 // returns 4.0
    138 ```
    139 
    140 * * *
    141 
    142 ### Methods
    143 
    144 #### Cauchy.prototype.cdf( x )
    145 
    146 Evaluates the [cumulative distribution function][cdf] (CDF).
    147 
    148 ```javascript
    149 var cauchy = new Cauchy( 2.0, 4.0 );
    150 
    151 var y = cauchy.cdf( 0.5 );
    152 // returns ~0.386
    153 ```
    154 
    155 #### Cauchy.prototype.logcdf( x )
    156 
    157 Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF).
    158 
    159 ```javascript
    160 var cauchy = new Cauchy( 2.0, 4.0 );
    161 
    162 var y = cauchy.logcdf( 0.5 );
    163 // returns ~-0.952
    164 ```
    165 
    166 #### Cauchy.prototype.logpdf( x )
    167 
    168 Evaluates the natural logarithm of the [probability density function][pdf] (PDF).
    169 
    170 ```javascript
    171 var cauchy = new Cauchy( 2.0, 4.0 );
    172 
    173 var y = cauchy.logpdf( 0.8 );
    174 // returns ~-2.617
    175 ```
    176 
    177 #### Cauchy.prototype.pdf( x )
    178 
    179 Evaluates the [probability density function][pdf] (PDF).
    180 
    181 ```javascript
    182 var cauchy = new Cauchy( 2.0, 4.0 );
    183 
    184 var y = cauchy.pdf( 0.8 );
    185 // returns ~0.073
    186 ```
    187 
    188 #### Cauchy.prototype.quantile( p )
    189 
    190 Evaluates the [quantile function][quantile-function] at probability `p`.
    191 
    192 ```javascript
    193 var cauchy = new Cauchy( 2.0, 4.0 );
    194 
    195 var y = cauchy.quantile( 0.5 );
    196 // returns 2.0
    197 
    198 y = cauchy.quantile( 1.9 );
    199 // returns NaN
    200 ```
    201 
    202 </section>
    203 
    204 <!-- /.usage -->
    205 
    206 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    207 
    208 <section class="notes">
    209 
    210 </section>
    211 
    212 <!-- /.notes -->
    213 
    214 <!-- Package usage examples. -->
    215 
    216 * * *
    217 
    218 <section class="examples">
    219 
    220 ## Examples
    221 
    222 <!-- eslint no-undef: "error" -->
    223 
    224 ```javascript
    225 var Cauchy = require( '@stdlib/stats/base/dists/cauchy/ctor' );
    226 
    227 var cauchy = new Cauchy( 2.0, 4.0 );
    228 
    229 var entropy = cauchy.entropy;
    230 // returns ~3.917
    231 
    232 var median = cauchy.median;
    233 // returns 2.0
    234 
    235 var mode = cauchy.mode;
    236 // returns 2.0
    237 
    238 var y = cauchy.cdf( 0.8 );
    239 // returns ~0.407
    240 ```
    241 
    242 </section>
    243 
    244 <!-- /.examples -->
    245 
    246 <!-- 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. -->
    247 
    248 <section class="references">
    249 
    250 </section>
    251 
    252 <!-- /.references -->
    253 
    254 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    255 
    256 <section class="links">
    257 
    258 [cauchy-distribution]: https://en.wikipedia.org/wiki/Cauchy_distribution
    259 
    260 [cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
    261 
    262 [pdf]: https://en.wikipedia.org/wiki/Probability_density_function
    263 
    264 [quantile-function]: https://en.wikipedia.org/wiki/Quantile_function
    265 
    266 [entropy]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
    267 
    268 [median]: https://en.wikipedia.org/wiki/Median
    269 
    270 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29
    271 
    272 </section>
    273 
    274 <!-- /.links -->