Description Usage Arguments Details Value Examples
View source: R/convCount_probs.R
Compute count probabilities using one of several convolution methods.
dCount_conv_bi
does the computations for the distributions with
builtin support in this package.
dCount_conv_user
does the same using a user defined survival function.
1 2 3 4 5 6 7  dCount_conv_bi(x, distPars, dist = c("weibull", "gamma", "gengamma", "burr"),
method = c("dePril", "direct", "naive"), nsteps = 100, time = 1,
extrap = TRUE, log = FALSE)
dCount_conv_user(x, distPars, extrapolPars, survR, method = c("dePril",
"direct", "naive"), nsteps = 100, time = 1, extrap = TRUE,
log = FALSE)

x 
integer (vector), the desired count values. 
distPars 

dist 
character name of the builtin distribution, see details. 
method 
character string, the method to use, see Details. 
nsteps 
unsiged integer, number of steps used to compute the integral. 
time 
double, time at wich to compute the probabilities. Set to 1 by default. 
extrap 
logical, if 
log 
logical, if 
extrapolPars 
vector of length 2, the extrapolation values. 
survR 
function, user supplied survival function; should have signature

dCount_conv_bi
computes count probabilities using one of several
convolution methods for the distributions with builtin support in this
package.
The following convolution methods are implemented: "dePril", "direct", and "naive".
The builtin distributions currently are Weibull, gamma, generalised gamma and Burr.
vector of probabilities P(x(i),\ i = 1, ..., n) where n
is the length of x
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  x < 0:10
lambda < 2.56
p0 < dpois(x, lambda)
ll < sum(dpois(x, lambda, TRUE))
err < 1e6
## allprobs convolution approach
distPars < list(scale = lambda, shape = 1)
pmat_bi < dCount_conv_bi(x, distPars, "weibull", "direct",
nsteps = 200)
## user pwei
pwei_user < function(tt, distP) {
alpha < exp(log(distP[["scale"]]) / distP[["shape"]])
pweibull(q = tt, scale = alpha, shape = distP[["shape"]],
lower.tail = FALSE)
}
pmat_user < dCount_conv_user(x, distPars, c(1, 2), pwei_user, "direct",
nsteps = 200)
max((pmat_bi  p0)^2 / p0)
max((pmat_user  p0)^2 / p0)
## naive convolution approach
pmat_bi < dCount_conv_bi(x, distPars, "weibull", "naive",
nsteps = 200)
pmat_user < dCount_conv_user(x, distPars, c(1, 2), pwei_user, "naive",
nsteps = 200)
max((pmat_bi p0)^2 / p0)
max((pmat_user p0)^2 / p0)
## dePril conv approach
pmat_bi < dCount_conv_bi(x, distPars, "weibull", "dePril",
nsteps = 200)
pmat_user < dCount_conv_user(x, distPars, c(1, 2), pwei_user, "dePril",
nsteps = 200)
max((pmat_bi p0)^2 / p0)
max((pmat_user p0)^2 / p0)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.