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

Numerical overflow when calculating hedges.g #10

Open
dgerlanc opened this issue Jul 4, 2021 · 0 comments
Open

Numerical overflow when calculating hedges.g #10

dgerlanc opened this issue Jul 4, 2021 · 0 comments
Assignees
Labels

Comments

@dgerlanc
Copy link
Owner

dgerlanc commented Jul 4, 2021

When hedges.g is calculated for a combined number of observations greater than 340, usage of the gamma function in the exact calculation causes numerical overflow.

We can switch to using Cohen's approximation: 1 - 3/(4n - 9) or use log-gamma to calculate the exact value.

gamma(dof/2) / ( sqrt(dof/2) * gamma((dof-1)/2))
would become
exp(lgamma(df/2) - log(sqrt(df/2)) - lgamma((df-1)/2)

@dgerlanc dgerlanc self-assigned this Jul 7, 2021
@dgerlanc dgerlanc added the bug label Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant