dist_negbinomial {reservr}R Documentation

Negative binomial Distribution

Description

See stats::NegBinomial

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.

Details

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

Value

A NegativeBinomialDistribution object.

See Also

Other Distributions: Distribution, dist_bdegp(), dist_beta(), dist_binomial(), dist_blended(), dist_dirac(), dist_discrete(), dist_empirical(), dist_erlangmix(), dist_exponential(), dist_gamma(), dist_genpareto(), dist_lognormal(), dist_mixture(), dist_normal(), dist_pareto(), dist_poisson(), dist_translate(), dist_trunc(), dist_uniform(), dist_weibull()

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)
)


[Package reservr version 0.0.3 Index]