time-to-botec

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

README.md (6326B)


      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 # Beta Prime
     22 
     23 > Beta prime 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 BetaPrime = require( '@stdlib/stats/base/dists/betaprime/ctor' );
     41 ```
     42 
     43 #### BetaPrime( \[alpha, beta] )
     44 
     45 Returns a [beta prime][betaprime-distribution] distribution object.
     46 
     47 ```javascript
     48 var betaprime = new BetaPrime();
     49 
     50 var mode = betaprime.mode;
     51 // returns 0.0
     52 ```
     53 
     54 By default, `alpha = 1.0` and `beta = 1.0`. To create a distribution having a different `alpha` (first shape parameter) and `beta` (second shape parameter), provide the corresponding arguments.
     55 
     56 ```javascript
     57 var betaprime = new BetaPrime( 2.0, 4.0 );
     58 
     59 var mu = betaprime.mean;
     60 // returns ~0.667
     61 ```
     62 
     63 * * *
     64 
     65 ## betaprime
     66 
     67 A [beta prime][betaprime-distribution] distribution object has the following properties and methods...
     68 
     69 ### Writable Properties
     70 
     71 #### betaprime.alpha
     72 
     73 First shape parameter of the distribution. `alpha` **must** be a positive number.
     74 
     75 ```javascript
     76 var betaprime = new BetaPrime();
     77 
     78 var alpha = betaprime.alpha;
     79 // returns 1.0
     80 
     81 betaprime.alpha = 3.0;
     82 
     83 alpha = betaprime.alpha;
     84 // returns 3.0
     85 ```
     86 
     87 #### betaprime.beta
     88 
     89 Second shape parameter of the distribution. `beta` **must** be a positive number.
     90 
     91 ```javascript
     92 var betaprime = new BetaPrime( 2.0, 4.0 );
     93 
     94 var b = betaprime.beta;
     95 // returns 4.0
     96 
     97 betaprime.beta = 3.0;
     98 
     99 b = betaprime.beta;
    100 // returns 3.0
    101 ```
    102 
    103 * * *
    104 
    105 ### Computed Properties
    106 
    107 #### BetaPrime.prototype.kurtosis
    108 
    109 Returns the [excess kurtosis][kurtosis].
    110 
    111 ```javascript
    112 var betaprime = new BetaPrime( 4.0, 12.0 );
    113 
    114 var kurtosis = betaprime.kurtosis;
    115 // returns ~5.764
    116 ```
    117 
    118 #### BetaPrime.prototype.mean
    119 
    120 Returns the [expected value][expected-value].
    121 
    122 ```javascript
    123 var betaprime = new BetaPrime( 4.0, 12.0 );
    124 
    125 var mu = betaprime.mean;
    126 // returns ~0.364
    127 ```
    128 
    129 #### BetaPrime.prototype.mode
    130 
    131 Returns the [mode][mode].
    132 
    133 ```javascript
    134 var betaprime = new BetaPrime( 4.0, 12.0 );
    135 
    136 var mode = betaprime.mode;
    137 // returns ~0.231
    138 ```
    139 
    140 #### BetaPrime.prototype.skewness
    141 
    142 Returns the [skewness][skewness].
    143 
    144 ```javascript
    145 var betaprime = new BetaPrime( 4.0, 12.0 );
    146 
    147 var skewness = betaprime.skewness;
    148 // returns ~1.724
    149 ```
    150 
    151 #### BetaPrime.prototype.stdev
    152 
    153 Returns the [standard deviation][standard-deviation].
    154 
    155 ```javascript
    156 var betaprime = new BetaPrime( 4.0, 12.0 );
    157 
    158 var s = betaprime.stdev;
    159 // returns ~0.223
    160 ```
    161 
    162 #### BetaPrime.prototype.variance
    163 
    164 Returns the [variance][variance].
    165 
    166 ```javascript
    167 var betaprime = new BetaPrime( 4.0, 12.0 );
    168 
    169 var s2 = betaprime.variance;
    170 // returns ~0.05
    171 ```
    172 
    173 * * *
    174 
    175 ### Methods
    176 
    177 #### BetaPrime.prototype.cdf( x )
    178 
    179 Evaluates the [cumulative distribution function][cdf] (CDF).
    180 
    181 ```javascript
    182 var betaprime = new BetaPrime( 2.0, 4.0 );
    183 
    184 var y = betaprime.cdf( 0.5 );
    185 // returns ~0.539
    186 ```
    187 
    188 #### BetaPrime.prototype.logcdf( x )
    189 
    190 Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF).
    191 
    192 ```javascript
    193 var betaprime = new BetaPrime( 2.0, 4.0 );
    194 
    195 var y = betaprime.logcdf( 0.5 );
    196 // returns ~-0.618
    197 ```
    198 
    199 #### BetaPrime.prototype.logpdf( x )
    200 
    201 Evaluates the natural logarithm of the [probability density function][pdf] (PDF).
    202 
    203 ```javascript
    204 var betaprime = new BetaPrime( 2.0, 4.0 );
    205 
    206 var y = betaprime.logpdf( 0.8 );
    207 // returns ~-0.754
    208 ```
    209 
    210 #### BetaPrime.prototype.pdf( x )
    211 
    212 Evaluates the [probability density function][pdf] (PDF).
    213 
    214 ```javascript
    215 var betaprime = new BetaPrime( 2.0, 4.0 );
    216 
    217 var y = betaprime.pdf( 0.8 );
    218 // returns ~0.47
    219 ```
    220 
    221 #### BetaPrime.prototype.quantile( p )
    222 
    223 Evaluates the [quantile function][quantile-function] at probability `p`.
    224 
    225 ```javascript
    226 var betaprime = new BetaPrime( 2.0, 4.0 );
    227 
    228 var y = betaprime.quantile( 0.5 );
    229 // returns ~0.457
    230 
    231 y = betaprime.quantile( 1.9 );
    232 // returns NaN
    233 ```
    234 
    235 </section>
    236 
    237 <!-- /.usage -->
    238 
    239 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    240 
    241 <section class="notes">
    242 
    243 </section>
    244 
    245 <!-- /.notes -->
    246 
    247 <!-- Package usage examples. -->
    248 
    249 * * *
    250 
    251 <section class="examples">
    252 
    253 ## Examples
    254 
    255 <!-- eslint no-undef: "error" -->
    256 
    257 ```javascript
    258 var BetaPrime = require( '@stdlib/stats/base/dists/betaprime/ctor' );
    259 
    260 var betaprime = new BetaPrime( 2.0, 4.0 );
    261 
    262 var mu = betaprime.mean;
    263 // returns ~0.667
    264 
    265 var mode = betaprime.mode;
    266 // returns 0.2
    267 
    268 var s2 = betaprime.variance;
    269 // returns ~0.556
    270 
    271 var y = betaprime.cdf( 0.8 );
    272 // returns ~0.735
    273 ```
    274 
    275 </section>
    276 
    277 <!-- /.examples -->
    278 
    279 <!-- 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. -->
    280 
    281 <section class="references">
    282 
    283 </section>
    284 
    285 <!-- /.references -->
    286 
    287 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    288 
    289 <section class="links">
    290 
    291 [betaprime-distribution]: https://en.wikipedia.org/wiki/Beta_prime_distribution
    292 
    293 [cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
    294 
    295 [pdf]: https://en.wikipedia.org/wiki/Probability_density_function
    296 
    297 [quantile-function]: https://en.wikipedia.org/wiki/Quantile_function
    298 
    299 [expected-value]: https://en.wikipedia.org/wiki/Expected_value
    300 
    301 [kurtosis]: https://en.wikipedia.org/wiki/Kurtosis
    302 
    303 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29
    304 
    305 [skewness]: https://en.wikipedia.org/wiki/Skewness
    306 
    307 [standard-deviation]: https://en.wikipedia.org/wiki/Standard_deviation
    308 
    309 [variance]: https://en.wikipedia.org/wiki/Variance
    310 
    311 </section>
    312 
    313 <!-- /.links -->