<< Chapter < Page Chapter >> Page >

Matlab calculation for example 3

X = [2 2.5 3 3.5]; % Matrix of values (ordered)PX = 0.1*[2 2 3 3]; % Matrix of probabilitiesEX = dot(X,PX) % The usual MATLAB operation EX = 2.8500Ex = sum(X.*PX) % An alternate calculation Ex = 2.8500ex = X*PX' % Another alternate ex = 2.8500
Got questions? Get instant answers now!

Expectation and primitive form

The definition and treatment above assumes X is in canonical form , in which case

X = i = 1 n t i I A i , where A i = { X = t i } , implies E [ X ] = i = 1 n t i P ( A i )

We wish to ease this restriction to canonical form.

Suppose simple random variable X is in a primitive form

X = j = 1 m c j I C j , where { C j : 1 j m } is a partition

We show that

E [ X ] = j = 1 m c j P ( C j )

Before a formal verification, we begin with an example which exhibits the essential pattern. Establishing the general case is simply a matter of appropriate use of notation.

Simple random variable X In primitive form

X = I C 1 + 2 I C 2 + I C 3 + 3 I C 4 + 2 I C 5 + 2 I C 6 , with { C 1 , C 2 , C 3 , C 4 , C 5 . C 6 } a partition

Inspection shows the distinct possible values of X to be 1, 2, or 3. Also,

A 1 = { X = 1 } = C 1 C 3 , A 2 = { X = 2 } = C 2 C 5 C 6 and A 3 = { X = 3 } = C 4

so that

P ( A 1 ) = P ( C 1 ) + P ( C 3 ) , P ( A 2 ) = P ( C 2 ) + P ( C 5 ) + P ( C 6 ) , and P ( A 3 ) = P ( C 4 )

Now

E [ X ] = P ( A 1 ) + 2 P ( A 2 ) + 3 P ( A 3 ) = P ( C 1 ) + P ( C 3 ) + 2 [ P ( C 2 ) + P ( C 5 ) + P ( C 6 ) ] + 3 P ( C 4 )
= P ( C 1 ) + 2 P ( C 2 ) + P ( C 3 ) + 3 P ( C 4 ) + 2 P ( C 5 ) + 2 P ( C 6 )
Got questions? Get instant answers now!

To establish the general pattern, consider X = j = 1 m c j I C j . We identify the distinct set of values containedin the set { c j : 1 j m } . Suppose these are t 1 < t 2 < < t n . For any value t i in the range, identify the index set J i of those j such that c j = t i . Then the terms

J i c j I C j = t i J i I C j = t i I A i , where A i = j J i C j

By the additivity of probability

P ( A i ) = P ( X = t i ) = j J i P ( C j )

Since for each j J i we have c j = t i , we have

E [ X ] = i = 1 n t i P ( A i ) = i = 1 n t i j J i P ( C j ) = i = 1 n j J i c j P ( C j ) = j = 1 m c j P ( C j )

Thus, the defining expression for expectation thus holds for X in a primitive form .

An alternate approach to obtaining the expectation from a primitive form is to use the csort operation to determine the distribution of X from the coefficients and probabilities of the primitive form.

Alternate determinations of E [ X ]

Suppose X in a primitive form is

X = I C 1 + 2 I C 2 + I C 3 + 3 I C 4 + 2 I C 5 + 2 I C 6 + I C 7 + 3 I C 8 + 2 I C 9 + I C 10

with respective probabilities

P ( C i ) = 0 . 08 , 0 . 11 , 0 . 06 , 0 . 13 , 0 . 05 , 0 . 08 , 0 . 12 , 0 . 07 , 0 . 14 , 0 . 16
c = [1 2 1 3 2 2 1 3 2 1]; % Matrix of coefficientspc = 0.01*[8 11 6 13 5 8 12 7 14 16]; % Matrix of probabilitiesEX = c*pc' EX = 1.7800 % Direct solution[X,PX] = csort(c,pc); % Determination of dbn for Xdisp([X;PX]')1.0000 0.4200 2.0000 0.38003.0000 0.2000 Ex = X*PX' % E[X]from distribution Ex = 1.7800
Got questions? Get instant answers now!

Linearity

The result on primitive forms may be used to establish the linearity of mathematical expectation for simple random variables. Because of its fundamental importance, we work throughthe verification in some detail.

Suppose X = i = 1 n t i I A i and Y = j = 1 m u j I B j (both in canonical form). Since

i = 1 n I A i = j = 1 m I B j = 1

we have

X + Y = i = 1 n t i I A i j = 1 m I B j + j = 1 m u j I B j i = 1 n I A i = i = 1 n j = 1 m ( t i + u j ) I A i I B j

Note that I A i I B j = I A i B j and A i B j = { X = t i , Y = u j } . The class of these sets for all possible pairs ( i , j ) forms a partition. Thus, the last summation expresses Z = X + Y in a primitive form. Because of the result on primitive forms, above, we have

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

Ask