public double kurtosis()
{
if (kurtosis_ == null) {
int N = samples();
if (!(N > 3)) throw new ApplicationException("sample number <=3, unsufficient");
double x = expectationValue(y => Math.Pow(y.Key * y.Value - mean(), 4), y => true).Key;
double sigma2 = variance();
double c1 = (N / (N - 1.0)) * (N / (N - 2.0)) * ((N + 1.0) / (N - 3.0));
double c2 = 3.0 * ((N - 1.0) / (N - 2.0)) * ((N - 1.0) / (N - 3.0));
kurtosis_ = c1 * (x / (sigma2 * sigma2)) - c2;
}
return kurtosis_.GetValueOrDefault();
}