d_discrete <- dist_discrete(probs = list(0.5, 0.25, 0.15, 0.1))
x <- d_discrete$sample(100)
d_emp <- dist_empirical(x)
plot_distributions(
empirical = d_emp,
theoretical = d_discrete,
estimated = d_discrete,
with_params = list(
estimated = list(
size = max(x),
probs = as.list(unname(table(x)) / 100)
)
),
.x = 0:max(x)
)
Run the code above in your browser using DataLab