time-to-botec

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

README.md (6621B)


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