# Connexions

You are here: Home » Content » Applied Probability » Variance

• Preface to Pfeiffer Applied Probability

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
• Rice Digital Scholarship

This collection is included in aLens by: Digital Scholarship at Rice University

Click the "Rice Digital Scholarship" link to see all content affiliated with them.

#### Also in these lenses

• UniqU content

This collection is included inLens: UniqU's lens
By: UniqU, LLC

Click the "UniqU content" link to see all content selected in this lens.

### Recently Viewed

This feature requires Javascript to be enabled.

Inside Collection:

Collection by: Paul E Pfeiffer. E-mail the author

# Variance

Module by: Paul E Pfeiffer. E-mail the author

Summary: The mean value locates the center of the probability mass distribution induced by X on the real line. In this unit, we examine how expectation may be used for further characterization of the distribution for X. In particular, we deal with the variance and its square root the standard deviation. We identify some important properties of variance and identify the concept covariance. The variance is calculated for several distributions, comparing analytical and Matlab results.

In the treatment of the mathematical expection of a real random variable X, we note that the mean value locates the center of the probability mass distribution induced by X on the real line. In this unit, we examine how expectation may be used for further characterization of the distribution for X. In particular, we deal with the concept of variance and its square root the standard deviation. In subsequent units, we show how it may be used to characterize the distribution for a pair {X,Y}{X,Y} considered jointly with the concepts covariance, and linear regression

## Variance

Location of the center of mass for a distribution is important, but provides limited information. Two markedly different random variables may have the same mean value. It would be helpful to have a measure of the spread of the probability mass about the mean. Among the possibilities, the variance and its square root, the standard deviation, have been found particularly useful.

Definition. The variance of a random variable X is the mean square of its variation about the mean value:

Var [ X ] = σ X 2 = E [ ( X - μ X ) 2 ] where μ X = E [ X ] Var [ X ] = σ X 2 = E [ ( X - μ X ) 2 ] where μ X = E [ X ]
(1)

The standard deviation for X is the positive square root σX of the variance.

### Remarks

• If X(ω)X(ω) is the observed value of X, its variation from the mean is X(ω)-μXX(ω)-μX. The variance is the probability weighted average of the square of these variations.
• The square of the error treats positive and negative variations alike, and it weights large variations more heavily than smaller ones.
• As in the case of mean value, the variance is a property of the distribution, rather than of the random variable.
• We show below that the standard deviation is a “natural” measure of the variation from the mean.
• In the treatment of mathematical expectation, we show that
E[(X-c)2]isaminimumiffc=E[X],inwhichcaseE(X-E[X])2=E[X2]-E2[X]E[(X-c)2]isaminimumiffc=E[X],inwhichcaseE(X-E[X])2=E[X2]-E2[X]
(2)
This shows that the mean value is the constant which best approximates the random variable, in the mean square sense.

Basic patterns for variance

Since variance is the expectation of a function of the random variable X, we utilize properties of expectation in computations. In addition, we find it expedient to identify several patterns for variance which are frequently useful in performing calculations. For one thing, while the variance is defined as E[(X-μX)2]E[(X-μX)2], this is usually not the most convenient form for computation. The result quoted above gives an alternate expression.

• (V1): Calculating formula. Var [X]=E[X2]-E2[X] Var [X]=E[X2]-E2[X].
• (V2): Shift property. Var [X+b]= Var [X] Var [X+b]= Var [X]. Adding a constant b to X shifts the distribution (hence its center of mass) by that amount. The variation of the shifted distribution about the shifted center of mass is the same as the variation of the original, unshifted distribution about the original center of mass.
• (V3): Change of scale. Var [aX]=a2 Var [X] Var [aX]=a2 Var [X]. Multiplication of X by constant a changes the scale by a factor |a||a|. The squares of the variations are multiplied by a2. So also is the mean of the squares of the variations.
• (V4): Linear combinations
1. Var [aX±bY]=a2 Var [X]+b2 Var [Y]±2abE[XY]-E[X]E[Y] Var [aX±bY]=a2 Var [X]+b2 Var [Y]±2abE[XY]-E[X]E[Y]
2. More generally,
Var k=1nakXk = k=1nak2 Var [Xk]+2i<jaiajE[XiXj]-E[Xi]E[Xj] Var k=1nakXk = k=1nak2 Var [Xk]+2i<jaiajE[XiXj]-E[Xi]E[Xj]
(3)
The term cij=E[XiXj]-E[Xi]E[Xj]cij=E[XiXj]-E[Xi]E[Xj] is the covariance of the pair {Xi,Xj}{Xi,Xj}, whose role we study in the unit on that topic. If the cijcij are all zero, we say the class is uncorrelated.

