Skip to contents

Usage

dist_negbinomial(size = NULL, mu = NULL)

Arguments

size

Number of successful trials parameter, or NULL as a placeholder. Non-integer values > 0 are allowed.

mu

Mean parameter, or NULL as a placeholder.

Value

A NegativeBinomialDistribution object.

Details

Both parameters can be overridden with with_params = list(size = ..., prob = ...).

Examples

d_nbinom <- dist_negbinomial(size = 3.5, mu = 8.75)
x <- d_nbinom$sample(100)
d_emp <- dist_empirical(x)

plot_distributions(
  empirical = d_emp,
  theoretical = d_nbinom,
  estimated = d_nbinom,
  with_params = list(
    estimated = inflate_params(
      fitdistrplus::fitdist(x, distr = "nbinom")$estimate
    )
  ),
  .x = 0:max(x)
)