[Scipy-tickets] [SciPy] #1848: stats invgauss parameters
SciPy Trac
scipy-tickets@scipy....
Wed Feb 20 04:31:40 CST 2013
#1848: stats invgauss parameters
---------------------------------------+------------------------------------
Reporter: ken.bastiaensen@… | Owner: rgommers
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: scipy.stats | Version: 0.11.0
Keywords: invgauss |
---------------------------------------+------------------------------------
Hi,
I think the implementation of invgauss might not be correct.
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.
http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
Usually the pdf is defined in the form pdf(x;d,a) = d / sqrt(2*pi*x**3) *
exp(-(a*x-d)**2/(2*x))
with d = c / sigma, a = m / sigma,
c: distance to barrier at start
and (m,sigma): drift and square vol of the process.
In scipy.stats it is defined as
invgauss.pdf(x, mu) = 1 / sqrt(2*pi*x**3) * exp(-(x-mu)**2/(2*x*mu**2))
I believe the location and scale transformation x -> (x-loc)/scale cannot
capture the actual change in parameter together with the parameter mu.
[[BR]]
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]]
A change in parameter scale:
pdf_scale(x,mu) =
sqrt(scale**3)/sqrt(2*pi*x**3)*exp(-(sqrt(scale)-x/(mu*sqrt(scale))**2/(2*x))
[[BR]]
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).
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.
I suggest to change to distribution implementation.
Should a transformation exist, then please regard this as an enhancement
request for the documentation to include this transformation.
This question was also asked in the user mailinglist but never answered:
http://mail.scipy.org/pipermail/scipy-user/2012-June/032420.html
Ken
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1848>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list