You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dinvgaussian function, the pdf of the inverse-Gaussian distribution, produces incorrect results.
It doesn't integrate to 1 like a proper pdf, but to 1.732051. Its moments also mismatch what they should algebraically be, e.g. its expected value should equal the mu parameter, but it isn't.
I discovered the issue. Discord user Clarinetist#7695 identified the problem to be in this piece of code:
dens <- log(lambda/(2 * pi * x^3)^0.5) - ((lambda * (x - mu)^2)/(2 * mu^2 * x)) if (log == FALSE) dens <- exp(dens)
Stating: "Taking the log of this, it should be"
"$$\log f(x) = \dfrac{1}{2}\log\left(\dfrac{\lambda}{2\pi x^3} \right) - \dfrac{\lambda (x-\mu)^2}{2\mu^2 x}$$"
The text was updated successfully, but these errors were encountered:
The dinvgaussian function, the pdf of the inverse-Gaussian distribution, produces incorrect results.
It doesn't integrate to 1 like a proper pdf, but to 1.732051. Its moments also mismatch what they should algebraically be, e.g. its expected value should equal the mu parameter, but it isn't.
I discovered the issue. Discord user Clarinetist#7695 identified the problem to be in this piece of code:
dens <- log(lambda/(2 * pi * x^3)^0.5) - ((lambda * (x - mu)^2)/(2 * mu^2 * x)) if (log == FALSE) dens <- exp(dens)
Stating: "Taking the log of this, it should be"
"$$\log f(x) = \dfrac{1}{2}\log\left(\dfrac{\lambda}{2\pi x^3} \right) - \dfrac{\lambda (x-\mu)^2}{2\mu^2 x}$$"
The text was updated successfully, but these errors were encountered: