### Harris (2008) gives accurate values (16 figures) for
### x = 0.01, y = 4, and nu = 0:9
### nu = 0, Harris value is 2.22531 07612 66469
options(digits = 16)
incompleteBesselK(0.01, 4, 0)
### nu = 9, Harris value is 0.00324 67980 03149
incompleteBesselK(0.01, 4, 9)
### Other values given in Harris (2008)
### x = 4.95, y = 5.00, nu = 2
incompleteBesselK(4.95, 5, 2) ## 0.00001 22499 87981
### x = 10, y = 2, nu = 6
### Slevinsky and Safouhi (2010) suggest Harris (2008) value
### is incorrect, give value 0.00000 04150 01064 21228
incompleteBesselK(10, 2, 6)
### x = 3.1, y = 2.6, nu = 5
incompleteBesselK(3.1, 2.6, 5) ## 0.00052 85043 25244
### Check values when x > y using numeric integration
nus <- 0:9
(numIBF <- sapply(nus, incompleteBesselK, x = 4, y = 0.01))
besselFn <- function(t, x, y, nu) t^(-nu - 1) * exp(-x*t - y/t)
integIBF <- sapply(nus, integrate, f = besselFn, lower = 1, upper = Inf,
x = 4, y = 0.01)
intIBF <- as.numeric(integIBF["value", ])
numIBF - intIBF
max(abs(numIBF - intIBF)) ## 1.257e-11
options(digits = 7)
Run the code above in your browser using DataLab