precompiled {sumR} | R Documentation |
List of precompiled functions in the sumR package
Description
More functions are periodically added to this list for convenience and speed.
These functions are all evaluated in the log scale and pass the ratio test,
that is, the limit of
an+1/an as n
goes to infinity is a value 0 \le L < 1
. The value of L
is
indicated in each entry. It is calculated automatically when the precompiled
functions are used in the summation.
Conway-Maxwell-Poisson normalizing constant
This series is the kernel of the Conway-Maxwell-Poisson distribution, which generalizes the Poisson and Geometric distributions. Its form is
L = 0, log(L) = -\infty,
for \lambda > 0
and \nu > 0
.
When \nu = 1
, this series reduces to the Poisson distribution kernel
and the sum (in the log scale) is known to be \lambda
. When
\nu = 0
and 0 < \lambda < 1
, the series reduces to the Geometric
distribution kernel with parameter 1 - \lambda
. The series is known to
sum to 1
. Finally, as \nu
goes to \infty
the distribution
approaches a Bernoulli distribution with parameter
\lambda / (1 - \lambda)
.
Another known result is when \nu = 2
, in which case the sum is the
modified Bessel function of the first kind of order 0 evaluated at
2\sqrt{\lambda}
.
String to access the precompiled function:
"COMP"
.parameter vector:
c(lambda, nu)
.
Double Poisson normalizing constant
This series is the kernel of the double Poisson distribution, which is a special case of the double exponential family, which extends it. Its form is
GP8hIamkYKW8vjk522fKO6UJeQQQJDLi
L = 0, log(L) = -\infty,
for \lambda > 0
and \phi > 0
.
When \phi = 1
, this series reduces to the Poisson distribution kernel
and the sum (in the log scale) is known to be 0.
String to acccess the precompiled function:
"double_poisson"
.parameter vector:
c(mu, phi)
Modified Bessel function of the first kind
This is the series form solution for the function. There are more time efficient methods for its evaluation however they don't guarantee good approximations with large parameters. Its form is
eIRg2OKn53IgRwNmD9X5651peTXEIwvW-1
L = 0, log(L) = -\infty,
for x > 0
and \alpha
any real value.
The modified Bessel function of the second kind can be obtained with
where I
represents the modified function of the first kind and K
of the second kind. It is worth remembering the infiniteSum()
function returns the sum in the log scale, which must be adjusted for the
formula above.
String to access the precompiled function:
"bessel_I"
parameter vector:
c(x, alpha)
Modified Bessel function of the first kind with log argument
This is the same function as the one above, except that parameter x
is
given in the log scale. This is provided for numerical stability. For the
cases where x
is not very large, sums using this function and the
above should return the same sum.
String to access the precompiled function:
"bessel_I_logX"
parameter vector:
c(logx, alpha)
Note
In some cases, the sum of the series is known in closed form for some values of the parameters. The package function does not check for these cases and just performs the approximation. If the exact value is desired by the user when it is known, they must take responsibility for checking and providing these values.
Another important thing to note is that the precompiled functions perform all calculations with twice the numerical precision than R. Therefore, in some cases, there might be very small differences in the sum when comparing the results of the function using the precompiled function and the same function defined at the R level.
See Also
infiniteSum()
, finiteSum()
and
infiniteSum_batches()