Skip to contents

Usage

dist_exponential(rate = NULL)

Arguments

rate

Scalar rate parameter, or NULL as a placeholder.

Value

An ExponentialDistribution object.

Details

The parameter can be overridden with with_params = list(rate = ...).

Examples

rate <- 1
d_exp <- dist_exponential()
x <- d_exp$sample(20, with_params = list(rate = rate))
d_emp <- dist_empirical(x, positive = TRUE)

plot_distributions(
  empirical = d_emp,
  theoretical = d_exp,
  estimated = d_exp,
  with_params = list(
    theoretical = list(rate = rate),
    estimated = list(rate = 1 / mean(x))
  ),
  .x = seq(1e-4, 5, length.out = 100)
)
#> Warning: Removed 52 rows containing missing values (`geom_line()`).