README.md (5177B)
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 # Skewness 22 23 > [Fréchet][frechet-distribution] distribution [skewness][skewness]. 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 The [skewness][skewness] for a [Fréchet][frechet-distribution] random variable shape `α > 0`, scale `s > 0`, and location parameter `m` is 30 31 <!-- <equation class="equation" label="eq:frechet_skewness" align="center" raw="\operatorname{skew} = \begin{cases} {\frac{\Gamma \left(1-{\frac{3}{\alpha }}\right)-3\Gamma \left(1-{\frac{2}{\alpha }}\right)\Gamma \left(1-{\frac{1}{\alpha }}\right)+2\Gamma^{3}\left(1-{\frac{1}{\alpha }}\right)}{{\sqrt{\left(\Gamma \left(1-{\frac{2}{\alpha }}\right)-\Gamma^{2}\left(1-{\frac{1}{\alpha }}\right)\right)^{3}}}}} & \text{ for }\alpha > 3\\\ \infty & \text{ otherwise }\end{cases}" alt="Skewness for a Fréchet distribution."> --> 32 33 <div class="equation" align="center" data-raw-text="\operatorname{skew} = \begin{cases} {\frac{\Gamma \left(1-{\frac{3}{\alpha }}\right)-3\Gamma \left(1-{\frac{2}{\alpha }}\right)\Gamma \left(1-{\frac{1}{\alpha }}\right)+2\Gamma^{3}\left(1-{\frac{1}{\alpha }}\right)}{{\sqrt{\left(\Gamma \left(1-{\frac{2}{\alpha }}\right)-\Gamma^{2}\left(1-{\frac{1}{\alpha }}\right)\right)^{3}}}}} & \text{ for }\alpha > 3\\\ \infty & \text{ otherwise }\end{cases}" data-equation="eq:frechet_skewness"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@591cf9d5c3a0cd3c1ceec961e5c49d73a68374cb/lib/node_modules/@stdlib/stats/base/dists/frechet/skewness/docs/img/equation_frechet_skewness.svg" alt="Skewness for a Fréchet distribution."> 35 <br> 36 </div> 37 38 <!-- </equation> --> 39 40 where `Γ` is the [gamma function][gamma-function]. 41 42 </section> 43 44 <!-- /.intro --> 45 46 <!-- Package usage documentation. --> 47 48 <section class="usage"> 49 50 ## Usage 51 52 ```javascript 53 var skewness = require( '@stdlib/stats/base/dists/frechet/skewness' ); 54 ``` 55 56 #### skewness( alpha, s, m ) 57 58 Returns the [skewness][skewness] for a [Fréchet][frechet-distribution] distribution with shape `alpha > 0`, scale `s > 0`, and location parameter `m`. 59 60 ```javascript 61 var y = skewness( 4.0, 1.0, 1.0 ); 62 // returns ~5.605 63 64 y = skewness( 4.0, 8.0, -3.0 ); 65 // returns ~5.605 66 67 y = skewness( 5.0, 1.0, 2.0 ); 68 // returns ~3.535 69 ``` 70 71 If `0 < alpha <= 3`, the function returns `+Infinity`. 72 73 ```javascript 74 var y = skewness( 2.5, 1.0, 1.0 ); 75 // returns Infinity 76 ``` 77 78 If provided `NaN` as any argument, the function returns `NaN`. 79 80 ```javascript 81 var y = skewness( NaN, 1.0, -2.0 ); 82 // returns NaN 83 84 y = skewness( 1.0, NaN, -2.0 ); 85 // returns NaN 86 87 y = skewness( 1.0, 1.0, NaN ); 88 // returns NaN 89 ``` 90 91 If provided `alpha <= 0`, the function returns `NaN`. 92 93 ```javascript 94 var y = skewness( 0.0, 3.0, 2.0 ); 95 // returns NaN 96 97 y = skewness( -1.0, 3.0, 2.0 ); 98 // returns NaN 99 ``` 100 101 If provided `s <= 0`, the function returns `NaN`. 102 103 ```javascript 104 var y = skewness( 1.0, 0.0, 2.0 ); 105 // returns NaN 106 107 y = skewness( 1.0, -1.0, 2.0 ); 108 // returns NaN 109 ``` 110 111 </section> 112 113 <!-- /.usage --> 114 115 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 116 117 <section class="notes"> 118 119 </section> 120 121 <!-- /.notes --> 122 123 <!-- Package usage examples. --> 124 125 <section class="examples"> 126 127 ## Examples 128 129 <!-- eslint no-undef: "error" --> 130 131 ```javascript 132 var randu = require( '@stdlib/random/base/randu' ); 133 var EPS = require( '@stdlib/constants/float64/eps' ); 134 var skewness = require( '@stdlib/stats/base/dists/frechet/skewness' ); 135 136 var alpha; 137 var m; 138 var s; 139 var y; 140 var i; 141 142 for ( i = 0; i < 10; i++ ) { 143 alpha = ( randu()*20.0 ) + EPS; 144 s = ( randu()*20.0 ) + EPS; 145 m = ( randu()*20.0 ) - 40.0; 146 y = skewness( alpha, s, m ); 147 console.log( 'α: %d, s: %d, m: %d, skew(X;α,s,m): %d', alpha.toFixed( 4 ), s.toFixed( 4 ), m.toFixed( 4 ), y.toFixed( 4 ) ); 148 } 149 ``` 150 151 </section> 152 153 <!-- /.examples --> 154 155 <!-- 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. --> 156 157 <section class="references"> 158 159 </section> 160 161 <!-- /.references --> 162 163 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 164 165 <section class="links"> 166 167 [frechet-distribution]: https://en.wikipedia.org/wiki/Fr%C3%A9chet_distribution 168 169 [gamma-function]: https://en.wikipedia.org/wiki/Gamma_function 170 171 [skewness]: https://en.wikipedia.org/wiki/Skewness 172 173 </section> 174 175 <!-- /.links -->