Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Nov 11, 2024
1 parent 2aa305e commit 8ff6e74
Showing 3 changed files with 157 additions and 9 deletions.
32 changes: 29 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,30 @@

### Packages

<section class="package" id="stats-base-dists-kumaraswamy-unreleased">

#### [@stdlib/stats/base/dists/kumaraswamy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/kumaraswamy)

<details>

<section class="issues">

##### Closed Issues

This release closes the following issue:

[#1632](https://github.com/stdlib-js/stdlib/issues/1632)

</section>

<!-- /.issues -->

</details>

</section>

<!-- /.package -->

<section class="package" id="stats-base-dists-laplace-unreleased">

#### [@stdlib/stats/base/dists/laplace](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/laplace)
@@ -42,9 +66,9 @@ This release closes the following issue:

### Closed Issues

This release closes the following issue:
A total of 2 issues were closed in this release:

[#1633](https://github.com/stdlib-js/stdlib/issues/1633)
[#1632](https://github.com/stdlib-js/stdlib/issues/1632), [#1633](https://github.com/stdlib-js/stdlib/issues/1633)

</section>

@@ -54,10 +78,11 @@ This release closes the following issue:

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:
A total of 3 people contributed to this release. Thank you to the following contributors:

- Philipp Burckhardt
- Pratyush
- Ruthwik Chikoti

</section>

@@ -69,6 +94,7 @@ A total of 2 people contributed to this release. Thank you to the following cont

<details>

- [`4e1c68b`](https://github.com/stdlib-js/stdlib/commit/4e1c68b10906fea989b1a785405eb17d68553461) - **docs:** improve examples of `stats/base/dists/kumaraswamy` [(#2605)](https://github.com/stdlib-js/stdlib/pull/2605) _(by Ruthwik Chikoti, Philipp Burckhardt)_
- [`19c8688`](https://github.com/stdlib-js/stdlib/commit/19c868816d201337c4cb77683c2ff0a306b81e95) - **docs:** improve README examples of `stats/base/dists/laplace` namespace [(#1875)](https://github.com/stdlib-js/stdlib/pull/1875) _(by Pratyush, Philipp Burckhardt)_

</details>
68 changes: 64 additions & 4 deletions base/dists/kumaraswamy/README.md
Original file line number Diff line number Diff line change
@@ -102,15 +102,75 @@ var y = dist.logpdf( 0.8 );

## Examples

<!-- TODO: better examples -->

<!-- eslint no-undef: "error" -->

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var kumaraswamy = require( '@stdlib/stats/base/dists/kumaraswamy' );

console.log( objectKeys( kumaraswamy ) );
// Create a Kumaraswamy distribution object:
var a = 2.0;
var b = 5.0;
var dist = new kumaraswamy.Kumaraswamy( a, b );

// Calculate basic distribution properties:
console.log( 'Mean: %d', dist.mean );
console.log( 'Median: %d', dist.median );
console.log( 'Mode: %d', dist.mode );
console.log( 'Variance: %d', dist.variance );

// Evaluate the probability density function (PDF):
var x = 0.5;
var y = dist.pdf( x );
console.log( 'PDF at x = %d: %d', x, y );

// Evaluate the cumulative distribution function (CDF):
y = dist.cdf( x );
console.log( 'CDF at x = %d: %d', x, y );

// Evaluate the natural logarithm of PDF and CDF:
console.log( 'Log PDF at x = %d: %d', x, dist.logpdf( x ) );
console.log( 'Log CDF at x = %d: %d', x, dist.logcdf( x ) );

// Calculate the quantile for a given probability:
var p = 0.75;
x = dist.quantile( p );
console.log( 'Quantile at p = %d: %d', p, x );

// Use standalone distribution functions:
x = 0.3;
y = kumaraswamy.pdf( x, a, b );
console.log( 'Standalone PDF at x = %d: %d', x, y );

y = kumaraswamy.cdf( x, a, b );
console.log( 'Standalone CDF at x = %d: %d', x, y );

y = kumaraswamy.quantile( 0.9, a, b );
console.log( 'Standalone Quantile at p = 0.9: %d', y );

// Calculate additional distribution properties:
console.log( 'Kurtosis: %d', kumaraswamy.kurtosis( a, b ) );
console.log( 'Skewness: %d', kumaraswamy.skewness( a, b ) );
console.log( 'Standard Deviation: %d', kumaraswamy.stdev( a, b ) );

// Demonstrate the effect of different shape parameters:
console.log( '\nEffect of shape parameters:' );
var shapes = [
[ 0.5, 0.5 ],
[ 5.0, 1.0 ],
[ 1.0, 5.0 ],
[ 2.0, 2.0 ],
[ 10.0, 10.0 ]
];
var params;
var i;
for ( i = 0; i < shapes.length; i++ ) {
params = shapes[i];
console.log( '\na = %d, b = %d', params[0], params[1] );
console.log( 'Mean: %d', kumaraswamy.mean( params[0], params[1] ) );
console.log( 'Median: %d', kumaraswamy.median( params[0], params[1] ) );
console.log( 'Mode: %d', kumaraswamy.mode( params[0], params[1] ) );
console.log( 'Skewness: %d', kumaraswamy.skewness( params[0], params[1] ) );
}
```

</section>
66 changes: 64 additions & 2 deletions base/dists/kumaraswamy/examples/index.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,69 @@

'use strict';

var objectKeys = require( '@stdlib/utils/keys' );
var kumaraswamy = require( './../lib' );

console.log( objectKeys( kumaraswamy ) );
// Create a Kumaraswamy distribution object:
var a = 2.0;
var b = 5.0;
var dist = new kumaraswamy.Kumaraswamy( a, b );

// Calculate basic distribution properties:
console.log( 'Mean: %d', dist.mean );
console.log( 'Median: %d', dist.median );
console.log( 'Mode: %d', dist.mode );
console.log( 'Variance: %d', dist.variance );

// Evaluate the probability density function (PDF):
var x = 0.5;
var y = dist.pdf( x );
console.log( 'PDF at x = %d: %d', x, y );

// Evaluate the cumulative distribution function (CDF):
y = dist.cdf( x );
console.log( 'CDF at x = %d: %d', x, y );

// Evaluate the natural logarithm of PDF and CDF:
console.log( 'Log PDF at x = %d: %d', x, dist.logpdf( x ) );
console.log( 'Log CDF at x = %d: %d', x, dist.logcdf( x ) );

// Calculate the quantile for a given probability:
var p = 0.75;
x = dist.quantile( p );
console.log( 'Quantile at p = %d: %d', p, x );

// Use standalone distribution functions:
x = 0.3;
y = kumaraswamy.pdf( x, a, b );
console.log( 'Standalone PDF at x = %d: %d', x, y );

y = kumaraswamy.cdf( x, a, b );
console.log( 'Standalone CDF at x = %d: %d', x, y );

y = kumaraswamy.quantile( 0.9, a, b );
console.log( 'Standalone Quantile at p = 0.9: %d', y );

// Calculate additional distribution properties:
console.log( 'Kurtosis: %d', kumaraswamy.kurtosis( a, b ) );
console.log( 'Skewness: %d', kumaraswamy.skewness( a, b ) );
console.log( 'Standard Deviation: %d', kumaraswamy.stdev( a, b ) );

// Demonstrate the effect of different shape parameters:
console.log( '\nEffect of shape parameters:' );
var shapes = [
[ 0.5, 0.5 ],
[ 5.0, 1.0 ],
[ 1.0, 5.0 ],
[ 2.0, 2.0 ],
[ 10.0, 10.0 ]
];
var params;
var i;
for ( i = 0; i < shapes.length; i++ ) {
params = shapes[ i ];
console.log( '\na = %d, b = %d', params[0], params[1] );
console.log( 'Mean: %d', kumaraswamy.mean( params[0], params[1] ) );
console.log( 'Median: %d', kumaraswamy.median( params[0], params[1] ) );
console.log( 'Mode: %d', kumaraswamy.mode( params[0], params[1] ) );
console.log( 'Skewness: %d', kumaraswamy.skewness( params[0], params[1] ) );
}

0 comments on commit 8ff6e74

Please sign in to comment.