Remarks

• If the pair {X,Y}{X,Y} is independent, it is uncorrelated. The converse is not true, as examples in the next section show.
• If the ai=±1ai=±1 and all pairs are uncorrelated, then
Var k=1naiXi=k=1n Var [Xi] Var k=1naiXi=k=1n Var [Xi]
(4)
The variance add even if the coefficients are negative.

We calculate variances for some common distributions. Some details are omitted—usually details of algebraic manipulation or the straightforward evaluation of integrals. In some cases we use well known sums of infinite series or values of definite integrals. A number of pertinent facts are summarized in Appendix B. Some Mathematical Aids. The results below are included in the table in Appendix C.

Variances of some discrete distributions

1. Indicator function X = I E P ( E ) = p , q = 1 - p X = I E P ( E ) = p , q = 1 - p E [ X ] = p E [ X ] = p
E [ X 2 ] - E 2 [ X ] = E [ I E 2 ] - p 2 = E [ I E ] - p 2 = p - p 2 = p ( 1 - p ) = p q E [ X 2 ] - E 2 [ X ] = E [ I E 2 ] - p 2 = E [ I E ] - p 2 = p - p 2 = p ( 1 - p ) = p q
(5)
2. Simple random variableX=i=1ntiIAiX=i=1ntiIAi (primitive form) P(Ai)=piP(Ai)=pi.
Var [X]=i=1nti2piqi-2i<jtitjpipj,sinceE[IAiIAj]=0ij Var [X]=i=1nti2piqi-2i<jtitjpipj,sinceE[IAiIAj]=0ij
(6)
3. Binomial(n,p)(n,p). X=i=1nIEiwith{IEi:1in}iidP(Ei)=pX=i=1nIEiwith{IEi:1in}iidP(Ei)=p
Var [X]=i=1n Var [IEi]=i=1npq=npq Var [X]=i=1n Var [IEi]=i=1npq=npq
(7)
4. Geometric(p)(p). P(X=k)=pqkk0P(X=k)=pqkk0E[X]=q/pE[X]=q/p
We use a trick: E[X2]=E[X(X-1)]+E[X]E[X2]=E[X(X-1)]+E[X]
E[X2]=pk=0k(k-1)qk+q/p=pq2k=2k(k-1)qk-2+q/p=pq22(1-q)3+q/p=2q2p2+q/pE[X2]=pk=0k(k-1)qk+q/p=pq2k=2k(k-1)qk-2+q/p=pq22(1-q)3+q/p=2q2p2+q/p
(8)
Var [X]=2q2p2+q/p-(q/p)2=q/p2 Var [X]=2q2p2+q/p-(q/p)2=q/p2
(9)
5. Poisson(μ)(μ)P(X=k)=e-μμkk!k0P(X=k)=e-μμkk!k0
Using E[X2]=E[X(X-1)]+E[X]E[X2]=E[X(X-1)]+E[X], we have
E[X2]=e-μk=2k(k-1)μkk!+μ=e-μμ2k=2μk-2(k-2)!+μ=μ2+μE[X2]=e-μk=2k(k-1)μkk!+μ=e-μμ2k=2μk-2(k-2)!+μ=μ2+μ
(10)
Thus, Var [X]=μ2+μ-μ2=μ Var [X]=μ2+μ-μ2=μ. Note that both the mean and the variance have common value μ.

Some absolutely continuous distributions

