Skip to content

non_central_t distribution reports kurtosis + 3 #800

@mckib2

Description

@mckib2

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions