Skip to content

Conversation

@manit2004
Copy link
Contributor

Resolves #209

Description

This is a WIP pull request. Currently the core functionalities of Wald Distribution mean package has been implemented. Feedback needed on this implementation.

Tests, docs, examples and benchmark is yet to added, pending approval of the core implementation.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

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.

I have used this Wiki page as a reference.

Checklist

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

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Jan 2, 2026
@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Jan 3, 2026
@Planeshifter Planeshifter self-requested a review January 4, 2026 06:40
Comment on lines +35 to +41
* @example
* var y = mean( 0.0, 1.0 );
* // returns NaN
*
* @example
* var y = mean( 1.0, 0.0 );
* // returns NaN
Copy link
Member

@Planeshifter Planeshifter Jan 4, 2026

Choose a reason for hiding this comment

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

First examples should always showcase valid inputs (this is something that should be addressed in various files).

// MAIN //

/**
* Returns the expected value for a wald distribution with mean `mu` and standard deviation `sigma`.
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
* Returns the expected value for a wald distribution with mean `mu` and standard deviation `sigma`.
* Returns the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.

// MAIN //

/**
* Evaluates the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.
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
* Evaluates the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.
* Returns the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.

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.

As in #9324, the Wald distribution has a second shape parameter lambda and not standard deviation sigma, so this will have to be updated across this PR.

@manit2004 manit2004 requested a review from Planeshifter January 4, 2026 12:43
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jan 4, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/normal/mean $\color{green}175/175$
$\color{green}+0.00%$
$\color{green}9/9$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}175/175$
$\color{green}+0.00%$
stats/base/dists/wald/mean $\color{green}184/184$
$\color{green}+0.00%$
$\color{green}10/10$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}184/184$
$\color{green}+0.00%$

The above coverage report was generated for the changes in this PR.

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.

Thanks for the edits!

The PR is currently missing README.md, benchmarks, and also contains extraneous changes to normal/mean that should be reverted.


If provided `NaN` as any argument, the function returns `NaN`.

If provided `σ <= 0` or `λ <= 0` the function returns `NaN`.
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
If provided `σ <= 0` or `λ <= 0` the function returns `NaN`.
If provided `μ <= 0` or `λ <= 0` the function returns `NaN`.

Comment on lines 25 to 27
* @param mu mean
* @param lambda shape parameter
* @return expected value
Copy link
Member

@Planeshifter Planeshifter Jan 5, 2026

Choose a reason for hiding this comment

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

Descriptions need to be aligned here:

Suggested change
* @param mu mean
* @param lambda shape parameter
* @return expected value
* @param mu mean
* @param lambda shape parameter
* @return expected value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review A pull request which needs code review. Potential Duplicate There might be another pull request resolving the same issue. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: add the Wald distribution

3 participants