Domanda

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 ;
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top