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