Learn R Programming

scanstatistics (version 0.1.0)

generate_zip_counts: Randomly generate and add ZIP-distributed counts to a table.

Description

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.

Usage

generate_zip_counts(table, abs_tol = 0.001)

Arguments

table

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.

abs_tol

A scalar; if the excess zero probability is less than this value the count will be generated from a Poisson distribution.

Value

The same table, with a new column count.