Thanks to visit codestin.com
Credit goes to github.com

Skip to content

modified stats exponential distribution procedures to use loc and scale #991

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sebastian-mutz
Copy link

There’s some inconsistency in passed arguments for normal and exponential distributions. Consider the pdfs:
result = pdf_normal(x, loc, scale)
result = pdf_exp(x, lambda)

While the normal distribution procedure uses loc and scale (reminiscent of scipy) as opposed to mu and sigma, the exponential distribution procedure uses lambda rather than scale (also often referred to as beta, which is 1/lambda) and is missing loc.

As discussed on fortran-lang discourse, I suggest introducing more consistency in the stats distribution procedures API. I have made some modifications to stdlib_stats_distribution_exponential (and associated examples and tests) to:

  1. use scale instead of lambda, and
  2. allow passing an additional location parameter loc.

With the suggested modifications in the PR, rvs, pdf and cdf procedures can now be called as such:
result = rvs_exp(x, loc, scale),
result = pdf_exp(x, loc, scale), and
result = cdf_exp(x, loc, scale).

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.

1 participant