set.seed(2020.06)
n <- 36
mu.true <- 10
sig.true <- 2
x <- rnorm(n, mean = mu.true, sd = sig.true)
dt <- tibble(id = 1:n, x = x)
# head(dt)
p1_normpdf <- dt %>%
ggplot(aes(x = x, y = ..density..)) + geom_histogram(colour = "blue", fill = "blue", alpha = 0.2) + geom_density(colour = "blue", fill = "blue", alpha = 0.2) + ggtitle("Histogram of n=36 draws simulated from N(10,4)") + xlab("simulated draws") + theme_bw()
p1_normpdf
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.