# [SciPy-User] Mean, variance, and parametrisation of an inverse Gaussian distribution

josef.pktd@gmai... josef.pktd@gmai...
Thu Jun 28 12:31:53 CDT 2012

On Thu, Jun 28, 2012 at 1:23 PM, nicky van foreest <vanforeest@gmail.com> wrote:
> As a first step, here is some example code:
>
> In [1]: from scipy.stats import invgauss
>
> In [2]: rv = invgauss(3, loc = 4)
>
> In [3]: rv.mean()
> Out[3]: 7.0
>
> In [4]: rv = invgauss(3, loc = 0)
>
> In [5]: rv.mean()
> Out[5]: 3.0
>
> In [6]:
>
>
> On 28 June 2012 19:22, nicky van foreest <vanforeest@gmail.com> wrote:
>> Hi Mathieu,
>>
>> I just checked the wikipedia on this distribution. From this and the
>> info on the sicpy.stats on invgauss I think you should try to use the
>> loc, scale and shape parameters of invgauss to match your need. The
>> meaning of loc and scale can be found here:
>>
>> http://docs.scipy.org/doc/scipy/reference/tutorial/stats.html#shifting-and-scaling
>>
>> The paragraph below this explains how to use shape parameters. You can
>> tune these parameters such that the mean is a/\sigma and the variance
>> is also what you need.

the source of invgaus has

def _stats(self, mu):
return mu, mu**3.0, 3*sqrt(mu), 15*mu

the first two are mean and variance, loc and scale are added generically.

I tried a bit to see how to map this to the mean variance in the
question, but I wasn't successful (in the time I had for this).

Josef

>>
>> Hope this helps
>>
>> Nicky
>>
>> On 28 June 2012 15:33, servant mathieu <servant.mathieu@gmail.com> wrote:
>>> Dear scipy users,
>>>
>>> The time for a diffusion process to reach a single evidence threshold a is
>>> often modeled as an inverse Gaussian distribution with mean (a/σ) and
>>> variance (a*σ2/μ3 ), where  μ represents the mean drift rate and  σ2  the
>>> variance of the accumlulation process. How could I reparametrise the
>>> scipy.stats.invgauss  function to manipulate those parameters?
>>>
>>> Cheers,
>>> Mathieu
>>>
>>>
>>>
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user