This function randomly generates counts from a zero-inflated Poisson
distribution according to the parameters on each row of the input
data.table
, and adds the counts to a new column count
.
generate_zip_counts(table, abs_tol = 0.001)
A data.table
with columns mu
and p
. These
correspond to the parameters mu
and sigma
in
rZIP
; the former is the Poisson expected value
parameter and the latter is the excess zero probability.
A scalar; if the excess zero probability is less than this value the count will be generated from a Poisson distribution.
The same table, with a new column count
.