diff --git a/lib/node_modules/@stdlib/stats/base/dists/f/cdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/f/cdf/README.md index daf186718eb5..15d4ef7a9880 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/f/cdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/f/cdf/README.md @@ -24,7 +24,7 @@ limitations under the License.
-The [cumulative distribution function][cdf] for a [F][f-distribution] random variable is +The [cumulative distribution function][cdf] for an [F][f-distribution] random variable is @@ -55,7 +55,7 @@ var cdf = require( '@stdlib/stats/base/dists/f/cdf' ); #### cdf( x, d1, d2 ) -Evaluates the [cumulative distribution function][cdf] (CDF) for a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [cumulative distribution function][cdf] (CDF) for an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var y = cdf( 2.0, 1.0, 1.0 ); @@ -134,14 +134,15 @@ y = mycdf( 8.0 ); ```javascript var uniform = require( '@stdlib/random/array/uniform' ); var logEachMap = require( '@stdlib/console/log-each-map' ); +var EPS = require( '@stdlib/constants/float64/eps' ); var cdf = require( '@stdlib/stats/base/dists/f/cdf' ); var opts = { 'dtype': 'float64' }; var x = uniform( 10, 0.0, 10.0, opts ); -var d1 = uniform( 10, 0.0, 10.0, opts ); -var d2 = uniform( 10, 0.0, 10.0, opts ); +var d1 = uniform( 10, EPS, 10.0, opts ); +var d2 = uniform( 10, EPS, 10.0, opts ); logEachMap( 'x: %0.4f, d1: %0.4f, d2: %0.4f, F(x;d1,d2): %0.4f', x, d1, d2, cdf ); ``` @@ -150,6 +151,105 @@ logEachMap( 'x: %0.4f, d1: %0.4f, d2: %0.4f, F(x;d1,d2): %0.4f', x, d1, d2, cdf + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/f/cdf.h" +``` + +#### stdlib_base_dists_f_cdf( x, d1, d2 ) + +Evaluates the [cumulative distribution function][cdf] (CDF) for an [F][f-distribution] distribution with numerator degrees of freedom `d1` and denominator degrees of freedom `d2` at a value `x`. + +```c +double out = stdlib_base_dists_f_cdf( 2.0, 1.0, 1.0 ); +// returns ~0.608 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **d1**: `[in] double` numerator degrees of freedom. +- **d2**: `[in] double` denominator degrees of freedom. + +```c +double stdlib_base_dists_f_cdf( const double x, const double d1, const double d2 ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/f/cdf.h" +#include "stdlib/constants/float64/eps.h" +#include +#include + +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +int main( void ) { + double d1; + double d2; + double x; + double y; + int i; + + for ( i = 0; i < 10; i++ ) { + x = random_uniform( 0.0, 10.0 ); + d1 = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 ); + d2 = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 ); + y = stdlib_base_dists_f_cdf( x, d1, d2 ); + printf( "x: %lf, d1: %lf, d2: %lf, F(x;d1,d2): %lf\n", x, d1, d2, y ); + } +} +``` + +
+ + + +
+ + +