Distributions
Daniel D. Warner
June 7, 1999
Normal Distribution
The Normal Probability Density
The normal probability density is given by
,
where
.
> Npd := (x,sigma,mu) -> (1/(sigma*sqrt(2*Pi)))*exp(-((x-mu)/(sigma*sqrt(2)))^2);
> Digits := 20;
> sigma := 2; mu := 35;
> evalf(Npd(36,sigma,mu));
> plot(Npd(x,sigma,mu),x=mu-3*sigma..mu+3*sigma);
The Normal Probability Distribution
The Normal Probability Distribution,
, is given by
,
where
is the lower boundary and
is the upper boundary.
> sigma := 'sigma'; mu := 'mu';
> Ncd := (a,b,sigma,mu) -> int(Npd(x,sigma,mu),x=a..b);
> evalf(Ncd(-10^99,36,2,35));
> Ncd2 := (a,b,sigma,mu) -> (1/2)*(erf((b-mu)/(sigma*sqrt(2))) - erf((a-mu)/(sigma*sqrt(2))));
> p2 := evalf(Ncd2(-10^99,36,2,35));
> plot(Ncd2(-10^99,b,2,35),b=29..41);
The Inverse Cumulative Normal Distribution
The Inverse Cumulative Normal Probability Distribution finds
given
,
> InvN := (p,sigma,mu) -> solve(Ncd2(-infinity,x,sigma,mu)=p,x);
> InvN(1/2,1,0);
> evalf(%);
> InvN(p2,2,35);
Student-t Distribution
Student-t Probability Density
The Student-t Probability Density,
, is given by
,
> Tpd := (x,df) -> (GAMMA((df+1)/2)/GAMMA(df/2))*(1+x^2/df)^(-(df+1)/2)/sqrt(Pi*df);
> Tpd(1,2);
> evalf(%);
> plot(Tpd(x,2),x=-4..4);
Student-t Cumulative Distribution
The Student-t Probability Distribution,
, is given by
,
where
is the lower boundary and
is the upper boundary.
> Tcd := (a,b,df) -> (GAMMA((df+1)/2)/GAMMA(df/2))*int((1+x^2/df)^(-(df+1)/2)/sqrt(Pi*df),x=a..b);
> Tcd(-2,3,18);
> evalf(%);
> evalf(Tcd(0,2.160,13));
Chi-square Distribution
Probability Distribution
The
Probability density,
, is given by
,
> Cpd := (x,df) -> ((1/2)^(df/2)/GAMMA(df/2))*(x^(df/2-1)*exp(-x/2));
> Cpd(1,3);
> evalf(%);
> plot(Cpd(x,3),x=0..6);
Probability Distribution
The
Probability distribution,
is given by
,
where
is the lower boundary and
is the upper boundary.
> Ccd := (a,b,df) -> (((1/2)^(df/2))/GAMMA(df/2))*int((x^(df/2-1)*exp(-x/2)),x=a..b);
> Ccd(0,19.023,9);
> evalf(%);
> plot(Ccd(0,b,9),b=0..25);
Distribution
Probability Density
The
probibility density is given by
> Fpd := (x,n, d) -> GAMMA((n+d)/2)/(GAMMA(n/2)*GAMMA(d/2)) * (n/d)^(n/2)*x^(n/2-1) * (1+n*x/d)^(-(n+d)/2);
> Fpd(1,24,19);
> evalf(%);
Probability Distribution
The
probability distribution is given by
,
where
is the lower boundary.and
is the upper boundary.
> Fcd := (a,b,n, d) -> GAMMA((n+d)/2)/(GAMMA(n/2)*GAMMA(d/2)) * (n/d)^(n/2)*int(x^(n/2-1) * (1+n*x/d)^(-(n+d)/2),x=a..b);
> Fcd(0,1.9824,19,16);
> evalf(%);
Binomial Probability
Binomial Probability Density
The Binomial probability density is given by
where (
, 2, 3, ...),
is the probability of success and
is the number of trials.
> Bpd := (x,n,p) -> binomial(n,x)*p^x*(1-p)^(n-x);
> Bpd(10,15,6/10);
> evalf(%);
> Bpd(11,15,6/10);
> evalf(%);
> Bpd(12,15,6/10);
> evalf(%);
> Bpd(13,15,6/10);
> evalf(%);
> Bpd(14,15,6/10);
> evalf(%);
Binomial Probability Distribution
The Poisson probability distribution is given by
where (
, 1, 2, ...),
is the probability of success and
is the number of trials.
> Bcd := (x,n,p) -> sum(binomial(n,k)*p^k*(1-p)^(n-k),k=0..x);
> Bcd(10,15,6/10);
> evalf(%);
> Bcd(11,15,6/10);
> evalf(%);
> Bcd(12,15,6/10);
> evalf(%);
> Bcd(13,15,6/10);
> evalf(%);
> Bcd(14,15,6/10);
> evalf(%);
Poisson Probability
Poisson Probability Density
The Poisson probability density is given by
where (
, 2, 3, ...),
and
is the population mean.
> Ppd := (x,mu) -> exp(-mu)*mu^x/x!;
> Ppd(2,6);
> evalf(%);
> Ppd(3,6);
> evalf(%);
> Ppd(4,6);
> evalf(%);
Poisson Probability Distribution
The Poisson probability distribution is given by
where (
, 2, 3, ...), and
is the population mean.
> Pcd := (x,mu) -> sum(exp(-mu)*mu^t/t!,t=0..x);
> Pcd(2,6);
> evalf(%);
> Pcd(3,6);
> evalf(%);
> Pcd(4,6);
> evalf(%);
Geometric Probability
Geometric Probability Density
The Geometric probability density is given by
where (
, 2, 3, ...).
> Gpd := (x,p) -> p*(1-p)^(x-1);
> Gpd(3,4/10);
> evalf(%);
> Gpd(4,4/10);
> evalf(%);
> Gpd(5,4/10);
> evalf(%);
Geometric Probability Distribution
The Geometric probability density is given by
where (
, 2, 3, ...).
> Gcdc := (x,p) -> sum(p*(1-p)^(k-1),k=1..x);
> Gcdc(2,5/10);
> evalf(%);
> Gcdc(3,5/10);
> evalf(%);
> Gcdc(4,5/10);
> evalf(%);