README.md (3346B)
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 # Median 22 23 > [Student's t][t-distribution] distribution [median][median]. 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 [median][median] for a [Student's t][t-distribution] random variable with degrees of freedom `ν` is 30 31 <!-- <equation class="equation" label="eq:t_median" align="center" raw="\operatorname{Median}\left( X \right) = 0" alt="Median for a Student's t distribution."> --> 32 33 <div class="equation" align="center" data-raw-text="\operatorname{Median}\left( X \right) = 0" data-equation="eq:t_median"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/t/median/docs/img/equation_t_median.svg" alt="Median for a Student's t 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 median = require( '@stdlib/stats/base/dists/t/median' ); 52 ``` 53 54 #### median( v ) 55 56 Returns the [median][median] of a [Student's t][t-distribution] distribution with degrees of freedom `v`. 57 58 ```javascript 59 var y = median( 9.0 ); 60 // returns 0.0 61 62 y = median( 1.5 ); 63 // returns 0.0 64 ``` 65 66 If provided `v < 0`, the function returns `NaN`. 67 68 ```javascript 69 var y = median( -1.0 ); 70 // returns NaN 71 ``` 72 73 </section> 74 75 <!-- /.usage --> 76 77 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 78 79 <section class="notes"> 80 81 </section> 82 83 <!-- /.notes --> 84 85 <!-- Package usage examples. --> 86 87 <section class="examples"> 88 89 ## Examples 90 91 <!-- eslint no-undef: "error" --> 92 93 ```javascript 94 var randu = require( '@stdlib/random/base/randu' ); 95 var round = require( '@stdlib/math/base/special/round' ); 96 var median = require( '@stdlib/stats/base/dists/t/median' ); 97 98 var v; 99 var y; 100 var i; 101 102 for ( i = 0; i < 10; i++ ) { 103 v = randu() * 20.0; 104 y = median( v ); 105 console.log( 'v: %d, Median(X,v): %d', v.toFixed( 4 ), y.toFixed( 4 ) ); 106 } 107 ``` 108 109 </section> 110 111 <!-- /.examples --> 112 113 <!-- 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. --> 114 115 <section class="references"> 116 117 </section> 118 119 <!-- /.references --> 120 121 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 122 123 <section class="links"> 124 125 [t-distribution]: https://en.wikipedia.org/wiki/Student%27s_t-distribution 126 127 [median]: https://en.wikipedia.org/wiki/Median 128 129 </section> 130 131 <!-- /.links -->