README.md (6864B)
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 # Logistic 22 23 > Logistic 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 Logistic = require( '@stdlib/stats/base/dists/logistic/ctor' ); 41 ``` 42 43 #### Logistic( \[mu, s] ) 44 45 Returns a [logistic][logistic-distribution] distribution object. 46 47 ```javascript 48 var logistic = new Logistic(); 49 50 var mu = logistic.mean; 51 // returns 0.0 52 ``` 53 54 By default, `mu = 0.0` and `s = 1.0`. To create a distribution having a different `mu` (location parameter) and `s` (scale parameter), provide the corresponding arguments. 55 56 ```javascript 57 var logistic = new Logistic( 2.0, 4.0 ); 58 59 var mu = logistic.mean; 60 // returns 2.0 61 ``` 62 63 * * * 64 65 ## logistic 66 67 A [logistic][logistic-distribution] distribution object has the following properties and methods... 68 69 ### Writable Properties 70 71 #### logistic.mu 72 73 Location parameter of the distribution. 74 75 ```javascript 76 var logistic = new Logistic(); 77 78 var mu = logistic.mu; 79 // returns 0.0 80 81 logistic.mu = 3.0; 82 83 mu = logistic.mu; 84 // returns 3.0 85 ``` 86 87 #### logistic.s 88 89 Scale parameter of the distribution. `s` **must** be a positive number. 90 91 ```javascript 92 var logistic = new Logistic( 2.0, 4.0 ); 93 94 var s = logistic.s; 95 // returns 4.0 96 97 logistic.s = 3.0; 98 99 s = logistic.s; 100 // returns 3.0 101 ``` 102 103 * * * 104 105 ### Computed Properties 106 107 #### Logistic.prototype.entropy 108 109 Returns the [differential entropy][entropy]. 110 111 ```javascript 112 var logistic = new Logistic( 4.0, 12.0 ); 113 114 var entropy = logistic.entropy; 115 // returns ~4.485 116 ``` 117 118 #### Logistic.prototype.kurtosis 119 120 Returns the [excess kurtosis][kurtosis]. 121 122 ```javascript 123 var logistic = new Logistic( 4.0, 12.0 ); 124 125 var kurtosis = logistic.kurtosis; 126 // returns 1.2 127 ``` 128 129 #### Logistic.prototype.mean 130 131 Returns the [expected value][expected-value]. 132 133 ```javascript 134 var logistic = new Logistic( 4.0, 12.0 ); 135 136 var mu = logistic.mean; 137 // returns 4.0 138 ``` 139 140 #### Logistic.prototype.median 141 142 Returns the [median][median]. 143 144 ```javascript 145 var logistic = new Logistic( 4.0, 12.0 ); 146 147 var median = logistic.median; 148 // returns 4.0 149 ``` 150 151 #### Logistic.prototype.mode 152 153 Returns the [mode][mode]. 154 155 ```javascript 156 var logistic = new Logistic( 4.0, 12.0 ); 157 158 var mode = logistic.mode; 159 // returns 4.0 160 ``` 161 162 #### Logistic.prototype.skewness 163 164 Returns the [skewness][skewness]. 165 166 ```javascript 167 var logistic = new Logistic( 4.0, 12.0 ); 168 169 var skewness = logistic.skewness; 170 // returns 0.0 171 ``` 172 173 #### Logistic.prototype.stdev 174 175 Returns the [standard deviation][standard-deviation]. 176 177 ```javascript 178 var logistic = new Logistic( 4.0, 12.0 ); 179 180 var s = logistic.stdev; 181 // returns ~21.766 182 ``` 183 184 #### Logistic.prototype.variance 185 186 Returns the [variance][variance]. 187 188 ```javascript 189 var logistic = new Logistic( 4.0, 12.0 ); 190 191 var s2 = logistic.variance; 192 // returns ~473.741 193 ``` 194 195 * * * 196 197 ### Methods 198 199 #### Logistic.prototype.cdf( x ) 200 201 Evaluates the [cumulative distribution function][cdf] (CDF). 202 203 ```javascript 204 var logistic = new Logistic( 2.0, 4.0 ); 205 206 var y = logistic.cdf( 0.5 ); 207 // returns ~0.407 208 ``` 209 210 #### Logistic.prototype.logcdf( x ) 211 212 Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF). 213 214 ```javascript 215 var logistic = new Logistic( 2.0, 4.0 ); 216 217 var y = logistic.logcdf( 2.0 ); 218 // returns ~-0.693 219 ``` 220 221 #### Logistic.prototype.logpdf( x ) 222 223 Evaluates the natural logarithm of the [probability density function][pdf] (PDF). 224 225 ```javascript 226 var logistic = new Logistic( 2.0, 4.0 ); 227 228 var y = logistic.logpdf( 0.8 ); 229 // returns ~-2.795 230 ``` 231 232 #### Logistic.prototype.mgf( t ) 233 234 Evaluates the [moment-generating function][mgf] (MGF). 235 236 ```javascript 237 var logistic = new Logistic( 2.0, 4.0 ); 238 239 var y = logistic.mgf( 0.2 ); 240 // returns ~6.379 241 ``` 242 243 #### Logistic.prototype.pdf( x ) 244 245 Evaluates the [probability density function][pdf] (PDF). 246 247 ```javascript 248 var logistic = new Logistic( 2.0, 4.0 ); 249 250 var y = logistic.pdf( 2.0 ); 251 // returns 0.0625 252 ``` 253 254 #### Logistic.prototype.quantile( p ) 255 256 Evaluates the [quantile function][quantile-function] at probability `p`. 257 258 ```javascript 259 var logistic = new Logistic( 2.0, 4.0 ); 260 261 var y = logistic.quantile( 0.5 ); 262 // returns 2.0 263 264 y = logistic.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 Logistic = require( '@stdlib/stats/base/dists/logistic/ctor' ); 292 293 var logistic = new Logistic( 2.0, 4.0 ); 294 295 var mean = logistic.mean; 296 // returns 2.0 297 298 var median = logistic.median; 299 // returns 2.0 300 301 var s2 = logistic.variance; 302 // returns ~52.638 303 304 var y = logistic.cdf( 0.8 ); 305 // returns ~0.426 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 [logistic-distribution]: https://en.wikipedia.org/wiki/Logistic_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 -->