简体   繁体   中英

wald distribution and inverse gaussian distribution in scipy.stats

I am using scipy.stats to fit my data.

scipy.stats.invgauss.fit(my_data_array)
scipy.stats.wald.fit(my_data_array)

From wiki http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution it says that Wald distribution is just another name for inverse gaussian, but using two functions above gives me different fitting parameters. scipy.stats.invgauss.fit gives me three parameters and scipy.stats.wald.fit gives two.

What is the difference between these two distributons in scipy.stats?

I was trying to find the answer here, http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wald.html and http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgauss.html , but really no clue.

The link to the scipy.stats wald distribution has the answer to your question.

wald is a special case of invgauss with mu == 1.

So the following should produce the same answer:

import numpy as np
import scipy.stats as st

my_data = np.random.randn(1000)

wald_params = st.wald.fit(my_data)
invgauss_params = st.invgauss.fit(my_data, f0=1)

wald_params and invgauss_params are the same except invgauss has a 1 in front of the other two parameters which is the parameter that they said would be fixed as one in the wald distribution (I fixed it with the arg f0=1 ).

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM