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)
)
Run the code above in your browser using DataLab