[Return to Sta113 Home]

STA113: Lab 5 (Friday, 15 October, 2004)



The Central Limit Theorem demonstrated on a uniform population

In Lab 4 we learned to do so several different kinds of simulations in MatLab. Then in class you saw how simulations in MatLab can be used to demonstrate the Central Limit Theorem. In this lab you will write your own simulations to deomstrate your understanding of the Central Limit Theorem, and will write a short report about what you learned.

Below is the code used in class for the demonstration of the Central Limit Theorem.


m=1; n=1000;
y=unifrnd(0,1,n,m); % draw random samples from Unif(0,1)
subplot(2,2,1);
histadjusted(y,32);
set(gca, 'XLim', [-0.05,1.05]);

m=2; 
subplot(2,2,2);
y=unifrnd(0,1,n,m);
histadjusted(mean(y,2),32);
set(gca, 'XLim', [-0.05,1.05]);

m=3;subplot(2,2,3)
% The same thing is now done as before.

m=5; subplot(2,2,4);
y=unifrnd(0,1,n,m);
histadjusted(mean(y,2),32);
set(gca, 'XLim', [-0.05,1.05]);
legend('sample size=5');
% The legend can, of course, be put on any of the graphs.

[umean, uvar]=unifstat(0,1);
% (umean, uvar) are the mean and variance of Unif(0,1)
hold on;
x=(0:50)./50;
h=plot(x, normpdf(x, umean, sqrt(uvar/m)));
set(h, 'color', [1 0 0]); % draw a red normal density curve
hold off;

% This was not done in class, but you might of course
% also examine the normality by making a normal probability
% plot:
qqplot(mean(y,2));


Assignment (due 22 October)

Complete the tasks described below and write a short (at most three pages, including graphs) report explaining what you've done and what it demonstrates.

The tasks
  1. Let X be the duration of a telephone call to the Durham Public Library. Suppose, as some studies have suggested is often the case, that X has an exponential distribution. Suppose further that X has a mean duration of two minutes.

  2. Simulate 5000 phone calls' durations and make a histogram of them. The MatLab command for simulating from an exponential distribution is exprnd.

  3. Suppose you were to take averages of X's in sets of four. That is, you take random samples of four independent phone calls and average their durations together. Simulate 5000 such sample averages and make a histogram of them.

  4. Repeat the above for samples of sizes 9 and size 100.

  5. For the histogram of sample means of sample size 100, superimpose an appropriate normal pdf on the graph.

  6. Make normal probability plots for each of the four simulation results above.

  7. For each of the four simulations, find the mean and standard deviation of the sample means. What appears to be the relationship between sample size and the mean of the sample means? Between sample size and the standard deviation of the sample means?