diff --git a/stats/base/dists/bernoulli/cdf/coverage.ndjson b/stats/base/dists/bernoulli/cdf/coverage.ndjson new file mode 100644 index 000000000..b9805028a --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/coverage.ndjson @@ -0,0 +1 @@ +[282,282,100,27,27,100,4,4,100,282,282,100,"ba78aa0847bc80f0dee0a27252c5618ed272bc1d","2024-12-16 23:03:01 +0530"] diff --git a/stats/base/dists/bernoulli/cdf/factory.js.html b/stats/base/dists/bernoulli/cdf/factory.js.html new file mode 100644 index 000000000..863e13db7 --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/factory.js.html @@ -0,0 +1,316 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/cdf/lib/factory.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/cdf/lib factory.js

+
+ +
+ 100% + Statements + 77/77 +
+ + +
+ 100% + Branches + 13/13 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 77/77 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +783x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +2008x +2008x +4x +4x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2004x +2006x +1x +1x +2006x +4x +4x +2006x +1581x +1581x +420x +2006x +2008x +3x +3x +3x +3x +3x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var constantFunction = require( '@stdlib/utils/constant-function' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a function for evaluating the cumulative distribution function (CDF) for a Bernoulli distribution with success probability `p`.
+*
+* @param {Probability} p - success probability
+* @returns {Function} CDF
+*
+* @example
+* var cdf = factory( 0.5 );
+* var y = cdf( 3.0 );
+* // returns 1.0
+*
+* y = cdf( 0.7 );
+* // returns 0.5
+*/
+function factory( p ) {
+	if ( isnan( p ) || p < 0.0 || p > 1.0 ) {
+		return constantFunction( NaN );
+	}
+	return cdf;
+ 
+	/**
+	* Evaluates the cumulative distribution function (CDF) for a Bernoulli distribution.
+	*
+	* @private
+	* @param {number} x - input value
+	* @returns {Probability} evaluated CDF
+	*
+	* @example
+	* var y = cdf( 2.0 );
+	* // returns <number>
+	*/
+	function cdf( x ) {
+		if ( isnan( x ) ) {
+			return NaN;
+		}
+		if ( x < 0.0 ) {
+			return 0.0;
+		}
+		if ( x >= 1.0 ) {
+			return 1.0;
+		}
+		return 1.0 - p;
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/cdf/index.html b/stats/base/dists/bernoulli/cdf/index.html new file mode 100644 index 000000000..b5471d557 --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/index.html @@ -0,0 +1,161 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/cdf/lib + + + + + + + + + +
+
+

All files stats/base/dists/bernoulli/cdf/lib

+
+ +
+ 100% + Statements + 282/282 +
+ + +
+ 100% + Branches + 27/27 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 282/282 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
factory.js +
+
100%77/77100%13/13100%2/2100%77/77
index.js +
+
100%57/57100%1/1100%0/0100%57/57
main.js +
+
100%81/81100%11/11100%1/1100%81/81
native.js +
+
100%67/67100%2/2100%1/1100%67/67
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/cdf/index.js.html b/stats/base/dists/bernoulli/cdf/index.js.html new file mode 100644 index 000000000..7759a7c5e --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/index.js.html @@ -0,0 +1,256 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/cdf/lib/index.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/cdf/lib index.js

+
+ +
+ 100% + Statements + 57/57 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 57/57 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +582x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+/**
+* Bernoulli distribution cumulative distribution function (CDF).
+*
+* @module @stdlib/stats/base/dists/bernoulli/cdf
+*
+* @example
+* var cdf = require( '@stdlib/stats/base/dists/bernoulli/cdf' );
+*
+* var y = cdf( 1.0, 0.5 );
+* // returns 1.0
+*
+* y = cdf( 0.5, 0.1 );
+* // returns 0.9
+*
+* var mycdf = cdf.factory( 0.5 );
+* y = mycdf( 3.0 );
+* // returns 1.0
+*
+* y = mycdf( -1.0 );
+* // returns 0.0
+*/
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( main, 'factory', factory );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = main;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/cdf/main.js.html b/stats/base/dists/bernoulli/cdf/main.js.html new file mode 100644 index 000000000..3df82d989 --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/main.js.html @@ -0,0 +1,328 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/cdf/lib/main.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/cdf/lib main.js

+
+ +
+ 100% + Statements + 81/81 +
+ + +
+ 100% + Branches + 11/11 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 81/81 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +822x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2010x +2010x +2010x +2010x +2010x +2006x +2010x +6x +6x +2010x +3x +3x +2010x +1581x +1581x +420x +2010x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Evaluates the cumulative distribution function (CDF) for a Bernoulli distribution with success probability `p` at a value `x`.
+*
+* @param {number} x - input value
+* @param {Probability} p - success probability
+* @returns {Probability} evaluated CDF
+*
+* @example
+* var y = cdf( 0.5, 0.5 );
+* // returns 0.5
+*
+* @example
+* var y = cdf( 2.0, 0.1 );
+* // returns 1.0
+*
+* @example
+* var y = cdf( -1.0, 0.3 );
+* // returns 0.0
+*
+* @example
+* var y = cdf( NaN, 0.5 );
+* // returns NaN
+*
+* @example
+* var y = cdf( 0.0, NaN );
+* // returns NaN
+*
+* @example
+* // Invalid probability
+* var y = cdf( 0.5, 1.4 );
+* // returns NaN
+*/
+function cdf( x, p ) {
+	if (
+		isnan( x ) ||
+		isnan( p ) ||
+		p < 0.0 ||
+		p > 1.0
+	) {
+		return NaN;
+	}
+	if ( x < 0.0 ) {
+		return 0.0;
+	}
+	if ( x >= 1.0 ) {
+		return 1.0;
+	}
+	return 1.0 - p;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = cdf;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/cdf/native.js.html b/stats/base/dists/bernoulli/cdf/native.js.html new file mode 100644 index 000000000..7f49eef85 --- /dev/null +++ b/stats/base/dists/bernoulli/cdf/native.js.html @@ -0,0 +1,286 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/cdf/lib/native.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/cdf/lib native.js

+
+ +
+ 100% + Statements + 67/67 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 67/67 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +681x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +2010x +2010x +2010x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var addon = require( './../src/addon.node' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Evaluates the cumulative distribution function (CDF) for a Bernoulli distribution with success probability `p` at a value `x`.
+*
+* @param {number} x - input value
+* @param {Probability} p - success probability
+* @returns {Probability} evaluated CDF
+*
+* @example
+* var y = cdf( 0.5, 0.5 );
+* // returns 1.0
+*
+* @example
+* var y = cdf( 2.0, 0.1 );
+* // returns 1.0
+*
+* @example
+* var y = cdf( -1.0, 0.3 );
+* // returns 0.0
+*
+* @example
+* var y = cdf( NaN, 0.5 );
+* // returns NaN
+*
+* @example
+* var y = cdf( 0.0, NaN );
+* // returns NaN
+*
+* @example
+* // Invalid probability
+* var y = cdf( 0.5, 1.4 );
+* // returns NaN
+*/
+function cdf( x, p ) {
+	return addon( x, p );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = cdf;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/quantile/coverage.ndjson b/stats/base/dists/bernoulli/quantile/coverage.ndjson new file mode 100644 index 000000000..868dd55f4 --- /dev/null +++ b/stats/base/dists/bernoulli/quantile/coverage.ndjson @@ -0,0 +1 @@ +[224,224,100,25,25,100,3,3,100,224,224,100,"ba78aa0847bc80f0dee0a27252c5618ed272bc1d","2024-12-16 23:03:01 +0530"] diff --git a/stats/base/dists/bernoulli/quantile/factory.js.html b/stats/base/dists/bernoulli/quantile/factory.js.html new file mode 100644 index 000000000..ea22745e3 --- /dev/null +++ b/stats/base/dists/bernoulli/quantile/factory.js.html @@ -0,0 +1,316 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/quantile/lib/factory.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/quantile/lib factory.js

+
+ +
+ 100% + Statements + 77/77 +
+ + +
+ 100% + Branches + 13/13 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 77/77 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +783x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +2006x +2006x +3x +3x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +2003x +3x +3x +2003x +990x +990x +1010x +2003x +2006x +3x +3x +3x +3x +3x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var constantFunction = require( '@stdlib/utils/constant-function' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a function for evaluating the quantile function for a Bernoulli distribution with success probability `p`.
+*
+* @param {Probability} p - success probability
+* @returns {Function} quantile function
+*
+* @example
+* var quantile = factory( 0.4 );
+* var y = quantile( 0.4 );
+* // returns 0
+*
+* y = quantile( 0.8 );
+* // returns 1
+*
+* y = quantile( 1.0 );
+* // returns 1
+*/
+function factory( p ) {
+	if ( isnan( p ) || p < 0.0 || p > 1.0 ) {
+		return constantFunction( NaN );
+	}
+	return quantile;
+ 
+	/**
+	* Evaluates the quantile function for a Bernoulli distribution.
+	*
+	* @private
+	* @param {Probability} r - input value
+	* @returns {NonNegativeInteger} evaluated quantile function
+	*
+	* @example
+	* var y = quantile( 0.3 );
+	* // returns <number>
+	*/
+	function quantile( r ) {
+		if ( isnan( r ) || r < 0.0 || r > 1.0 ) {
+			return NaN;
+		}
+		if ( r <= 1.0 - p ) {
+			return 0;
+		}
+		return 1;
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/quantile/index.html b/stats/base/dists/bernoulli/quantile/index.html new file mode 100644 index 000000000..fd47605c6 --- /dev/null +++ b/stats/base/dists/bernoulli/quantile/index.html @@ -0,0 +1,146 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/quantile/lib + + + + + + + + + +
+
+

All files stats/base/dists/bernoulli/quantile/lib

+
+ +
+ 100% + Statements + 224/224 +
+ + +
+ 100% + Branches + 25/25 +
+ + +
+ 100% + Functions + 3/3 +
+ + +
+ 100% + Lines + 224/224 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
factory.js +
+
100%77/77100%13/13100%2/2100%77/77
index.js +
+
100%60/60100%1/1100%0/0100%60/60
main.js +
+
100%87/87100%11/11100%1/1100%87/87
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/quantile/index.js.html b/stats/base/dists/bernoulli/quantile/index.js.html new file mode 100644 index 000000000..b13aeb9c2 --- /dev/null +++ b/stats/base/dists/bernoulli/quantile/index.js.html @@ -0,0 +1,265 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/quantile/lib/index.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/quantile/lib index.js

+
+ +
+ 100% + Statements + 60/60 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 60/60 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +612x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+/**
+* Bernoulli distribution quantile function.
+*
+* @module @stdlib/stats/base/dists/bernoulli/quantile
+*
+* @example
+* var quantile = require( '@stdlib/stats/base/dists/bernoulli/quantile' );
+*
+* var y = quantile( 0.8, 0.4 );
+* // returns 1
+*
+* y = quantile( 0.5, 0.4 );
+* // returns 0
+*
+* var myquantile = quantile.factory( 0.4 );
+* y = myquantile( 0.4 );
+* // returns 0
+*
+* y = myquantile( 0.8 );
+* // returns 1
+*
+* y = myquantile( 1.0 );
+* // returns 1
+*/
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( main, 'factory', factory );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = main;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/bernoulli/quantile/main.js.html b/stats/base/dists/bernoulli/quantile/main.js.html new file mode 100644 index 000000000..c6ab8c43d --- /dev/null +++ b/stats/base/dists/bernoulli/quantile/main.js.html @@ -0,0 +1,346 @@ + + + + + + Code coverage report for stats/base/dists/bernoulli/quantile/lib/main.js + + + + + + + + + +
+
+

All files / stats/base/dists/bernoulli/quantile/lib main.js

+
+ +
+ 100% + Statements + 87/87 +
+ + +
+ 100% + Branches + 11/11 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 87/87 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +882x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2007x +2007x +2007x +2007x +2007x +2007x +2007x +2001x +2007x +7x +7x +2007x +990x +990x +1010x +2007x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Evaluates the quantile function for a Bernoulli distribution with success probability `p` at a probability `r`.
+*
+* @param {Probability} r - input value
+* @param {Probability} p - success probability
+* @returns {NonNegativeInteger} evaluated quantile function
+*
+* @example
+* var y = quantile( 0.8, 0.4 );
+* // returns 1
+*
+* @example
+* var y = quantile( 0.5, 0.4 );
+* // returns 0
+*
+* @example
+* var y = quantile( 0.8, 0.1 );
+* // returns 0
+*
+* @example
+* var y = quantile( -0.2, 0.1 );
+* // returns NaN
+*
+* @example
+* var y = quantile( NaN, 0.8 );
+* // returns NaN
+*
+* @example
+* var y = quantile( 0.4, NaN );
+* // returns NaN
+*
+* @example
+* var y = quantile( 0.5, -1.0 );
+* // returns NaN
+*
+* @example
+* var y = quantile( 0.5, 1.5 );
+* // returns NaN
+*/
+function quantile( r, p ) {
+	if (
+		isnan( p ) ||
+		isnan( r ) ||
+		p < 0.0 ||
+		p > 1.0 ||
+		r < 0.0 ||
+		r > 1.0
+	) {
+		return NaN;
+	}
+	if ( r <= 1.0 - p ) {
+		return 0;
+	}
+	return 1;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = quantile;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file