<< Chapter < Page | Chapter >> Page > |
bincomp.m Graphical comparison of the binomial, Poisson, and Gaussian distributions. The procedure calls for binomial parameters , determines a reasonable range of evaluation points and plots on the same graph the binomial distribution function, thePoisson distribution function, and the gaussian distribution function with the adjustment called the “continuity correction.”
% BINCOMP file bincomp.m Approx of binomial by Poisson and gaussian
% Version of 5/24/96% Gaussian adjusted for "continuity correction"
% Plots distribution functions for specified parameters n, pn = input('Enter the parameter n ');
p = input('Enter the parameter p ');a = floor(n*p-2*sqrt(n*p));
a = max(a,1); % Prevents zero or negative indicesb = floor(n*p+2*sqrt(n*p));
k = a:b;Fb = cumsum(ibinom(n,p,0:n)); % Binomial distribution function
Fp = cumsum(ipoisson(n*p,0:n)); % Poisson distribution functionFg = gaussian(n*p,n*p*(1 - p),k+0.5); % Gaussian distribution function
stairs(k,Fb(k+1)) % Plotting detailshold on
plot(k,Fp(k+1),'-.',k,Fg,'o')hold off
xlabel('t values') % Graph labeling detailsylabel('Distribution function')
title('Approximation of Binomial by Poisson and Gaussian')grid
legend('Binomial','Poisson','Adjusted Gaussian')disp('See Figure for results')
poissapp.m Graphical comparison of the Poisson and Gaussian distributions. The procedure calls for a value of the Poisson parameter mu, then calculates and plots the Poissondistribution function, the Gaussian distribution function, and the adjusted Gaussian distribution function.
% POISSAPP file poissapp.m Comparison of Poisson and gaussian
% Version of 5/24/96% Plots distribution functions for specified parameter mu
mu = input('Enter the parameter mu ');n = floor(1.5*mu);
k = floor(mu-2*sqrt(mu)):floor(mu+2*sqrt(mu));FP = cumsum(ipoisson(mu,0:n));
FG = gaussian(mu,mu,k);FC = gaussian(mu,mu,k-0.5);
stairs(k,FP(k))hold on
plot(k,FG,'-.',k,FC,'o')hold off
gridxlabel('t values')
ylabel('Distribution function')title('Gaussian Approximation to Poisson Distribution')
legend('Poisson','Gaussian','Adjusted Gaussian')disp('See Figure for results')
If a simple random variable X is in canonical form, the distribution consists of the coefficients of the indicator funtions (the values of X ) and the probabilities of the corresponding events. If X is in a primitive form other than canonical, the csort operation is applied to the coefficients of the indicator functions and the probabilities of the corresponding events to obtainthe distribution. If and X is in a primitive form, then the value of Z on the event in the partition associated with t i is . The distribution for Z is obtained by applying csort to the and the p i . Similarly, if and the joint distribution is available, the value is associated with . The distribution for Z is obtained by applying csort to the matrix of values and the corresponding matrix of probabilities.
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?