Skip to content

docs: improve README examples for stats/base/dists/t namespace #1728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 6, 2024
Merged

docs: improve README examples for stats/base/dists/t namespace #1728

merged 3 commits into from
Mar 6, 2024

Conversation

Jai0401
Copy link
Contributor

@Jai0401 Jai0401 commented Mar 6, 2024

Resolves #1645

Description

What is the purpose of this pull request?

This pull request:
Improve README examples of stats/base/dists/t namespace

Related Issues

Does this pull request have any related issues?
No.

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Comment on lines 114 to 115
console.log( objectKeys( t ) );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log( objectKeys( t ) );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove the utils/keys import.

Comment on lines 24 to 25
console.log( objectKeys( t ) );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log( objectKeys( t ) );

Comment on lines 117 to 131
var degreesOfFreedom = 3;
var xValue = 1.5;

// Evaluate the probability density function (PDF) at a specific value
var pdfResult = t.pdf( xValue, degreesOfFreedom );
console.log( 'PDF at x = ' + xValue + ': ' + pdfResult );

// Evaluate the cumulative distribution function (CDF) at a specific value
var cdfResult = t.cdf( xValue, degreesOfFreedom );
console.log( 'CDF at x = ' + xValue + ': ' + cdfResult );

// Get the mean and variance of the t distribution
var meanValue = t.mean( degreesOfFreedom );
var varianceValue = t.variance( degreesOfFreedom );
console.log( 'Mean: ' + meanValue + ', Variance: ' + varianceValue );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var degreesOfFreedom = 3;
var xValue = 1.5;
// Evaluate the probability density function (PDF) at a specific value
var pdfResult = t.pdf( xValue, degreesOfFreedom );
console.log( 'PDF at x = ' + xValue + ': ' + pdfResult );
// Evaluate the cumulative distribution function (CDF) at a specific value
var cdfResult = t.cdf( xValue, degreesOfFreedom );
console.log( 'CDF at x = ' + xValue + ': ' + cdfResult );
// Get the mean and variance of the t distribution
var meanValue = t.mean( degreesOfFreedom );
var varianceValue = t.variance( degreesOfFreedom );
console.log( 'Mean: ' + meanValue + ', Variance: ' + varianceValue );
var dof = 3;
var x = 1.5;
// Evaluate the probability density function (PDF) at a specific value:
var res = t.pdf( x, dof );
console.log( 'PDF at x = ' + x + ': ' + res );
// Evaluate the cumulative distribution function (CDF) at a specific value:
res = t.cdf( x, dof );
console.log( 'CDF at x = ' + x + ': ' + res );
// Get the mean and variance of the t distribution:
var mu = t.mean( dof );
var v = t.variance( dof );
console.log( 'Mean: ' + mu + ', Variance: ' + v );

Follow project conventions in preferring shorter variable names.

@kgryte kgryte changed the title Docs:Improve README examples of stats/base/dists/t namespace docs: improve README examples for stats/base/dists/t namespace Mar 6, 2024
@Jai0401
Copy link
Contributor Author

Jai0401 commented Mar 6, 2024

@kgryte Thank you for your feedback! I have addressed all the issues you mentioned in your review. Please take a look at the changes, and let me know if everything looks good now. If you have any further suggestions or concerns, feel free to share them. Thanks again!

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright; let's land this change. Thanks!

@Planeshifter Planeshifter merged commit 26d6bde into stdlib-js:develop Mar 6, 2024
bad-in-coding pushed a commit to bad-in-coding/stdlib that referenced this pull request Mar 7, 2024
nishant-s7 pushed a commit to nishant-s7/stdlib that referenced this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: improve README examples of stats/base/dists/t namespace
4 participants