Properties of the Distribution

Calculation of Mean, Variance, and Moment Generating Function

To calculate the mean of the Normal distribution, we can simply integrate x *(NormalPDF), per the definition of mathematical expectation.

> restart;

> with(plots, display):

> interface(showassumed=0):

> assume(sigma > 0);

> f(x):=NormalPDF(mu,sigma^2,x);

[Maple Math]

> EX:=int(x*f(x),x=-infinity..infinity);

[Maple Math]

Calculating Var( X ), the variance of the Normal( [Maple Math] , [Maple Math] ) distribution. We will employ the formula: Var( X ) = E( [Maple Math] ) - [Maple Math]

> E_X_SQ:=int((x^2)*f(x),x=-infinity..infinity);

[Maple Math]

> VarX:=simplify(E_X_SQ-EX^2);

[Maple Math]

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( [Maple Math] ), provided this expectation exists.

> int(exp(t*x)*f(x),x=-infinity..infinity);

[Maple Math]

So the moment generating function for a Normal( [Maple Math] , [Maple Math] ) random variable is given by

M ( t ) = [Maple Math]

We will define M ( t ) as a function of t .

> restart; with(plots):

> M(t):=exp(mu*t+(sigma^2*t^2)/2);

[Maple Math]

The moment generating function provides us with alternative ways to calculate the mean and variance by way of the formula.

[Maple Math] (0) = E( [Maple Math] ) , where [Maple Math] ( 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. Looking at the first derviative, we find:

> M_p:=diff(M(t),t);

[Maple Math]

> simplify(M_p);

[Maple Math]

> simplify(subs(t=0,M_p));

[Maple Math]

This agrees with our previous result, [Maple Math] . Turning to the second derivative, we find:

> M_pp:=diff(M_p,t);

[Maple Math]

> simplify(subs(t=0,M_pp));

[Maple Math]

Therefore E( [Maple Math] ) = [Maple Math] , which again is in agreement with the value

calculated previously. The variance is now quickly calculated as

Var( X ) = E( [Maple Math] ) - [Maple Math]

= [Maple Math]

= [Maple Math]