1. Uniform on (a,b)(a,b)fX(t)=1b-aa<t<bfX(t)=1b-aa<t<bE[X]=a+b2E[X]=a+b2
E[X2]=1b-aabt2dt=b3-a33(b-a)so Var [X]=b3-a33(b-a)-(a+b)24=(b-a)212E[X2]=1b-aabt2dt=b3-a33(b-a)so Var [X]=b3-a33(b-a)-(a+b)24=(b-a)212
(11)
2. Symmetric triangular(a,b)(a,b) Because of the shift property (V2), we may center the distribution at the origin. Then the distribution is symmetric triangular (-c,c)(-c,c), where c=(b-a)/2c=(b-a)/2. Because of the symmetry
Var [X]=E[X2]=-cct2fX(t)dt=20ct2fX(t)dt Var [X]=E[X2]=-cct2fX(t)dt=20ct2fX(t)dt
(12)
Now, in this case,
fX(t)=c-tc20tcsothatE[X2]=2c20c(ct2-t3)dt=c26=(b-a)224fX(t)=c-tc20tcsothatE[X2]=2c20c(ct2-t3)dt=c26=(b-a)224
(13)
3. Exponential ( λ ) ( λ ) f X ( t ) = λ e - λ t , t 0 E [ X ] = 1 / λ f X ( t ) = λ e - λ t , t 0 E [ X ] = 1 / λ
E [ X 2 ] = 0 λ t 2 e - λ t d t = 2 λ 2 so that Var [ X ] = 1 / λ 2 E [ X 2 ] = 0 λ t 2 e - λ t d t = 2 λ 2 so that Var [ X ] = 1 / λ 2
(14)
4. Gamma(α,λ)(α,λ)fX(t)=1Γ(α)λαtα-1e-λtt0E[X]=αλfX(t)=1Γ(α)λαtα-1e-λtt0E[X]=αλ
E[X2]=1Γ(α)0λαtα+1e-λtdt=Γ(α+2)λ2Γ(α)=α(α+1)λ2E[X2]=1Γ(α)0λαtα+1e-λtdt=Γ(α+2)λ2Γ(α)=α(α+1)λ2
(15)
Hence Var [X]=α/λ2 Var [X]=α/λ2.
5. Normal(μ,σ2)(μ,σ2)E[X]=μE[X]=μ
Consider YN(0,1),E[Y]=0, Var [Y]=22π0t2e-t2/2dt=1YN(0,1),E[Y]=0, Var [Y]=22π0t2e-t2/2dt=1.
X=σY+μimplies Var [X]=σ2 Var [Y]=σ2X=σY+μimplies Var [X]=σ2 Var [Y]=σ2
(16)

Extensions of some previous examples

In the unit on expectations, we calculate the mean for a variety of cases. We revisit some of those examples and calculate the variances.

### Example 1: Expected winnings (Example 8 from "Mathematical Expectation: Simple Random Variables")

A bettor places three bets at $2.00 each. The first pays$10.00 with probability 0.15, the second $8.00 with probability 0.20, and the third$20.00 with probability 0.10.

SOLUTION

The net gain may be expressed

X = 10 I A + 8 I B + 20 I C - 6 , with P ( A ) = 0 . 15 , P ( B ) = 0 . 20 , P ( C ) = 0 . 10 X = 10 I A + 8 I B + 20 I C - 6 , with P ( A ) = 0 . 15 , P ( B ) = 0 . 20 , P ( C ) = 0 . 10
(17)

We may reasonbly suppose the class {A,B,C}{A,B,C} is independent (this assumption is not necessary in computing the mean). Then

Var [ X ] = 10 2 P ( A ) [ 1 - P ( A ) ] + 8 2 P ( B ) [ 1 - P ( B ) ] + 20 2 P ( C ) [ 1 - P ( C ) ] Var [ X ] = 10 2 P ( A ) [ 1 - P ( A ) ] + 8 2 P ( B ) [ 1 - P ( B ) ] + 20 2 P ( C ) [ 1 - P ( C ) ]
(18)

Calculation is straightforward. We may use MATLAB to perform the arithmetic.

c = [10 8 20];
p = 0.01*[15 20 10];
q = 1 - p;
VX = sum(c.^2.*p.*q)
VX =  58.9900


### Example 2: A function of X (Example 9 from "Mathematical Expectation: Simple Random Variables")

Suppose X in a primitive form is

X = - 3 I C 1 - I C 2 + 2 I C 3 - 3 I C 4 + 4 I C 5 - I C 6 + I C 7 + 2 I C 8 + 3 I C 9 + 2 I C 10 X = - 3 I C 1 - I C 2 + 2 I C 3 - 3 I C 4 + 4 I C 5 - I C 6 + I C 7 + 2 I C 8 + 3 I C 9 + 2 I C 10
(19)

with probabilities P(Ci)=0.08,0.11,0.06,0.13,0.05,0.08,0.12,0.07,0.14,0.16P(Ci)=0.08,0.11,0.06,0.13,0.05,0.08,0.12,0.07,0.14,0.16.

Let g(t)=t2+2tg(t)=t2+2t. Determine E[g(X)]E[g(X)] and Var [g(X)] Var [g(X)]

