The Exponential Distribution

Probability Density Function

Define the Probability Density Function (PDF) of the random variable X by entering the function f(x) along with the lowest and highest x-values it supports.

In[199]:=

Begin["ExponentialProperties`"] ;

lowsupport = 0 ;

highsupport = ∞ ;

λ = 5 ;

f[x_, λ_] := λ ^(-λ x)

Property 1:  Ensure f(x) 0 for all x by plotting it.

In[205]:=

Plot[f[x, λ], {x, 0, 1.5}, PlotRange→ {0, 1.1 λ}] ;

[Graphics:../HTMLFiles/index_374.gif]

Property 2:  Ensure f(x) integrates to exactly 1 over the random variable's support.

In[206]:=

∫_lowsupport^highsupport f[x, λ] x

Out[206]=

1

Property 3:  P(X = c) = 0, or the probability assigned to any particular value c is zero.

Property 4:  Create the Cumulative Distribution Function (CDF).

In[231]:=

F[x_, λ_] = ∫_lowsupport^x f[y, λ] y         

Out[231]=

1 - ^(-5 x)

Plot the CDF.

In[233]:=

Plot[F[x, λ], {x, 0, 1.5}, PlotRange→ {0, 1}] ;

[Graphics:../HTMLFiles/index_380.gif]

Property 5:  Use the PDF to compute probability, where a and b are the lower and upper bounds of the interval of interest.

In[234]:=

a = 1 ;

b = 2 ;

PDFProb = ∫_a^b f[x, λ] x ;

Print["P(", a, " ≤ X ≤ ", b, ") = ", N[PDFProb]]

P(1 ≤ X ≤ 2) = 0.00669255

Property 6:  Use the CDF to compute probability.

In[238]:=

Off[General :: spell1]

CDFProb = F[b, λ] - F[a, λ] ;

On[General :: spell1]

Print["P(", a, " ≤ X ≤ ", b, ") = ", N[CDFProb]]

P(1 ≤ X ≤ 2) = 0.00669255

Property 7:  Compute the Expected Value.

In[242]:=

ExpValue = ∫_lowsupport^highsupport x * f[x, λ] x         

Out[242]=

1/5

In[243]:=

N[ExpValue]

Out[243]=

0.2

Using similar methods, we find that the expected value is

In[244]:=

1/λ

Out[244]=

1/5

Property 8:  Compute the Variance/Standard Deviation.

In[245]:=

Var = ∫_lowsupport^highsupport (x - ExpValue)^2 f[x, λ] x   

Out[245]=

1/25

In[246]:=

N[Var^(1/2)]

Out[246]=

0.2

In[247]:=

(* Alternatively *)∫_lowsupport^highsupport x^2 f[x, λ] x - ExpValue^2

Out[247]=

1/25

Finally, the formula for the variance is

In[248]:=

1/λ^2

Out[248]=

1/25

In[249]:=

                   StdDev = Var^(1/2)

Out[249]=

1/5

Property 9:  Use the CDF to find a percentile.

NOTE: "ExpValue" simply specifies a starting value for the "FindRoot" search.  For the Weibull, the expected value is a reasonable starting point for most percentiles.

In[250]:=

p = .90 ;

FindRoot[F[xstar, λ] == p, {xstar, ExpValue}]

Out[251]=

{xstar→0.460517}

In[252]:=

End[]

Out[252]=

ExponentialProperties`


Created by Mathematica  (July 20, 2006) Valid XHTML 1.1!