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
{{ message }}
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
Great package, thanks for publishing. I think I have found problem in the rng_wald for very large lambda. I am getting zero and negative values from rwald, for example try rwald(n=100, lambda = 1, mu = 1e20).
Line 72 and 73 of wald-distribution.cpp should be using something like Horner's method for numerical stability. I think the following should be acceptable:
x = mu * (1 + (mu/(2.0*lambda)) * ( y - sqrt(4.0*lambda*y/mu+(y*y))));
versus the original
x = mu + (mu*mu*y)/(2.0*lambda) - mu/(2.0*lambda) * sqrt(4.0*mu*lambda*y+(mu*mu)*(y*y));
I can issue a pull request late next week if that helps. Might need to factor out lambda too.
Great package, thanks for publishing. I think I have found problem in the
rng_waldfor very largelambda. I am getting zero and negative values fromrwald, for example tryrwald(n=100, lambda = 1, mu = 1e20).Line 72 and 73 of
wald-distribution.cppshould be using something like Horner's method for numerical stability. I think the following should be acceptable:versus the original
I can issue a pull request late next week if that helps. Might need to factor out
lambdatoo.