Skip to content
Advertisement

Why doesn’t Johnson-SU distribution give positive skewness in scipy.stats?

The code below maps the statistical moments (mean, variance, skewness, excess kurtosis) generated by corresponding parameters (a, b, loc, scale) of the Johnson-SU distribution (johnsonsu).

For the range of loop values specified in my code below, no parameter configuration results in positive skewness, only negative skewness, even though it should be possible to parameterize the Johnson-SU distribution to be positively-skewed.

JavaScript

The min and max moments printed are:

JavaScript

What would be better ranges to explore for the a, b, loc and scale parameters than what I have specified below? The documentation only says a and b must be positive, nothing about what loc and scale must be limited to.

Advertisement

Answer

On looking at the Wikipedia article and the source code, it looks to me like the parameter a can change the skewness. Try negative values of a. The documentation says a must be greater than zero, but on glancing at the formulas and the code, that appears to be a bug in the documentation, and actually a can be less than or equal to zero.

I’ve tried your program above, replacing the range for a with np.arange(-2.5, 2.5, .5). It runs without error (although there are warnings about imprecision in the results, which are also present in the original) and reports:

JavaScript

PS. I’ve reported this as a bug to the Scipy project: https://github.com/scipy/scipy/issues/13353

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement