README.md (3708B)
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 # Mode 22 23 > [Cauchy][cauchy-distribution] distribution [mode][mode]. 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 [mode][mode] for a [Cauchy][cauchy-distribution] random variable with location parameter `x0` and scale parameter `Ɣ > 0` is 30 31 <!-- <equation class="equation" label="eq:cauchy_mode" align="center" raw="\operatorname{mode}\left( X \right) = x_0" alt="Mode for a Cauchy distribution."> --> 32 33 <div class="equation" align="center" data-raw-text="\operatorname{mode}\left( X \right) = x_0" data-equation="eq:cauchy_mode"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/cauchy/mode/docs/img/equation_cauchy_mode.svg" alt="Mode for a Cauchy distribution."> 35 <br> 36 </div> 37 38 <!-- </equation> --> 39 40 </section> 41 42 <!-- /.intro --> 43 44 <!-- Package usage documentation. --> 45 46 <section class="usage"> 47 48 ## Usage 49 50 ```javascript 51 var mode = require( '@stdlib/stats/base/dists/cauchy/mode' ); 52 ``` 53 54 #### mode( x0, gamma ) 55 56 Returns the [mode][mode] of a [Cauchy][cauchy-distribution] distribution with location parameter `x0` and scale parameter `gamma`. 57 58 ```javascript 59 var v = mode( 10.0, 5.0 ); 60 // returns 10.0 61 62 v = mode( 7.0, 2.0 ); 63 // returns 7.0 64 ``` 65 66 If provided `NaN` as any argument, the function returns `NaN`. 67 68 ```javascript 69 var v = mode( NaN, 5.0 ); 70 // returns NaN 71 72 v = mode( 20.0, NaN ); 73 // returns NaN 74 ``` 75 76 If provided `gamma <= 0`, the function returns `NaN`. 77 78 ```javascript 79 var v = mode( 1.0, -1.0 ); 80 // returns NaN 81 82 v = mode( 1.0, 0.0 ); 83 // returns NaN 84 ``` 85 86 </section> 87 88 <!-- /.usage --> 89 90 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 91 92 <section class="notes"> 93 94 </section> 95 96 <!-- /.notes --> 97 98 <!-- Package usage examples. --> 99 100 <section class="examples"> 101 102 ## Examples 103 104 <!-- eslint no-undef: "error" --> 105 106 ```javascript 107 var randu = require( '@stdlib/random/base/randu' ); 108 var EPS = require( '@stdlib/constants/float64/eps' ); 109 var mode = require( '@stdlib/stats/base/dists/cauchy/mode' ); 110 111 var gamma; 112 var x0; 113 var v; 114 var i; 115 116 for ( i = 0; i < 10; i++ ) { 117 x0 = randu() * 100.0; 118 gamma = ( randu()*10.0 ) + EPS; 119 v = mode( x0, gamma ); 120 console.log( 'x0: %d, γ: %d, mode(X;x0,γ): %d', x0.toFixed( 4 ), gamma.toFixed( 4 ), v.toFixed( 4 ) ); 121 } 122 ``` 123 124 </section> 125 126 <!-- /.examples --> 127 128 <!-- 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. --> 129 130 <section class="references"> 131 132 </section> 133 134 <!-- /.references --> 135 136 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 137 138 <section class="links"> 139 140 [cauchy-distribution]: https://en.wikipedia.org/wiki/Cauchy_distribution 141 142 [mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29 143 144 </section> 145 146 <!-- /.links -->