Skip to contents

Usage

dist_lognormal(meanlog = NULL, sdlog = NULL)

Arguments

meanlog

Scalar mean parameter on the log scale, or NULL as a placeholder.

sdlog

Scalar standard deviation parameter on the log scale, or NULL as a placeholder.

Value

A LognormalDistribution object.

Details

Both parameters can be overridden with with_params = list(meanlog = ..., sdlog = ...).

Examples

mu <- 0
sigma <- 1

d_lnorm <- dist_lognormal(meanlog = mu, sdlog = sigma)
x <- d_lnorm$sample(20)
d_emp <- dist_empirical(x, positive = TRUE)

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