README.md (3341B)
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 # Mean 22 23 > [Degenerate][degenerate-distribution] distribution [expected value][expected-value]. 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 [expected value][expected-value] for a [degenerate][degenerate-distribution] random variable is 30 31 <!-- <equation class="equation" label="eq:degenerate_expectation" align="center" raw="\mathbb{E}\left[ X \right] = \mu" alt="Expected value for a degenerate distribution."> --> 32 33 <div class="equation" align="center" data-raw-text="\mathbb{E}\left[ X \right] = \mu" data-equation="eq:degenerate_expectation"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@e1fbdee688c5409e4cc6b0cd06d90b1cd2abd67c/lib/node_modules/@stdlib/stats/base/dists/degenerate/mean/docs/img/equation_degenerate_expectation.svg" alt="Expected value for a degenerate distribution."> 35 <br> 36 </div> 37 38 <!-- </equation> --> 39 40 where `μ` is the constant value of the distribution. 41 42 </section> 43 44 <!-- /.intro --> 45 46 <!-- Package usage documentation. --> 47 48 <section class="usage"> 49 50 ## Usage 51 52 ```javascript 53 var mean = require( '@stdlib/stats/base/dists/degenerate/mean' ); 54 ``` 55 56 #### mean( mu ) 57 58 Returns the [expected value][expected-value] of a [degenerate][degenerate-distribution] distribution with constant value `mu`. 59 60 ```javascript 61 var v = mean( 10.0 ); 62 // returns 10.0 63 64 v = mean( -0.5 ); 65 // returns -0.5 66 ``` 67 68 </section> 69 70 <!-- /.usage --> 71 72 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 73 74 <section class="notes"> 75 76 </section> 77 78 <!-- /.notes --> 79 80 <!-- Package usage examples. --> 81 82 <section class="examples"> 83 84 ## Examples 85 86 <!-- eslint no-undef: "error" --> 87 88 ```javascript 89 var randu = require( '@stdlib/random/base/randu' ); 90 var mean = require( '@stdlib/stats/base/dists/degenerate/mean' ); 91 92 var mu; 93 var v; 94 var i; 95 96 for ( i = 0; i < 10; i++ ) { 97 mu = randu(); 98 v = mean( mu ); 99 console.log( 'µ: %d, E(X;µ): %d', mu.toFixed( 4 ), v.toFixed( 4 ) ); 100 } 101 ``` 102 103 </section> 104 105 <!-- /.examples --> 106 107 <!-- 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. --> 108 109 <section class="references"> 110 111 </section> 112 113 <!-- /.references --> 114 115 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 116 117 <section class="links"> 118 119 [degenerate-distribution]: https://en.wikipedia.org/wiki/Degenerate_distribution 120 121 [expected-value]: https://en.wikipedia.org/wiki/Expected_value 122 123 </section> 124 125 <!-- /.links -->