Skip to content

Commit 8ff6e74

Browse files
committed
Auto-generated commit
1 parent 2aa305e commit 8ff6e74

File tree

3 files changed

+157
-9
lines changed

3 files changed

+157
-9
lines changed

CHANGELOG.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@
1010

1111
### Packages
1212

13+
<section class="package" id="stats-base-dists-kumaraswamy-unreleased">
14+
15+
#### [@stdlib/stats/base/dists/kumaraswamy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/kumaraswamy)
16+
17+
<details>
18+
19+
<section class="issues">
20+
21+
##### Closed Issues
22+
23+
This release closes the following issue:
24+
25+
[#1632](https://github.com/stdlib-js/stdlib/issues/1632)
26+
27+
</section>
28+
29+
<!-- /.issues -->
30+
31+
</details>
32+
33+
</section>
34+
35+
<!-- /.package -->
36+
1337
<section class="package" id="stats-base-dists-laplace-unreleased">
1438

1539
#### [@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:
4266

4367
### Closed Issues
4468

45-
This release closes the following issue:
69+
A total of 2 issues were closed in this release:
4670

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

4973
</section>
5074

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

5579
### Contributors
5680

57-
A total of 2 people contributed to this release. Thank you to the following contributors:
81+
A total of 3 people contributed to this release. Thank you to the following contributors:
5882

5983
- Philipp Burckhardt
6084
- Pratyush
85+
- Ruthwik Chikoti
6186

6287
</section>
6388

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

7095
<details>
7196

97+
- [`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)_
7298
- [`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)_
7399

74100
</details>

base/dists/kumaraswamy/README.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,75 @@ var y = dist.logpdf( 0.8 );
102102

103103
## Examples
104104

105-
<!-- TODO: better examples -->
106-
107105
<!-- eslint no-undef: "error" -->
108106

109107
```javascript
110-
var objectKeys = require( '@stdlib/utils/keys' );
111108
var kumaraswamy = require( '@stdlib/stats/base/dists/kumaraswamy' );
112109

113-
console.log( objectKeys( kumaraswamy ) );
110+
// Create a Kumaraswamy distribution object:
111+
var a = 2.0;
112+
var b = 5.0;
113+
var dist = new kumaraswamy.Kumaraswamy( a, b );
114+
115+
// Calculate basic distribution properties:
116+
console.log( 'Mean: %d', dist.mean );
117+
console.log( 'Median: %d', dist.median );
118+
console.log( 'Mode: %d', dist.mode );
119+
console.log( 'Variance: %d', dist.variance );
120+
121+
// Evaluate the probability density function (PDF):
122+
var x = 0.5;
123+
var y = dist.pdf( x );
124+
console.log( 'PDF at x = %d: %d', x, y );
125+
126+
// Evaluate the cumulative distribution function (CDF):
127+
y = dist.cdf( x );
128+
console.log( 'CDF at x = %d: %d', x, y );
129+
130+
// Evaluate the natural logarithm of PDF and CDF:
131+
console.log( 'Log PDF at x = %d: %d', x, dist.logpdf( x ) );
132+
console.log( 'Log CDF at x = %d: %d', x, dist.logcdf( x ) );
133+
134+
// Calculate the quantile for a given probability:
135+
var p = 0.75;
136+
x = dist.quantile( p );
137+
console.log( 'Quantile at p = %d: %d', p, x );
138+
139+
// Use standalone distribution functions:
140+
x = 0.3;
141+
y = kumaraswamy.pdf( x, a, b );
142+
console.log( 'Standalone PDF at x = %d: %d', x, y );
143+
144+
y = kumaraswamy.cdf( x, a, b );
145+
console.log( 'Standalone CDF at x = %d: %d', x, y );
146+
147+
y = kumaraswamy.quantile( 0.9, a, b );
148+
console.log( 'Standalone Quantile at p = 0.9: %d', y );
149+
150+
// Calculate additional distribution properties:
151+
console.log( 'Kurtosis: %d', kumaraswamy.kurtosis( a, b ) );
152+
console.log( 'Skewness: %d', kumaraswamy.skewness( a, b ) );
153+
console.log( 'Standard Deviation: %d', kumaraswamy.stdev( a, b ) );
154+
155+
// Demonstrate the effect of different shape parameters:
156+
console.log( '\nEffect of shape parameters:' );
157+
var shapes = [
158+
[ 0.5, 0.5 ],
159+
[ 5.0, 1.0 ],
160+
[ 1.0, 5.0 ],
161+
[ 2.0, 2.0 ],
162+
[ 10.0, 10.0 ]
163+
];
164+
var params;
165+
var i;
166+
for ( i = 0; i < shapes.length; i++ ) {
167+
params = shapes[i];
168+
console.log( '\na = %d, b = %d', params[0], params[1] );
169+
console.log( 'Mean: %d', kumaraswamy.mean( params[0], params[1] ) );
170+
console.log( 'Median: %d', kumaraswamy.median( params[0], params[1] ) );
171+
console.log( 'Mode: %d', kumaraswamy.mode( params[0], params[1] ) );
172+
console.log( 'Skewness: %d', kumaraswamy.skewness( params[0], params[1] ) );
173+
}
114174
```
115175

116176
</section>

base/dists/kumaraswamy/examples/index.js

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,69 @@
1818

1919
'use strict';
2020

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

24-
console.log( objectKeys( kumaraswamy ) );
23+
// Create a Kumaraswamy distribution object:
24+
var a = 2.0;
25+
var b = 5.0;
26+
var dist = new kumaraswamy.Kumaraswamy( a, b );
27+
28+
// Calculate basic distribution properties:
29+
console.log( 'Mean: %d', dist.mean );
30+
console.log( 'Median: %d', dist.median );
31+
console.log( 'Mode: %d', dist.mode );
32+
console.log( 'Variance: %d', dist.variance );
33+
34+
// Evaluate the probability density function (PDF):
35+
var x = 0.5;
36+
var y = dist.pdf( x );
37+
console.log( 'PDF at x = %d: %d', x, y );
38+
39+
// Evaluate the cumulative distribution function (CDF):
40+
y = dist.cdf( x );
41+
console.log( 'CDF at x = %d: %d', x, y );
42+
43+
// Evaluate the natural logarithm of PDF and CDF:
44+
console.log( 'Log PDF at x = %d: %d', x, dist.logpdf( x ) );
45+
console.log( 'Log CDF at x = %d: %d', x, dist.logcdf( x ) );
46+
47+
// Calculate the quantile for a given probability:
48+
var p = 0.75;
49+
x = dist.quantile( p );
50+
console.log( 'Quantile at p = %d: %d', p, x );
51+
52+
// Use standalone distribution functions:
53+
x = 0.3;
54+
y = kumaraswamy.pdf( x, a, b );
55+
console.log( 'Standalone PDF at x = %d: %d', x, y );
56+
57+
y = kumaraswamy.cdf( x, a, b );
58+
console.log( 'Standalone CDF at x = %d: %d', x, y );
59+
60+
y = kumaraswamy.quantile( 0.9, a, b );
61+
console.log( 'Standalone Quantile at p = 0.9: %d', y );
62+
63+
// Calculate additional distribution properties:
64+
console.log( 'Kurtosis: %d', kumaraswamy.kurtosis( a, b ) );
65+
console.log( 'Skewness: %d', kumaraswamy.skewness( a, b ) );
66+
console.log( 'Standard Deviation: %d', kumaraswamy.stdev( a, b ) );
67+
68+
// Demonstrate the effect of different shape parameters:
69+
console.log( '\nEffect of shape parameters:' );
70+
var shapes = [
71+
[ 0.5, 0.5 ],
72+
[ 5.0, 1.0 ],
73+
[ 1.0, 5.0 ],
74+
[ 2.0, 2.0 ],
75+
[ 10.0, 10.0 ]
76+
];
77+
var params;
78+
var i;
79+
for ( i = 0; i < shapes.length; i++ ) {
80+
params = shapes[ i ];
81+
console.log( '\na = %d, b = %d', params[0], params[1] );
82+
console.log( 'Mean: %d', kumaraswamy.mean( params[0], params[1] ) );
83+
console.log( 'Median: %d', kumaraswamy.median( params[0], params[1] ) );
84+
console.log( 'Mode: %d', kumaraswamy.mode( params[0], params[1] ) );
85+
console.log( 'Skewness: %d', kumaraswamy.skewness( params[0], params[1] ) );
86+
}

0 commit comments

Comments
 (0)