Skip to content
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

ENH: stats: Implement _logpdf, _sf and _isf for nakagami. #12958

Merged
merged 2 commits into from
Oct 22, 2020

Conversation

WarrenWeckesser
Copy link
Member

No description provided.

@WarrenWeckesser WarrenWeckesser added scipy.stats enhancement A new feature or improvement labels Oct 17, 2020
@WarrenWeckesser WarrenWeckesser added this to the 1.6.0 milestone Oct 19, 2020
Copy link
Member

@ev-br ev-br left a comment

Choose a reason for hiding this comment

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

LGTM modulo a small nit

@WarrenWeckesser
Copy link
Member Author

Thanks, @ev-br; what is the small nit? I don't see any other comments.

# nakagami.pdf(x, nu) = 2 * nu**nu / gamma(nu) *
# x**(2*nu-1) * exp(-nu*x**2)
return 2*nu**nu/sc.gamma(nu)*(x**(2*nu-1.0))*np.exp(-nu*x*x)
return (np.log(2) + nu*np.log(nu) - sc.gammaln(nu) +
(2*nu - 1)*np.log(x) - nu*x**2)
Copy link
Member

Choose a reason for hiding this comment

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

Nit, optional: xlogy(2*nu -1, x)

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I've changed that, and I've changed nu*np.log(nu) to xlogy(nu, nu).

@ev-br
Copy link
Member

ev-br commented Oct 21, 2020

Hm, I seem to be unable to use github today. Here's the small optional nit:
#12958 (comment)
In case I cannot even copy-paste links: it's about using xlogy(2*nu - 1, x) in place of (2*nu -1) * log(x)

@ev-br ev-br merged commit 61b3db4 into scipy:master Oct 22, 2020
@ev-br
Copy link
Member

ev-br commented Oct 22, 2020

Merged, thanks Warren.

@WarrenWeckesser WarrenWeckesser deleted the nakagami branch October 22, 2020 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants