Page 144 - Computational Statistics Handbook with MATLAB
P. 144
Chapter 5: Exploratory Data Analysis 131
B
A
B
E
L
T
TA AB BL LE L E 5.2 5.2
T
A
T
5.2
5.2
E
Frequency Distribution for the Number of Females in a
Queue of Size 10 [Hoaglin and Tukey, 1985]
Number of Females Number of Blocks
k () ( n k )
0 1
1 3
2 4
3 23
4 25
5 19
6 18
7 5
8 1
9 1
10 0
k = 0:9;
n = 10;
n_k = [1 3 4 23 25 19 18 5 1 1];
N = sum(n_k);
nCk = zeros(size(k));
for i = k
nCk(i+1) = cscomb(n,i);
end
phat = n_k/N;
nkstar = n_k-0.67-0.8*phat;
% Find the frequencies that are 1; nkstar=1/e.
ind1 = find(n_k==1);
nkstar(ind1) = 1/2.718;
% Get phi(n_k) for plotting.
phik = log(nkstar./(N*nCk));
% Find the counts that are equal to 1.
ind = find(n_k~=1);
plot(k(ind),phik(ind),'o')
if ~isempty(ind1)
text(k(ind1),phik(ind1),'1')
end
% Add some whitespace to see better.
axis([-0.5 max(k)+1 min(phik)-1 max(phik)+1])
xlabel('Number of Females - k')
ylabel('\phi (n^*_k)')
© 2002 by Chapman & Hall/CRC