c = [-3 -1 2 -3 4 -1 1 2 3 2];            % Original coefficients
pc = 0.01*[8 11 6 13 5 8 12 7 14 16];     % Probabilities for C_j
G = c.^2 + 2*c                            % g(c_j)
EG = G*pc'                                % Direct calculation E[g(X)]
EG =  6.4200
VG = (G.^2)*pc' - EG^2                  % Direct calculation Var[g(X)]
VG = 40.8036
[Z,PZ] = csort(G,pc);                   % Distribution for Z = g(X)
EZ = Z*PZ'                              % E[Z]
EZ =  6.4200
VZ = (Z.^2)*PZ' - EZ^2                  % Var[Z]
VZ = 40.8036


### Example 3: Z=g(X,Y)Z=g(X,Y) (Example 10 from "Mathematical Expectation: Simple Random Variables")

We use the same joint distribution as for Example 10 from "Mathematical Expectation: Simple Random Variables" and let g(t,u)=t2+2tu-3ug(t,u)=t2+2tu-3u. To set up for calculations, we use jcalc.

jdemo1                      % Call for data
jcalc                       % Set up
Enter JOINT PROBABILITIES (as on the plane)  P
Enter row matrix of VALUES of X  X
Enter row matrix of VALUES of Y  Y
Use array operations on matrices X, Y, PX, PY, t, u, and P
G = t.^2 + 2*t.*u - 3*u;    % Calculation of matrix of [g(t_i, u_j)]
EG = total(G.*P)            % Direct calculation of E[g(X,Y)]
EG =   3.2529
VG = total(G.^2.*P) - EG^2  % Direct calculation of Var[g(X,Y)]
VG =  80.2133
[Z,PZ] = csort(G,P);        % Determination of distribution for Z
EZ = Z*PZ'                  % E[Z] from distribution
EZ =   3.2529
VZ = (Z.^2)*PZ' - EZ^2      % Var[Z] from distribution
VZ =  80.2133


### Example 4: A function with compound definition (Example 12 from "Mathematical Expectation; General Random Variables")

Suppose XX exponential (0.3). Let

Z = X 2 for X 4 16 for X > 4 = I [ 0 , 4 ] ( X ) X 2 + I ( 4 , ] ( X ) 16 Z = X 2 for X 4 16 for X > 4 = I [ 0 , 4 ] ( X ) X 2 + I ( 4 , ] ( X ) 16
(20)

Determine E[Z]E[Z] and Var [Z] Var [Z].

ANALYTIC SOLUTION

E [ g ( X ) ] = g ( t ) f X ( t ) d t = 0 I [ 0 , 4 ] ( t ) t 2 0 . 3 e - 0 . 3 t d t + 16 E [ I ( 4 , ] ( X ) ] E [ g ( X ) ] = g ( t ) f X ( t ) d t = 0 I [ 0 , 4 ] ( t ) t 2 0 . 3 e - 0 . 3 t d t + 16 E [ I ( 4 , ] ( X ) ]
(21)
= 0 4 t 2 0 . 3 e - 0 . 3 t d t + 16 P ( X > 4 ) 7 . 4972 (by Maple) = 0 4 t 2 0 . 3 e - 0 . 3 t d t + 16 P ( X > 4 ) 7 . 4972 (by Maple)
(22)
Z 2 = I [ 0 , 4 ] ( X ) X 4 + I ( 4 , ] ( X ) 256 Z 2 = I [ 0 , 4 ] ( X ) X 4 + I ( 4 , ] ( X ) 256
(23)
E [ Z 2 ] = 0 I [ 0 , 4 ] ( t ) t 4 0 . 3 e - 0 . 3 t d t + 256 E [ I ( 4 , ] ( X ) ] = 0 4 t 4 0 . 3 e - 0 . 3 t d t + 256 e - 1 . 2 100 . 0562 E [ Z 2 ] = 0 I [ 0 , 4 ] ( t ) t 4 0 . 3 e - 0 . 3 t d t + 256 E [ I ( 4 , ] ( X ) ] = 0 4 t 4 0 . 3 e - 0 . 3 t d t + 256 e - 1 . 2 100 . 0562
(24)
Var [ Z ] = E [ Z 2 ] - E 2 [ Z ] 43 . 8486 (by Maple) Var [ Z ] = E [ Z 2 ] - E 2 [ Z ] 43 . 8486 (by Maple)
(25)

APPROXIMATION

To obtain a simple aproximation, we must approximate by a bounded random variable. Since P(X>50)=e-153·10-7P(X>50)=e-153·10-7 we may safely truncate X at 50.

