README.md (2203B)
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 # Kernel Betaincinv 22 23 > Inverse of the lower [incomplete beta function][incomplete-beta-function]. 24 25 <section class="intro"> 26 27 </section> 28 29 <!-- /.intro --> 30 31 <section class="usage"> 32 33 ## Usage 34 35 ```javascript 36 var kernelBetaincinv = require( '@stdlib/math/base/special/kernel-betaincinv' ); 37 ``` 38 39 #### kernelBetaincinv( a, b, p, q ) 40 41 Inverts the lower regularized [incomplete beta function][incomplete-beta-function] at `a > 0` and `b > 0`. Input probabilities `p` and `q` must satisfy `p = 1 - q`. The function returns a two-element array holding the function value `y` and `1-y`. 42 43 ```javascript 44 var y = kernelBetaincinv( 3.0, 3.0, 0.2, 0.8 ); 45 // returns [ ~0.327, ~0.673 ] 46 47 y = kernelBetaincinv( 3.0, 3.0, 0.4, 0.6 ); 48 // returns [ ~0.446, ~0.554 ] 49 50 y = kernelBetaincinv( 1.0, 6.0, 0.4, 0.6 ); 51 // returns [ ~0.082, ~0.918 ] 52 53 y = kernelBetaincinv( 1.0, 6.0, 0.8, 0.2 ); 54 // returns [ ~0.235, ~0.765 ] 55 ``` 56 57 </section> 58 59 <!-- /.usage --> 60 61 <section class="examples"> 62 63 ## Examples 64 65 <!-- eslint no-undef: "error" --> 66 67 ```javascript 68 var randu = require( '@stdlib/random/base/randu' ); 69 var kernelBetaincinv = require( '@stdlib/math/base/special/kernel-betaincinv' ); 70 71 var i; 72 var p; 73 var a; 74 var b; 75 76 for ( i = 0; i < 100; i++ ) { 77 p = randu(); 78 a = randu() * 10.0; 79 b = randu() * 10.0; 80 console.log( 'p: %d, \t a: %d, \t b: %d, \t f(p,a,b): %d', p.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), kernelBetaincinv( a, b, p, 1.0-p )[ 0 ] ); 81 } 82 ``` 83 84 </section> 85 86 <!-- /.examples --> 87 88 <section class="links"> 89 90 [incomplete-beta-function]: https://en.wikipedia.org/wiki/Incomplete_beta_function 91 92 </section> 93 94 <!-- /.links -->