I've encountered some problematic behaviour with HypergeometricU
. I have a probability distribution on the positive integers that takes the following form after integrating out a few degrees of freedom:
prob[α_, γ_, T_, k_] := ((T)^k Gamma[k + α] Gamma[α + γ]
HypergeometricU[k + α, 1 + k - γ, T]) / (k! Gamma[α] Gamma[γ])
For many ranges of parameters, this works nicely, but if you plug in something like α = 0.145
, γ = 1.71
, and T = 53
, you'll see that this (incorrectly) evaluates to zero for 14 <= k <= 128
. This is somewhat "annoying" (not my original choice of words), given that I would like to perform maximum likelihood / Bayesian analysis on a set of data, but keep running up against Indeterminate
outputs whenever my log-likelihood function collides with these erroneous results. (And as luck would have it, the maximum likelihood values for my data set look like they fall in the "broken" zone.)
Now, I can go back to the integral definition of HypergeometricU
and attempt to perform that numerically, say with something naive like:
myU[a_?NumericQ, b_?NumericQ, z_?NumericQ] :=
Re[1/Gamma[a] NIntegrate[Exp[-z t] t^(a - 1) (1 + t)^(b - a - 1), {t, 0, ∞}]]
but this makes my log-likelihood function run s...l...o...w, taking on the order of 30s per call. In addition, the functional form of the integral can be problematic for numerical integration -- as a
gets large, the function becomes a very tall, but very narrow spike. (I've tried several different options in NIntegrate
, but none quiet the error messages that abound whenever I try applying NMaximize
to my log-likelihood.)
Any suggestions from the community? Or are many fun hours reading Abramowitz and Stegun, looking up, checking, rederiving, and ultimately coding up appropriate asymptotic forms in my future? (I can do this, but part of my reason for using Mathematica is so that I don't have to do this ...)