tappr
Enter matrix [a b] of x-range endpoints  [0 50]
Enter number of x approximation points  1000
Enter density as a function of t  0.3*exp(-0.3*t)
Use row matrices X and PX as in the simple case
M = X <= 4;
G = M.*X.^2 + 16*(1 - M);  % g(X)
EG = G*PX'                 % E[g(X)]
EG =  7.4972
VG = (G.^2)*PX' - EG^2     % Var[g(X)]
VG = 43.8472               % Theoretical = 43.8486
[Z,PZ] = csort(G,PX);      % Distribution for Z = g(X)
EZ = Z*PZ'                 % E[Z] from distribution
EZ =  7.4972
VZ = (Z.^2)*PZ' - EZ^2     % Var[Z]
VZ = 43.8472


### Example 5: Stocking for random demand (Example 13 from "Mathematical Expectation; General Random Variables")

The manager of a department store is planning for the holiday season. A certain item costs c dollars per unit and sells for p dollars per unit. If the demand exceeds the amount m ordered, additional units can be special ordered for s dollars per unit (s>cs>c). If demand is less than the amount ordered, the remaining stock can be returned (or otherwise disposed of) at r dollars per unit (r<cr<c). Demand D for the season is assumed to be a random variable with Poisson (μ)(μ) distribution. Suppose μ=50,c=30,p=50,s=40,r=20μ=50,c=30,p=50,s=40,r=20. What amount m should the manager order to maximize the expected profit?

PROBLEM FORMULATION

Suppose D is the demand and X is the profit. Then

• For Dm,X=D(p-c)-(m-D)(c-r)=D(p-r)+m(r-c)Dm,X=D(p-c)-(m-D)(c-r)=D(p-r)+m(r-c)
• For D>m,X=m(p-c)+(D-m)(p-s)=D(p-s)+m(s-c)D>m,X=m(p-c)+(D-m)(p-s)=D(p-s)+m(s-c)

It is convenient to write the expression for X in terms of IM, where M=(-,m]M=(-,m]. Thus

X = I M ( D ) [ D ( p - r ) + m ( r - c ) ] + [ 1 - I M ( D ) ] [ D ( p - s ) + m ( s - c ) ] X = I M ( D ) [ D ( p - r ) + m ( r - c ) ] + [ 1 - I M ( D ) ] [ D ( p - s ) + m ( s - c ) ]
(26)
= D ( p - s ) + m ( s - c ) + I M ( D ) [ D ( p - r ) + m ( r - c ) - D ( p - s ) - m ( s - c ) ] = D ( p - s ) + m ( s - c ) + I M ( D ) [ D ( p - r ) + m ( r - c ) - D ( p - s ) - m ( s - c ) ]
(27)
= D ( p - s ) + m ( s - c ) + I M ( D ) ( s - r ) [ D - m ] = D ( p - s ) + m ( s - c ) + I M ( D ) ( s - r ) [ D - m ]
(28)

Then

E [ X ] = ( p - s ) E [ D ] + m ( s - c ) + ( s - r ) E [ I M ( D ) D ] - ( s - r ) m E [ I M ( D ) ] E [ X ] = ( p - s ) E [ D ] + m ( s - c ) + ( s - r ) E [ I M ( D ) D ] - ( s - r ) m E [ I M ( D ) ]
(29)

We use the discrete approximation.

APPROXIMATION

