Created
April 23, 2018 23:20
-
-
Save kohske/03cd30a1ef1c9a7d065bdcd25f943708 to your computer and use it in GitHub Desktop.
dist of mean of dist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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