CyberMathIdiot
CyberMathIdiot

Reputation: 303

How to extract a, b of johnsonsu.rvs() distribution from the first four moments mean, stdev, skewness and kurtosis?

So let's see that I have a code where:

mu=0 # first moment
rms=3 # second moment
skew=1 # third moment - skewness
kurt=3 # fourth moment - kurtosis

The problem is that I want to use these parameters as input and extract from them some a, b to feed my johnsonsu.rvs(a=?, b=?, loc=mu, scale=rms, size=[N,N]). I know that there is a way to derive the moments from a and b, but is there any way to do the opposite? (Probably it is just trivial math to do that, but I cannot understand).

I am translating a MATLAB code to python, where such distributions as johnsonsu, are derived from the first four moments, so there is no other way to do that.

Upvotes: 1

Views: 202

Answers (1)

Max Pierini
Max Pierini

Reputation: 2259

I have ported the MATLAB code to estimate Johnson distributions parameters from moments

https://www.mathworks.com/matlabcentral/fileexchange/46123-johnson-curve-toolbox

to Python

https://github.com/maxdevblock/j_johnson_M

Usage

from j_johnson_M import f_johnson_M

coef, j_type, err = f_johnson_M(mu, sd, skew, kurt)

gamma, delta, xi, lam = coef

Upvotes: 1

Related Questions