<< Chapter < Page | Chapter >> Page > |
ipoisson.m Poisson distribution — individual terms. As in the case of the
binomial distribution, we have an m-function for the individualterms and one for the cumulative case. The m-functions
ipoisson and
cpoisson use
a computational strategy similar to that used for the binomial case. Not only does this workfor large
μ , but the precision is at least as good as that for the binomial
m-functions. Experience indicates that the m-functions are good for
$\mu \le 700$ . They
breaks down at about 710, largely because of limitations of the MATLAB exponentialfunction.
For individual terms,
function y = ipoisson(mu,k)
calculates the probabilities
for
$mu$ a positive integer,
k a row or column vector of nonnegative integers. The output is a row vector of the corresponding Poisson probabilities.
function y = ipoisson(mu,k)
% IPOISSON y = ipoisson(mu,k) Individual Poisson probabilities% Version of 10/15/93
% mu = mean value% k may be a row or column vector of integer values
% y = P(X = k) (a row vector of probabilities)K = max(k);
p = exp(-mu)*cumprod([1 mu*ones(1,K)]./[1 1:K]);y = p(k+1);
cpoisson.m Poisson distribution—cumulative terms.
function y = cpoisson(mu,k)
, calculates
$P(X\ge k)$ , where
k may be a row or a
column vector of nonnegative integers. The output is a row vector of the corresponding probabilities.
function y = cpoisson(mu,k)
% CPOISSON y = cpoisson(mu,k) Cumulative Poisson probabilities% Version of 10/15/93
% mu = mean value mu% k may be a row or column vector of integer values
% y = P(X>= k) (a row vector of probabilities)
K = max(k);p = exp(-mu)*cumprod([1 mu*ones(1,K)]./[1 1:K]);
pc = [1 1 - cumsum(p)];
y = pc(k+1);
nbinom.m Negative binomial —
function y = nbinom(m, p, k)
calculates the probability that the
m th success in a Bernoulli sequence occurs on the
k th trial.
function y = nbinom(m, p, k)
% NBINOM y = nbinom(m, p, k) Negative binomial probabilities% Version of 12/10/92
% Probability the mth success occurs on the kth trial% m a positive integer; p a probability
% k a matrix of integers greater than or equal to m% y = P(X=k) (a matrix of the same dimensions as k)
q = 1 - p;y = ((p^m)/gamma(m)).*(q.^(k - m)).*gamma(k)./gamma(k - m + 1);
gaussian.m
function y = gaussian(m, v, t)
calculates the Gaussian (Normal)
distribution function for mean value
m , variance
v , and matrix
t of values.
The result
$y=P(X\le t)$ is a matrix of the same dimensions as
t .
function y = gaussian(m,v,t)
% GAUSSIAN y = gaussian(m,v,t) Gaussian distribution function% Version of 11/18/92
% Distribution function for X ~ N(m, v)% m = mean, v = variance
% t is a matrix of evaluation points% y = P(X<=t) (a matrix of the same dimensions as t)
u = (t - m)./sqrt(2*v);if u>= 0
y = 0.5*(erf(u) + 1);else
y = 0.5*erfc(-u);end
gaussdensity.m
function y = gaussdensity(m,v,t)
calculates the
Gaussian density function
${f}_{X}\left(t\right)$ for mean value
m , variance
t , and matrix
t of values.
function y = gaussdensity(m,v,t)
% GAUSSDENSITY y = gaussdensity(m,v,t) Gaussian density% Version of 2/8/96
% m = mean, v = variance% t is a matrix of evaluation points
y = exp(-((t-m).^2)/(2*v))/sqrt(v*2*pi);
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?