>> mu = 50;
>> n = 100;
>> t = 0:n;
>> pD = ipoisson(mu,t);         % Approximate distribution for D
>> c  = 30;
>> p  = 50;
>> s  = 40;
>> r  = 20;
>> m  = 45:55;
>> for i = 1:length(m)          % Step by step calculation for various m
M = t<=m(i);
G(i,:) = (p-s)*t + m(i)*(s-c) + (s-r)*M.*(t - m(i));
end
>> EG = G*pD';
>> VG = (G.^2)*pD' - EG.^2;
>> SG =sqrt(VG);
>> disp([EG';VG';SG']')
1.0e+04 *
0.0931    1.1561    0.0108
0.0936    1.3117    0.0115
0.0939    1.4869    0.0122
0.0942    1.6799    0.0130
0.0943    1.8880    0.0137
0.0944    2.1075    0.0145
0.0943    2.3343    0.0153
0.0941    2.5637    0.0160
0.0938    2.7908    0.0167
0.0934    3.0112    0.0174
0.0929    3.2206    0.0179


### Example 6: A jointly distributed pair (Example 14 from "Mathematical Expectation; General Random Variables")

Suppose the pair {X,Y}{X,Y} has joint density fXY(t,u)=3ufXY(t,u)=3u on the triangular region bounded by u=0u=0, u=1+tu=1+t, u=1-tu=1-t. Let Z=g(X,Y)=X2+2XYZ=g(X,Y)=X2+2XY.

Determine E[Z]E[Z] and Var [Z] Var [Z].

ANALYTIC SOLUTION

E [ Z ] = ( t 2 + 2 t u ) f X Y ( t , u ) d u d t = 3 - 1 0 0 1 + t u ( t 2 + 2 t u ) d u d t + 3 0 1 0 1 - t u ( t 2 + 2 t u ) d u d t = 1 / 10 E [ Z ] = ( t 2 + 2 t u ) f X Y ( t , u ) d u d t = 3 - 1 0 0 1 + t u ( t 2 + 2 t u ) d u d t + 3 0 1 0 1 - t u ( t 2 + 2 t u ) d u d t = 1 / 10
(30)
E [ Z 2 ] = 3 - 1 0 0 1 + t u ( t 2 + 2 t u ) 2 d u d t + 3 0 1 0 1 - t u ( t 2 + 2 t u ) 2 d u d t = 3 / 35 E [ Z 2 ] = 3 - 1 0 0 1 + t u ( t 2 + 2 t u ) 2 d u d t + 3 0 1 0 1 - t u ( t 2 + 2 t u ) 2 d u d t = 3 / 35
(31)
Var [ Z ] = E [ Z 2 ] - E 2 [ Z ] = 53 / 700 0 . 0757 Var [ Z ] = E [ Z 2 ] - E 2 [ Z ] = 53 / 700 0 . 0757
(32)

APPROXIMATION

tuappr
Enter matrix [a b] of X-range endpoints  [-1 1]
Enter matrix [c d] of Y-range endpoints  [0 1]
Enter number of X approximation points  400
Enter number of Y approximation points  200
Enter expression for joint density  3*u.*(u<=min(1+t,1-t))
Use array operations on X, Y, PX, PY, t, u, and P
G = t.^2 + 2*t.*u;          % g(X,Y) = X^2 + 2XY
EG = total(G.*P)            % E[g(X,Y)]
EG =   0.1006               % Theoretical value = 1/10
VG = total(G.^2.*P) - EG^2
VG =   0.0765               % Theoretical value 53/700 = 0.0757
[Z,PZ] = csort(G,P);        % Distribution for Z
EZ = Z*PZ'                  % E[Z] from distribution
EZ =  0.1006
VZ = Z.^2*PZ' - EZ^2
VZ =  0.0765


### Example 7: A function with compound definition (Example 15 from "Mathematical Expectation; General Random Variables")

The pair {X,Y}{X,Y} has joint density fXY(t,u)=1/2fXY(t,u)=1/2 on the square region bounded by u=1+tu=1+t, u=1-tu=1-t, u=3-tu=3-t, and u=t-1u=t-1.

W = X for max { X , Y } 1 2 Y for max { X , Y } > 1 = I Q ( X , Y ) X + I Q c ( X , Y ) 2 Y W = X for max { X , Y } 1 2 Y for max { X , Y } > 1 = I Q ( X , Y ) X + I Q c ( X , Y ) 2 Y
(33)

where Q={(t,u):max{t,u}1}={(t,u):t1,u1}Q={(t,u):max{t,u}1}={(t,u):t1,u1}.

Determine E[W]E[W] and Var [W] Var [W].

ANALYTIC SOLUTION

The intersection of the region Q and the square is the set for which 0t10t1 and 1-tu11-tu1. Reference to Figure 11.3.2 shows three regions of integration.

E [ W ] = 1 2 0 1 1 - t 1 t d u d t + 1 2 0 1 1 1 + t 2 u d u d t + 1 2 1 2 t - 1 3 - t 2 u d u d t = 11 / 6 1 . 8333 E [ W ] = 1 2 0 1 1 - t 1 t d u d t + 1 2 0 1 1 1 + t 2 u d u d t + 1 2 1 2 t - 1 3 - t 2 u d u d t = 11 / 6 1 . 8333
(34)
E [ W 2 ] = 1 2 0 1 1 - t 1 t 2 d u d t + 1 2 0 1 1 1 + t 4 u 2 d u d t + 1 2 1 2 t - 1 3 - t 4 u 2 d u d t = 103 / 24 E [ W 2 ] = 1 2 0 1 1 - t 1 t 2 d u d t + 1 2 0 1 1 1 + t 4 u 2 d u d t + 1 2 1 2 t - 1 3 - t 4 u 2 d u d t = 103 / 24
(35)
Var [ W ] = 103 / 24 - ( 11 / 6 ) 2 = 67 / 72 0 . 9306 Var [ W ] = 103 / 24 - ( 11 / 6 ) 2 = 67 / 72 0 . 9306
(36)
tuappr
Enter matrix [a b] of X-range endpoints  [0 2]
Enter matrix [c d] of Y-range endpoints  [0 2]
Enter number of X approximation points  200
Enter number of Y approximation points  200
Enter expression for joint density  ((u<=min(t+1,3-t))& ...
(u\$gt;=max(1-t,t-1)))/2
Use array operations on X, Y, PX, PY, t, u, and P
M = max(t,u)<=1;
G = t.*M + 2*u.*(1 - M);     % Z = g(X,Y)
EG = total(G.*P)              % E[g(X,Y)]
EG =  1.8340                  % Theoretical 11/6 = 1.8333
VG = total(G.^2.*P) - EG^2
VG =  0.9368                  % Theoretical 67/72 = 0.9306
[Z,PZ] = csort(G,P);          % Distribution for Z
EZ = Z*PZ'                    % E[Z] from distribution
EZ =  1.8340
VZ = (Z.^2)*PZ' - EZ^2
VZ =  0.9368

### Example 8: A function with compound definition

f X Y ( t , u ) = 3 on 0 u t 2 1 f X Y ( t , u ) = 3 on 0 u t 2 1
(37)
Z = I Q ( X , Y ) X + I Q c ( X , Y ) for Q = { ( t , u ) : u + t 1 } Z = I Q ( X , Y ) X + I Q c ( X , Y ) for Q = { ( t , u ) : u + t 1 }
(38)

The value t0 where the line u=1-tu=1-t and the curve u=t2u=t2 meet satisfies t02=1-t0t02=1-t0.

E [ Z ] = 3 0 t 0 t 0 t 2 d u d t + 3 t 0 1 t 0 1 - t d u d t + 3 t 0 1 1 - t t 2 d u d t = 3 4 ( 5 t 0 - 2 ) E [ Z ] = 3 0 t 0 t 0 t 2 d u d t + 3 t 0 1 t 0 1 - t d u d t + 3 t 0 1 1 - t t 2 d u d t = 3 4 ( 5 t 0 - 2 )
(39)

For E[Z2]E[Z2] replace t by t2 in the integrands to get E[Z2]=(25t0-1)/20E[Z2]=(25t0-1)/20.

Using t0=(5-1)/20.6180t0=(5-1)/20.6180, we get Var [Z]=(2125t0-1309)/800.0540 Var [Z]=(2125t0-1309)/800.0540.

APPROXIMATION

% Theoretical values
t0 = (sqrt(5) - 1)/2
t0 =  0.6180
EZ = (3/4)*(5*t0 -2)
EZ =  0.8176
EZ2 = (25*t0 - 1)/20
EZ2 = 0.7225
VZ = (2125*t0 - 1309)/80
VZ =  0.0540
tuappr
Enter matrix [a b] of X-range endpoints  [0 1]
Enter matrix [c d] of Y-range endpoints  [0 1]
Enter number of X approximation points  200
Enter number of Y approximation points  200
Enter expression for joint density  3*(u <= t.^2)
Use array operations on X, Y, t, u, and P
G = (t+u <= 1).*t + (t+u > 1);
EG = total(G.*P)
EG =  0.8169                   % Theoretical = 0.8176
VG = total(G.^2.*P) - EG^2
VG =  0.0540                   % Theoretical = 0.0540
[Z,PZ] = csort(G,P);
EZ = Z*PZ'
EZ =  0.8169
VZ = (Z.^2)*PZ' - EZ^2
VZ =  0.0540


Standard deviation and the Chebyshev inequality

In Example 5 from "Functions of a Random Variable," we show that if XN(μ,σ2)XN(μ,σ2) then Z=X-μσN(0,1)Z=X-μσN(0,1). Also, E[X]=μE[X]=μ and Var [X]=σ2 Var [X]=σ2. Thus

P | X - μ | σ t = P ( | X - μ | t σ ) = 2 Φ ( t ) - 1 P | X - μ | σ t = P ( | X - μ | t σ ) = 2 Φ ( t ) - 1
(40)

For the normal distribution, the standard deviation σ seems to be a natural measure of the variation away from the mean.

For a general distribution with mean μ and variance σ2, we have the

Chebyshev inequality

P | X - μ | σ a 1 a 2 or P ( | X - μ | a σ ) 1 a 2 P | X - μ | σ a 1 a 2 or P ( | X - μ | a σ ) 1 a 2
(41)

In this general case, the standard deviation appears as a measure of the variation from the mean value. This inequality is useful in many theoretical applications as well as some practical ones. However, since it must hold for any distribution which has a variance, the bound is not a particularly tight. It may be instructive to compare the bound on the probability given by the Chebyshev inequality with the actual probability for the normal distribution.

t = 1:0.5:3;
p = 2*(1 - gaussian(0,1,t));
c = ones(1,length(t))./(t.^2);
r = c./p;
h = ['       t     Chebyshev   Prob     Ratio'];
m = [t;c;p;r]';
disp(h)
t     Chebyshev   Prob     Ratio
disp(m)
1.0000    1.0000    0.3173    3.1515
1.5000    0.4444    0.1336    3.3263
2.0000    0.2500    0.0455    5.4945
2.5000    0.1600    0.0124   12.8831
3.0000    0.1111    0.0027   41.1554


DERIVATION OF THE CHEBYSHEV INEQUALITY

Let A={|X-μ|aσ}={(X-μ)2a2σ2}A={|X-μ|aσ}={(X-μ)2a2σ2}. Then a2σ2IA(X-μ)2a2σ2IA(X-μ)2.

Upon taking expectations of both sides and using monotonicity, we have

a 2 σ 2 P ( A ) E [ ( X - μ ) 2 ] = σ 2 a 2 σ 2 P ( A ) E [ ( X - μ ) 2 ] = σ 2
(42)

from which the Chebyshev inequality follows immediately.

We consider three concepts which are useful in many situations.

Definition. A random variable X is centered iff E[X]=0E[X]=0.

X ' = X - μ is always centered. X ' = X - μ is always centered.
(43)

Definition. A random variable X is standardized iff E[X]=0E[X]=0 and Var [X]=1 Var [X]=1.

X * = X - μ σ = X ' σ is standardized X * = X - μ σ = X ' σ is standardized
(44)

Definition. A pair {X,Y}{X,Y} of random variables is uncorrelated iff

E [ X Y ] - E [ X ] E [ Y ] = 0 E [ X Y ] - E [ X ] E [ Y ] = 0
(45)

It is always possible to derive an uncorrelated pair as a function of a pair {X,Y}{X,Y}, both of which have finite variances. Consider

U = ( X * + Y * ) V = ( X * - Y * ) , where X * = X - μ X σ X , Y * = Y - μ Y σ Y U = ( X * + Y * ) V = ( X * - Y * ) , where X * = X - μ X σ X , Y * = Y - μ Y σ Y
(46)

Now E[U]=E[V]=0E[U]=E[V]=0 and

E [ U V ] = E ( X * + Y * ) ( X * - Y * ) ] = E [ ( X * ) 2 ] - E [ ( Y * ) 2 ] = 1 - 1 = 0 E [ U V ] = E ( X * + Y * ) ( X * - Y * ) ] = E [ ( X * ) 2 ] - E [ ( Y * ) 2 ] = 1 - 1 = 0
(47)

