<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1848" rel="nofollow">http://projects.scipy.org/scipy/ticket/1848</a> on 2013-02-20 by trac user ken.bastiaensen@..., assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rgommers/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rgommers">@rgommers</a>.</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">I think the implementation of invgauss might not be correct.</p>
<p dir="auto">The Inverse Gaussian is usually defined as the first hitting time probability of a random gaussian process (Wiener) drifting towards a barrier. See e.g. <a href="http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution" rel="nofollow">http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution</a><br>
Usually the pdf is defined in the form pdf(x;d,a) = d / sqrt(2_pi_x**3) * exp(-(a<em>x-d)**2/(2</em>x))<br>
with d = c / sigma, a = m / sigma,<br>
c: distance to barrier at start<br>
and (m,sigma): drift and square vol of the process.</p>
<p dir="auto">In scipy.stats it is defined as<br>
invgauss.pdf(x, mu) = 1 / sqrt(2_pi_x**3) * exp(-(x-mu)<strong>2/(2_x_mu</strong>2))</p>
<p dir="auto">I believe the location and scale transformation x -&gt; (x-loc)/scale cannot capture the actual change in parameter together with the parameter mu. [[BR]]</p>
<p dir="auto">The parameter loc cannot be used different from zero as it introduces a polynomial in the sqrt of the first pdf factor, changing the distribution.[[BR]]</p>
<p dir="auto">A change in parameter scale:<br>
pdf_scale(x,mu) = sqrt(scale<strong>3)/sqrt(2_pi_x</strong>3)_exp(-(sqrt(scale)-x/(mu_sqrt(scale))*_2/(2_x)) [[BR]]</p>
<p dir="auto">In the exponential factor, the parameter mu is multiplied by sqrt(scale), as well as the first term in the numerator. But the first pdf factor is multiplied by sqrt(scale**3).</p>
<p dir="auto">I don't think there exists a transformation betweeen the usual pdf as on wikipedia and the parameters mu,loc,scale in the implementation. Or differently stated, invgauss only captures the distribution when distance to barrier equals standard deviation of the process, a very specific case.</p>
<p dir="auto">I suggest to change to distribution implementation.</p>
<p dir="auto">Should a transformation exist, then please regard this as an enhancement request for the documentation to include this transformation.</p>
<p dir="auto">This question was also asked in the user mailinglist but never answered: <a href="http://mail.scipy.org/pipermail/scipy-user/2012-June/032420.html" rel="nofollow">http://mail.scipy.org/pipermail/scipy-user/2012-June/032420.html</a></p>
<p dir="auto">Ken</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1339" rel="nofollow">http://projects.scipy.org/scipy/ticket/1339</a> on 2010-12-03 by trac user bjarni.vilhjalmsson, assigned to unknown.</em></p>
<p dir="auto">A rather simple and small bug:</p>
<p dir="auto">File "/sw/lib/python2.6/site-packages/scipy/optimize/zeros.py", line 123, in newton<br>
warnings.warn(msg, RuntimeWarning)<br>
NameError: global name 'warnings' is not defined</p>