time-to-botec

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

README.md (5708B)


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