Skip to content

Instantly share code, notes, and snippets.

@kohske
Created April 23, 2018 23:20
dist of mean of dist
R=10000; N=1000
xm = numeric(R)
for (i in 1:R) {
#好きなように
xm[i] = mean(rlnorm(N))
# xm[i] = mean(rexp(N))
# xm[i] = mean(runif(N))
}
hist(xm, breaks = 100, probability = TRUE)
library(MASS)
fit = fitdistr(xm, densfun = "normal")
curve(dnorm(x, fit$estimate[1], fit$estimate[2]), add = TRUE, col = "red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment