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