Description Usage Arguments Value References See Also Examples
log_pvalue
returns the logarithm of an approximation to the
tail sum from index s0
of the
convolution of exp(log_pmf)
with itself L
times. The
approximation has relative error bounded by gamma
. That
is, if P = sum(q[s0:length(q)])
with q = p * p * ... *
p
(where the *
denote L
convolutions), then the
approximation Q
satisfies abs(Q - P) <= gamma * P
.
1 | log_pvalue(log_pmf, s0, L, gamma)
|
log_pmf |
a numeric vector, the logarithm of a pmf. |
s0 |
a positive integer, the index for which the tail sum should be computed. |
L |
a positive integer giving the the number of times to convolve
|
gamma |
a positive number less than 0.5, to control the relative error. |
A number that is the logarithm of the approximation to the tail sum.
Huon Wilson, Uri Keich, Accurate small tail probabilities of sums of iid lattice-valued random variables via FFT, Submitted.
log_convolve
log_convolve_power
1 2 3 4 5 6 7 8 9 10 11 12 13 | pmf <- c(0.5, 0.5)
log_pval <- log_pvalue(log(pmf), 52, 101, 1e-3)
abs(exp(log_pval) - 0.5) <= 1e-3 * 0.5
pmf <- exp(30:1) / sum(exp(30:1))
# 2901 is the last entry in the convolution
log_pval <- log_pvalue(log(pmf), 2901, 100, 1e-3)
# (much) smaller than smallest double
log_pval < log(.Machine$double.xmin)
exact <- log(pmf[30]) * 100
# relative error, without underflow
abs(expm1(log_pval - exact)) <= 1e-3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.