# besselRatio: Ratio of Bessel K Functions In HyperbolicDist: The Hyperbolic Distribution

 Bessel K Ratio R Documentation

## Ratio of Bessel K Functions

### Description

Calculates the ratio of Bessel K functions of different orders

### Usage

besselRatio(x, nu, orderDiff, useExpScaled = 700)



### Arguments

 x Numeric, \geq 0. Value at which the numerator and denominator Bessel functions are evaluated. nu Numeric. The order of the Bessel function in the denominator. orderDiff Numeric. The order of the numerator Bessel function minus the order of the denominator Bessel function. useExpScaled Numeric, \geq 0. The smallest value of x for which the ratio is calculated using the exponentially-scaled Bessel function values.

### Details

Uses the function besselK to calculate the ratio of two modified Bessel function of the third kind whose orders are different. The calculation of Bessel functions will underflow if the value of x is greater than around 740. To avoid underflow the exponentially-scaled Bessel functions can be returned by besselK. The ratio is actually unaffected by exponential scaling since the scaling cancels across numerator and denominator.

The Bessel function ratio is useful in calculating moments of the Generalized Inverse Gaussian distribution, and hence also for the moments of the hyperbolic and generalized hyperbolic distributions.

### Value

The ratio

\frac{K_{\nu+k}(x)}{K_{\nu}(x)}

of two modified Bessel functions of the third kind whose orders differ by k.

### Author(s)

David Scott d.scott@auckland.ac.nz

besselK, gigMom

### Examples

nus <- c(0:5, 10, 20)
x <- seq(1, 4, length.out = 11)
k <- 3

raw <- matrix(nrow = length(nus), ncol = length(x))
scaled <- matrix(nrow = length(nus), ncol = length(x))
compare <- matrix(nrow = length(nus), ncol = length(x))

for (i in 1:length(nus)){
for (j in 1:length(x)) {
raw[i,j] <- besselRatio(x[j], nus[i],
orderDiff = k)
scaled[i,j] <- besselRatio(x[j], nus[i],
orderDiff = k, useExpScaled = 1)
compare[i,j] <- raw[i,j]/scaled[i,j]
}
}
raw
scaled
compare



HyperbolicDist documentation built on Nov. 26, 2023, 9:07 a.m.