dist_gamma {reservr}R Documentation

Gamma distribution

Description

See stats::GammaDist.

Usage

dist_gamma(shape = NULL, rate = NULL)

Arguments

shape

Scalar shape parameter, or NULL as a placeholder.

rate

Scalar rate parameter, or NULL as a placeholder.

Details

Both parameters can be overridden with with_params = list(shape = ..., rate = ...).

Value

A GammaDistribution 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_genpareto(), dist_lognormal(), dist_mixture(), dist_negbinomial(), dist_normal(), dist_pareto(), dist_poisson(), dist_translate(), dist_trunc(), dist_uniform(), dist_weibull()

Examples

alpha <- 2
beta <- 2

d_gamma <- dist_gamma(shape = alpha, rate = beta)
x <- d_gamma$sample(100)
d_emp <- dist_empirical(x, positive = TRUE)

plot_distributions(
  empirical = d_emp,
  theoretical = d_gamma,
  estimated = d_gamma,
  with_params = list(
    estimated = inflate_params(
      fitdistrplus::fitdist(x, distr = "gamma")$estimate
    )
  ),
  .x = seq(1e-3, max(x), length.out = 100)
)


[Package reservr version 0.0.3 Index]