문제

I am trying to calculate the kurtosis of a vector of numbers, the expected value is 1.5, however i get -1.5. Is there something i am missing from this code? Thanks in advance

using namespace boost::accumulators;
accumulator_set<float, stats<tag::mean, tag::kurtosis > > acc;
std::vector<float> v1 ;
v1.push_back(2);
v1.push_back(3);
v1.push_back(4);
acc = std::for_each( v1.begin(), v1.end(), acc ) ;
std::cout << kurtosis(acc) << std::endl ;
도움이 되었습니까?

해결책

From the documentation

The term -3 is added in order to ensure that the normal distribution has zero kurtosis.

Your result is negative because your data has less kurtosis than Gaussian distributed data.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top