# [SciPy-user] bootstrap statistics, higher moments

josef.pktd@gmai... josef.pktd@gmai...
Mon Apr 27 11:28:51 CDT 2009

```(continuing the bug-hunting adventure)

Until now I was missing a good test for higher order moments in
stats.distributions. I finally figured out that I can use bootstrap
estimation to get a confidence interval for the tests of skew and
kurtosis, or 3rd and 4th moments. However, the bootstrap variance of
the estimator is not very good with my "primitive" bootstrap.

Does anyone have a good bootstrap function, that can be used for skew
and kurtosis tests for samples from arbitrary distributions?

---
The first incorrect results in stats.distribution, that I found and
checked, are the raw moments for the non-central F distribution,
stats.ncf.moment.
The only explicit reference I found is
http://mathworld.wolfram.com/NoncentralF-Distribution.html

However, their general formula for the raw moments is identical to the
current implementation, and I don't know whether the formula is wrong
or whether there are some problems with the numerical implementation.
The explicit formulas for the first 4 raw moments produce the same
result as the generic numerical integration.The variance in
stats.ncf.stats() is also a little bit off (not enough to be caught by
the existing tests).  I didn't find any moments for the
ncf-distribution in R for comparison.

Does mathworld have typos? Or are there some differences in the
definitions of the special functions? I'm just curious, I will use the
explicit formulas in stats.ncf.

Josef

>>> args
(10, 20, 0.41578399999999999)
>>> stats.ncf.moment(4, *args)
0.97927472463095944

moment 1
stats 1.15730933333
integration 1.15730292082
explicit 1.15730933333

moment 2
stats 1.78949632988
integration 1.80763055597
explicit 1.80766239354

moment 3
stats 1.41137486702
integration 3.761650183
explicit 3.76366631204

moment 4
stats 0.979274724631
integration 10.4651526972
explicit 10.4455970627
```