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

non_central_t distribution reports kurtosis + 3 #800

Closed
mckib2 opened this issue Jul 14, 2022 · 1 comment · Fixed by #813
Closed

non_central_t distribution reports kurtosis + 3 #800

mckib2 opened this issue Jul 14, 2022 · 1 comment · Fixed by #813

Comments

@mckib2
Copy link
Contributor

mckib2 commented Jul 14, 2022

It appears to us that boost::math::non_central_t is using the formula for (not-excess/Pearson) kurtosis as the implementation for kurtosis_excess, leading to an extra +3 for both kurtosis and kurtosis_excess. Here is a simple program demonstrating that using reference values from wolfram alpha ExcessKurtosis[NoncentralStudentTDistribution[10, 3]] and Kurtosis[NoncentralStudentTDistribution[10, 3]]:

#include <iostream>
#include "boost/math/distributions/non_central_t.hpp"

int main() {
  constexpr double v = 10;
  constexpr double delta = 3;
  boost::math::non_central_t_distribution<double> nct(v, delta);
  std::cout << "       kurtosis is " << boost::math::kurtosis(nct) << " (expected 5.44)" << std::endl;
  std::cout << "excess kurtosis is " << boost::math::kurtosis_excess(nct) << " (expected 2.44)" << std::endl;
  return 0;
}

Output is:

       kurtosis is 8.44235 (expected 5.44)
excess kurtosis is 5.44235 (expected 2.44)

Simply subtracting 3 appears to resolve the issue. xref scipy/scipy#16591

@jzmaddock
Copy link
Collaborator

Will investigate.

mborland added a commit to mborland/math that referenced this issue Aug 5, 2022
@mborland mborland linked a pull request Aug 5, 2022 that will close this issue
jzmaddock added a commit that referenced this issue Aug 5, 2022
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 a pull request may close this issue.

2 participants