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