To do each example, just click the "Submit" button.
You do not have to type in any R instructions (that's already done for you).
You do not have to select a dataset (that's already done for you).
If we have a random sample of size n from a normally distributed
population, we know the sampling distribution of the sample mean is
exactly normal with
E(sample mean) = population mean
and
sd(sample mean) = (population standard deviation) / sqrt(n)
The simulation below makes a random sample of size n from
a normal population and calculates the sample mean. It does this repeatedly
nsim times, thus obtaining a random sample from the
sampling distribution of the sample mean. The histogram of
sample mean values is plotted with a superimposed normal density curve
that is the theoretical sampling distribution of the sample mean.
If you increase the simulation size nsim
(the number of xbar values used to make the histogram),
the histogram gets closer and closer to the black theoretical curve
(the exact sampling distribution of the sample mean).
If we have a random sample of size n from a non-normally distributed
population, we know the sampling distribution of the sample mean is
not exactly normal, only approximately normal for large sample sizes,
but we do know the mean and sd are exactly
E(sample mean) = population mean
and
sd(sample mean) = (population standard deviation) / sqrt(n)
The simulation below makes a random sample of size n from
an exponential population and calculates the sample mean.
It does this repeatedly
nsim times, thus obtaining a random sample from the
sampling distribution of the sample mean. The histogram of
sample mean values is plotted with a superimposed non-normal density curve
that is the theoretical sampling distribution of the sample mean and the
normal density curve (red) that is the approximately sampling distribution
for large sample sizes.
If you increase the sample size n, the two
theoretical curves get closer and closer together.
If you increase the simulation size nsim
(the number of xbar values used to make the histogram),
the histogram gets closer and closer to the black theoretical curve
(the exact sampling distribution of the sample mean).
If we have a random sample of size n from a non-normally distributed
population, we know the sampling distribution of the sample mean is
not exactly normal, only approximately normal for large sample sizes,
but we do know the mean and sd are exactly
E(sample mean) = population mean
and
sd(sample mean) = (population standard deviation) / sqrt(n)
The simulation below makes a random sample of size n from
a bimodal skewed population and calculates the sample mean.
It does this repeatedly
nsim times, thus obtaining a random sample from the
sampling distribution of the sample mean. The histogram of
sample mean values is plotted with a superimposed non-normal density curve
that is the theoretical sampling distribution of the sample mean and the
normal density curve (red) that is the approximately sampling distribution
for large sample sizes.
If you increase the sample size n, the two
theoretical curves get closer and closer together.
If you increase the simulation size nsim
(the number of xbar values used to make the histogram),
the histogram gets closer and closer to the black theoretical curve
(the exact sampling distribution of the sample mean).
If you change the value of mu to any number between zero and one,
you make the population distribution more or less skewed.
mu <- 1 / 2 makes a symmetric bimodal population.
If you change the value of sigma.normal to any positive number,
you make the width of the peaks of the population wider or narrower.