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