Properties of the Distribution
Calculation of Mean, Variance, and Moment Generating Function
Calculating E( X ), the expectation or mean of the Geometric( p ) distribution.
> restart;
> with(plots, display):
> f:=x->GeometricPDF(p,x);
> EX:=simplify(sum(x*f(x),x=1..infinity));
Calculating Var( X ), the variance of the Geometric( p ) distribution.
We will employ the formula: Var( X ) = E( ) -
> E_X_SQ:=simplify(sum(x^2*f(x),x=1..infinity));
> VarX:=simplify(E_X_SQ-EX^2);
The Moment Generating Function (MGF) can be easily calculated via Maple.
Recall the moment generating function of a random variable X is defined
as M ( t ) = E( ), provided this expectation exists.
> simplify(sum(exp(t*x)*f(x),x=1..infinity));
So the moment generating function for a Geometric( p ) random variable
is given by
M ( t ) =
We will define M ( t ) as a function of t .
> M:=t->exp(t)*p/(1-exp(t)+exp(t)*p);
The moment generating function provides us alternative ways to calculate the
mean and variance by way of the formula.
(0) = E( ) , where ( t ) denotes the r th derivative of M ( t ) with respect to t .
This formula holds as long as M ( t ) exists in an open interval containing zero.
See, for example, Mathematical Statistics and Data Analysis by John A. Rice for
more on the moment generating function.
> M_p:=diff(M(t),t);
> simplify(M_p);
> simplify(subs(t=0,M_p));
And therefore if X is a Geometric( p ) variable, then E( X ) = 1/ p , which agrees with
what we found earlier. Now turning to the second moment.
> M_pp:=diff(M_p,t);
> simplify(subs(t=0,M_pp));
>
Therefore E( ) = , which again is in agreement with the value
calculated previously. The variance is now quickly calculated as
Var( X ) = E( ) -
=
= .