Chapter 2: binomial and negative binomial multiplicity plots
Chapter 2: binomial and negative binomial multiplicity plots
The plots shown in the upper panels of Fig 2.4 are binomial and negative binomial multiplicities. Each of these requires us to compute factorials, which are defined as:
N!= factorial(N) = N x (N-1) x (N-2) x ... x 1
The binomial multiplicity is written:
% Mb=nchoosek(N,S)
n=20; for k=0:n, Mb(k+1)=nchoosek(n,k); end %binomial multiplicity
figure; clf; subplot(2,1,1); hold on; box off
plot(0:n,Mb,'k--');
stem(0:n,Mb,'ko','MarkerFaceColor','k','MarkerSize',11)
The negative binomial multiplicity is:
k=3; for n=1:20,
if n<k, Mnb(n)=0; else Mnb(n)=nchoosek(n-1,k-1); end, end %neg bin multiplicity
subplot(2,1,2); hold on; box off
plot(1:n,Mnb,'k--');
stem(1:n,Mnb,'ko','MarkerFaceColor','k','MarkerSize',11)
where the factorials are computed in the nchoosek function. Notice that the negative binomial uses a constant number of successes (S=3) and the binomial a constant number of trials (N=20).