View source: R/clt_illustrates.R
see_the_clt_for_Bernoulli | R Documentation |
Illustration of the CLT for samples from the Bernoulli distribution
see_the_clt_for_Bernoulli(nsize = 10, nrep = 10000, prob = 0.8)
nsize |
Sample size, n. Its default value is 10. |
nrep |
Number of replications. How many samples of size |
prob |
True probability of success for the Bernoulli trials |
A vector of means of the replicated samples. It also has the side effect of drawing a histogram of the standardized sample means and a superimposed density function of the standard normal distribution. The better the CLT approximation, the closer are the superimposed density and the histogram.
a <- see_the_clt_for_Bernoulli()
old.par <- par(no.readonly = TRUE)
par(mfrow=c(2, 3))
a30 <- see_the_clt_for_Bernoulli(nsize=30)
a50 <- see_the_clt_for_Bernoulli(nsize=50)
a100 <- see_the_clt_for_Bernoulli(nsize=100)
a500 <- see_the_clt_for_Bernoulli(nsize=500)
a1000 <- see_the_clt_for_Bernoulli(nsize=1000)
a5000 <- see_the_clt_for_Bernoulli(nsize=5000)
par(old.par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.