Monte Carlo: Simulating Sampling Distributions
This very nice applet is now blocked by both browsers and Java. Even if you modify Java, adding this site to the exception list, it still blocks it. Java no longer allows you to lower security to medium. Java does not want you to learn about sampling distributions.
I prefer to do this with SAS, but there is a useful applet at the Online Psychology Laboratory. that makes it much easier to do (but gives you less control). Go there, read the instructions, and then click on Begin. /You may find that your computer blocks the Java applet from running. If so, you must change your security settings. Go to the Control Panel and select Java. Change the security setting to Medium, Apply, OK. After you have finished with the app, set the security back to High or Very High. /
Your browser may give you a security warning. Click Run. /
First, obtain the sampling distribution for the mean and variance of a normal distribution when N = 2 scores in each sample. What the applet is going to do is create 10,000 random samples, each with two scores, drawn from a normally distributed population. Then it will compute the mean and the variance for each sample. Then it will, for each of resulting two sampling distributions, give you some basic statistics and a plot of the sampling distribution.
The parent population here is normal with mean 16, variance 25.Set the sample size to 2, ask for distributions of the sample means and the sample variances [Var(U)] and check “Fit normal.” Then click on “10,000.”
Look at the distribution of means. The shape of the distribution closely approximates that of the superimposed normal distribution and, as expected, the mean of the means is nearly equal to the population mean (it would be exactly equal if we ran many more replications). The sample mean is an unbiased estimator. /
You should expect the standard deviation of the distribution of sample means to be Your simulated standard error should be close to this.
Now look at the distribution of the sample variances. The mean of the 10,000 sample variances will be nearly equal to the population variance -- the sample variance is an unbiased estimator. Notice, however, that it is very skewed. The median is much lower than the mean; over half of the sample variances are less than the population variance.
Now change the statistic for the lower plot from Var(U) to Variance. Var(U) is the sample variance, with (N-1) in the denominator. For “Variance” the denominator is N. Click on 10,000 again. You will observe that the mean of the sampling distribution is now very far from the population variance. As I noted early in the semester, reducing N by one is necessary if you want to have an unbiased estimator of the population variance.
Switch back to the unbiased estimator and change the sample size to 25. Click 10,000 again.
Notice that the standard errors, for both the mean and the sample variance, have dropped with the increase in sample size – both are consistent estimators.Also notice that the shape of the distribution of sample variances is approaching that of the normal distribution.
I encourage you to use this applet to play with other statistics and other characteristics – for example, investigate the effect of shape of parent population and sample size. On the next page I have simulated the sampling distributions of the mean and of the median. /
You already know that the median is more resistant to the influence of outlier than is the mean. You will find, however, that we shall employ the mean much more often than the median. Why? Look at the simulation results to the right. The standard error of the mean is 5/SQRT(25) = 1 and the standard error of the median is 1.27. That is, the mean is a more efficient estimator than is the median. Put another way, there is more error in the estimation of the median than there is in the estimation of the mean. /
This applet is also available at
Return to Wuensch’s Stats Lessons