mu <- 0
sigma <- 1
d_norm <- dist_normal(mean = mu, sd = sigma)
x <- d_norm$sample(20)
d_emp <- dist_empirical(x)
plot_distributions(
empirical = d_emp,
theoretical = d_norm,
estimated = d_norm,
with_params = list(
estimated = list(mean = mean(x), sd = sd(x))
),
.x = seq(-3, 3, length.out = 100)
)
Run the code above in your browser using DataLab