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