so the pair is uncorrelated.

### Example 9: Determining an uncorrelated pair

We use the distribution for Examples Example 10 from "Mathematical Expectation: Simple Random Variables" and Example 3, for which

E [ X Y ] - E [ X ] E [ Y ] 0 E [ X Y ] - E [ X ] E [ Y ] 0
(48)
jdemo1
jcalc
Enter JOINT PROBABILITIES (as on the plane)  P
Enter row matrix of VALUES of X  X
Enter row matrix of VALUES of Y  Y
Use array operations on matrices X, Y, PX, PY, t, u, and P
EX = total(t.*P)
EX =   0.6420
EY = total(u.*P)
EY =   0.0783
EXY = total(t.*u.*P)
EXY = -0.1130
c = EXY - EX*EY
c  =  -0.1633                % {X,Y} not uncorrelated

VX = total(t.^2.*P) - EX^2
VX =  3.3016
VY = total(u.^2.*P) - EY^2
VY =  3.6566
SX = sqrt(VX)
SX =  1.8170
SY = sqrt(VY)
SY =  1.9122
x = (t - EX)/SX;            % Standardized random variables
y = (u - EY)/SY;
uu = x + y;                 % Uncorrelated random variables
vv = x - y;
EUV = total(uu.*vv.*P)      % Check for uncorrelated condition
EUV = 9.9755e-06            % Differs from zero because of roundoff


## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

#### Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

#### Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks