Docsity

Probability Theory: Mean and Variance of Random Variables, Notas de aula de Matemática

Toggle sidebar
bg1
POLI 270 - Mathematical and Statistical Foundations
Prof. S. Saiegh
Fall 2010
Lecture Notes - Class 8
November 18, 2010.
Random Variables and Probability Distributions
When we perform an experiment we are often interested not in the particular outcome
that occurs, but rather in some number associated with that outcome.
For example, in the game of “craps” a player is interested not in the particular numbers
on the two dice, but in their sum. In tossing a coin 50 times, we may be interested only in
the number of heads obtained, and not in the particular sequence of heads and tails that
constitute the result of 50 tosses.
In both examples, we have a rule which assigns to each outcome of the experiment a
single real number. Hence, we can say that a function is defined.
You guys are already familiar with the function concept. Now we are going to look at
some functions that are particularly useful to study probabilistic/statistical problems.
Random Variables
In probability theory, certain functions of special interest are given special names:
Definition 1 A function whose domain is a sample space and whose range is some set of
real numbers is called a random variable. If the random variable is denoted by Xand has
the sample space Ω = {o1, o2, ..., on}as domain, then we write X(ok)for the value of Xat
element ok. Thus X(ok)is the real number that the function rule assigns to the element ok
of Ω.
Lets look at some examples of random variables:
Example 1 Let Ω = {1,2,3,4,5,6}and define Xas follows:
X(1) = X(2) = X(3) = 1,X(4) = X(5) = X(6) = −1.
Then Xis a random variable whose domain is the sample space Ω and whose range is
the set {1,−1}.Xcan be interpreted as the gain of a player in a game in which a die is
rolled, the player winning $1 if the outcome is 1,2,or 3 and losing $1 if the outcome is 4,5,6.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Pré-visualização parcial do texto

Baixe Probability Theory: Mean and Variance of Random Variables e outras Notas de aula em PDF para Matemática, somente na Docsity!

POLI 270 - Mathematical and Statistical Foundations Prof. S. Saiegh Fall 2010

Lecture Notes - Class 8

November 18, 2010.

Random Variables and Probability Distributions

When we perform an experiment we are often interested not in the particular outcome that occurs, but rather in some number associated with that outcome.

For example, in the game of “craps” a player is interested not in the particular numbers on the two dice, but in their sum. In tossing a coin 50 times, we may be interested only in the number of heads obtained, and not in the particular sequence of heads and tails that constitute the result of 50 tosses.

In both examples, we have a rule which assigns to each outcome of the experiment a single real number. Hence, we can say that a function is defined.

You guys are already familiar with the function concept. Now we are going to look at some functions that are particularly useful to study probabilistic/statistical problems.

Random Variables

In probability theory, certain functions of special interest are given special names:

Definition 1 A function whose domain is a sample space and whose range is some set of real numbers is called a random variable. If the random variable is denoted by X and has the sample space Ω = {o 1 , o 2 , ..., on} as domain, then we write X(ok) for the value of X at element ok. Thus X(ok) is the real number that the function rule assigns to the element ok of Ω.

Lets look at some examples of random variables:

Example 1 Let Ω = { 1 , 2 , 3 , 4 , 5 , 6 } and define X as follows:

X(1) = X(2) = X(3) = 1, X(4) = X(5) = X(6) = − 1.

Then X is a random variable whose domain is the sample space Ω and whose range is the set { 1 , − 1 }. X can be interpreted as the gain of a player in a game in which a die is rolled, the player winning $1 if the outcome is 1,2,or 3 and losing $1 if the outcome is 4,5,6.

Example 2 Two dice are rolled and we define the familiar sample space

Ω = {(1, 1), (1, 2), ...(6, 6)}

containing 36 elements. Let X denote the random variable whose value for any element of Ω is the sum of the numbers on the two dice.

Then the range of X is the set containing the 11 values of X: 2,3,4,5,6,7,8,9,10,11,12. Each ordered pair of Ω has associated with it exactly one element of the range as required by Definition 1. But, in general, the same value of X arises from many different outcomes.

For example X(ok) = 5 is any one of the four elements of the event {(1, 4), (2, 3), (3, 2), (4, 1)}.

Example 3 A coin is tossed, and then tossed again. We define the sample space

Ω = {HH, HT, T H, T T }.

If X is the random variable whose value for any element of Ω is the number of heads obtained, then

X(HH) = 2, X(HT ) = X(T H) = 1, X(T T ) = 0. Notice that more than one random variable can be defined on the same sample space. For example, let Y denote the random variable whose value for any element of Ω is the number of heads minus the number of tails. Then

X(HH) = 2, X(HT ) = X(T H) = 0, X(T T ) = −2. Suppose now that a sample space Ω = {o 1 , o 2 , ..., on}

is given, and that some acceptable assignment of probabilities has been made to the sample points in Ω. Then if X is a random variable defined on Ω, we can ask for the probability that the value of X is some number, say x.

The event that X has the value x is the subset of Ω containing those elements ok for which X(ok) = x. If we denote by f(x) the probability of this event, then

f(x) = P ({ok ∈ Ω|X(ok) = x}). (1)

Because this notation is cumbersome, we shall write

f(x) = P (X = x), (2)

adopting the shorthand “X = x” to denote the event written out in (1).

This is called the probability chart of the random variable X. The various values of X are indicated on the horizontal x-axis, and the length of the vertical line drawn from the x-axis to the point with coordinates (x, f(x)) is the probability of the event that X has the value x.

Now, we are often interested not in the probability that the value of a random variable X is a particular number, but rather in the probability that X has some value less than or equal to some number.

In general, if X is defined on the sample space Ω, then the event that X is less than or equal to some number, say x, is the subset of Ω containing those elements ok for which X(ok) ≤ x. If we denote by F (x) the probability of this event (assuming an acceptable assignment of probabilities has been made to the sample points Ω), then

F(x) = P ({ok ∈ Ω|X(ok) ≤ x}). (3) In analogy with our argument in (2), we adopt the shorthand “X ≤ x” to denote the event written out in (3), and then we can write

F(x) = P (X ≤ x). (4)

Definition 3 The function F whose value for each real number x is given by (4), or equiv- alently by (3), is called the distribution function of the random variable X.

In other words, the distribution function of X has the set of all real numbers as its do- main, and the function assigns to each real number x the probability that X has a value less than or equal to (i.e., at most) the number x.

It is an easy matter to calculate the values of F , the distribution function of a random variable X, when one knows f, the probability function of X.

Example 6 Lets continue with the dice experiment of Example 5.

The event symbolized by X ≤ 1 is the null event of the sample space Ω, since the sum of the numbers on the dice cannot be at most 1. Hence

F (1) = P (X ≤ 1) = 0. The event X ≤ 2 is the subset {(1, 1)}, which is the same as the event X = 2. Thus, F (2) = P (X ≤ 2) = f(2) = 361. The event X ≤ 3 is the subset {(1, 1), (1, 2), (2, 1)}, which is seen to be the union of the events X = 2 and X = 3. Hence,

F (3) = P (X ≤ 3) = P (X = 2) + P (X = 3) = f(2) + f(3)

=

Similarly, the event X ≤ 4 is the union of the events X = 2, X = 3, and X = 4, so that 1 36 +^

2 36 +^

3 36 =^

6

Continuing this way, we obtain the entries in the following distribution table for the random variable X:

x 2 3 4 5 6 7 8 9 10 11 12 F (x) (^36136336610361536213626363036333635363636)

Remember, though, that the domain of the distribution function F is the set of all real numbers. Hence, we must find the value F (x) for all numbers x, not just those in the distribution table. For example, to find F (2.6) we note that the event X ≤ 2 .6 is the subset {(1, 1)}, since the sum of the numbers on the dice is less than or equal to 2.6 if and only if the sum is exactly 2. Therefore,

F(2.6) = P (X ≤ 2 .6) =

In fact, F (x) = 361 for all x in the interval 2 ≤ x < 3, since for any such x the event X ≤ x is the same subset, namely {(1, 1)}. Note that this interval contains x = 2, but does not contain x = 3, since F (3) = 363. Similarly, we find F (3) = 363 for all x in the interval 3 ≤ x < 4, but a jump occurs at x = 4, since F (4) = 366.

These facts are shown on the following graph of the distribution function.

The graph consists entirely of horizontal line segments (i.e. it is a step function). We use a heavy dot to indicate which of the two horizontal segments should be read at each jump (step) in the graph. Note that the magnitude of the jump at x = 2 is f(2) = 361 , the jump at x = 3 is f(3) = 362 , the jump at x = 4 is f(4) = 366 , etc.

The second condition expresses the requirement that it is certain that X will take one of the available values of x. Observe also that

P rob(a ≤ X ≤ b) =

∑^ b

x=a

f(x).

This latter observation leads us to the consideration of random variables which may take any real value.

Such random variables are called continuous. For the continuous case, the probability associated with any particular point is zero, and we can only assign positive probabilities to intervals in the range of x.

In particular, suppose that X is a random variable on a sample space Ω whose range space RX is a continuum of numbers such as an interval. We assume that there is a continuous function f : R → R such that P rob(a ≤ X ≤ b) is equal to the area under the graph of f between x = a and x = b.

Example 7 Suppose f(x) = x^2 + 2x + 3.

Then P (0 ≤ X ≤ 0 .5) is the area under the graph of f between x = 0 and x = 0.5.

In the language of calculus,

P rob(a ≤ X ≤ b) =

∫ (^) b

a

f(x) dx

In this case, the function f is called the probability density function (pdf ) of the continuous random variable X; it satisfies the conditions

(i) f(x) ≥ 0 (all x)

(ii)

−∞ f(x)^ dx^ = 1.

That is, f is nonnegative and the total area under its graph is 1.

The second condition expresses the requirement that it is certain that X will take some real value. If the range of X is not infinite, it is understood that f(x) = 0 anywhere outside the appropriate range.

Example 8 Let X be a random variable with the following pdf:

f(x) =

2 x^ if^0 ≤^ x^ ≤^2 0 elsewhere

The graph of f looks like this:

Then, the probability P (1 ≤ X ≤ 1 .5) is equal to the area of shaded region in diagram:

P (1 ≤ X ≤ 1 .5) =

1

f(x) dx

1

x dx

x^2 4

  1. 5 1

Let X be a random variable (discrete or continuous). The cumulative distribution func- tion F of X is the function F : R → R defined by

F (a) = P (X ≤ a).

Suppose X is a discrete random variable with distribution f. Then F is the “step function” defined by

F (x) =

xi≤x

f(xi).

Expectation

Let X be a finite random variable, and suppose the following is its distribution:

x x 1 x 2 x 3... xn f(x) f(x 1 ) f(x 2 ) f(x 3 )... f(xn)

Then the mean, or expectation (or expected value) of X, denoted by E(X), or simply E, is defined by

E = E(X) = x 1 f(x 1 ) + x 2 f(x 2 ) + ... + xnf(xn) =

xif(xi)

Roughly speaking, if the xi are numerical outcomes of an experiment, then E is the ex- pected value of the experiment. We may also view E as the weighted average of the outcomes where each outcome is weighted by its probability.

So, suppose that X is a random variable with n distinct values x 1 , x 2 , ..., xn and suppose xi occurs with the same probability pi. Then pi = (^1) n. Accordingly

E = E(X) = x 1

n

  • x 2

n

  • ... + xn

n

x 1 + x 2 + ... + xn n This is precisely the average or mean value of the numbers x 1 , x 2 , ..., xn. For this reason E(X) is called the mean of the random variable X. Furthermore, since the Greek letter μ is used for the mean value of a population, we also use μ for the expectation of X. That is,

μ = μX = E(X)

Finally, the expectation E(X) for a continuous random variable X is defined by the following integral when it exists:

∫ (^) ∞

−∞

xf(x) dx

Variance

The mean of a random variable X measures, in a certain sense, the “average” value of X. The next two concepts, variance and standard deviation, measure the “spread” or “dis- persion” of X.

Let X be a random variable with mean μ = E(X) and the following probability distri- bution:

x x 1 x 2 x 3... xn f(x) f(x 1 ) f(x 2 ) f(x 3 )... f(xn)

The variance of X, denoted by var(X), is defined by

var(X) = (x 1 − μ)^2 f(x 1 ) + (x 2 − μ)^2 f(x 2 ) + ... + (xn − μ)^2 f(xn)

(xi − μ)^2 f(xi) = E((X − μ)^2 )

The standard deviation of X, denoted by σX or simply σ is the nonnegative square root of var(X), that is

σX =

var(X)

Accordingly, var(X) = σ X^2. Both var(X) and σ^2 are used to denote the variance of a random variable X.

The next theorem gives us an alternate and sometimes more useful formula for calculating the variance of a random variable X.

Theorem 1 var(X) = x^21 f(x 1 ) + x^22 f(x 2 ) + ... + x^2 nf(xn) − μ^2 =

x^2 i f(xi) − μ^2 = E(X^2 ) − μ^2

Proof. Using

xif(xi) = μ and

f(xi) = 1, we obtain

(xi − μ)^2 f(xi) =

(x^2 i − 2 μxi + μ^2 )f(xi)

=

x^2 i f(xi) − 2 μ

xif(xi) + μ^2

f(xi)

=

x^2 i f(xi) − 2 μ^2 + μ^2

=

x^2 i f(xi) − μ^2

This proves the theorem.

Standardized Random Variable

Let X be a random variable with mean μ and standard deviation σ > 0. The standardized random variable Z is defined by

Z =

X − μ σ

The standardized random variable Z has mean μZ = 0 and standard deviation σZ = 1.

Example 11 Let X be a continuous random variable with the following pdf

f(x) =

2 x^ if^0 ≤^ x^ ≤^2 0 elsewhere

Using calculus we can compute the expectation, variance, and standard deviation of X:

E(X) =

−∞

xf(x) dx

0

x^2 dx

x^3 6

2 0

E(X^2 ) =

−∞

x^2 f(x) dx

0

x^3 dx

x^4 8

2 0

var(X) = E(X^2 ) − μ^2 = 2 −

and σX =

Joint Distribution of Random Variables

Earlier in this course we have seen that certain experiments can be analyzed in terms of compounds of simple experiments. Often, though, is not the resulting set of ordered pairs (or triples, etc.) which is of prime interest to the experimenter.

For example, sampling two ball bearings produced a set of ordered pairs as elementary events, but the experimenter may be interested only in the number of good ball bearings. Public opinion polls produce a sequence of responses, some favorable some unfavorable, but interest usually centers in the proportion of favorable responses rather than the ordered se- quence of responses.

Many such situations can be viewed as a case of adding random variables. In mathemat- ical terms, we are given a sample space Ω and n random variables defined on Ω, where n is an integer greater than or equal to 2. Lets look at the bivariate case (n = 2):

Example 12 A fair coin is tossed three independent times. We choose the familiar set

Ω = {HHH, HHT, HT H, T HH, HT T, T HT, T T H, T T T }

as sample space and assign probability 18 to each simple event. We define the following random variables:

X =

0 if the first toss is a tail 1 if the first toss is a head,

Y = the total number of heads,

Z = the absolute value of the dif f erence between the number of heads and tails

We can list the values of these three random variables for each element of the sample space Ω:

Element of Ω Value of X Value of Y Value of Z HHH 1 3 3 HHT 1 2 1 HT H 1 2 1 T HH 0 2 1 HT T 1 1 1 T HT 0 1 1 T T H 0 1 1 T T T 0 0 3

Consider now the first pair X, Y. We want to determine not only the possible pairs of values of X and Y , but also the probability with which each such pair occurs.

To say, for example, that X has the value 0 and Y the value 1 is to say that the event {T HT, T T H} occurs. The probability of this event is therefore 28 or 14. We write

P (X = 0, Y = 1) =

adopting the convention in which a comma is used in place of ∩ to denote the intersection of the two events X = 0 and Y = 1. We similarly find

P (X = 0, Y = 0) = P ({T T T }) =

P (X = 1, Y = 0) = P (∅) = 0, etc.

x\z 1 3 P (X = x)

P (Z = z) 34 14 1

Notice that the events X = 0 and Z = 1 are independent:

P (X = 0, Z = 1) = 38 , and this is equal to the product of P (X = 0) = 12 and P (Z = 1) = 34.

In general, two random variables X and Z are independent if each entry in the joint distribution table is the product of the marginal entries.

Definition 4 Let X and Y be random variables on the same sample space Ω with respective range spaces

RX = {x 1 , x 2 , ..., xn} and RY = {y 1 , y 2 , ..., ym}

The joint distribution or joint probability function of X and Y is the function h on the product space RX × RY defined by

h(xi, yj ) ≡ P (X = xi, Y = yj ) ≡ P ({ω ∈ Ω : X(ω) = xi, Y (ω) = yj })

The function h is usually given in the form of a table, and has the following properties:

(i) h(xi, yj ) ≥ 0,

(ii)

i

j

h(xi, yj ) = 1.

Thus, h defines a probability space on the product space RX × RY.

Mean of Sums of Random Variables

Tt follows from the preceding definition that if two random variables X and Y are defined on a sample space Ω, then there are many other random variables also defined on Ω.

Consider the random variables X and Y in our previous example. The possible values of X and Y , together with their joint probabilities were given in the first table.

Let z(x, y) = x + y so that U = z(X, Y ) = X + Y. From the joint probability table, we can determine the possible values of U as well as the probability with which each value occurs. For example,

P (U = 2) = P (X = 0, Y = 2) + P (X = 1, Y = 1) =

In this way, we obtain the entries in the following probability table for the random vari- able U = X + Y :

u 0 1 2 3 4

P (U = u) 1814141418

From this table we can calculate the mean of U :

E(U ) = E(X + Y ) = 0

From the marginal probability functions of X and Y , we find that

E(X) = 0

, E(Y ) = 0

Observe that E(X + Y ) = E(X) + E(Y ).

Theorem 2 Let X and Y be any random variables defined on a sample space Ω. Then

E(X + Y ) = E(X) + E(Y ) In words, the mean of the sum of two random variables is equal to the sum of their means. We can extend this result noting that for any constants a and b, E(aX + bY ) = aE(X) + bE(Y ). Lets define now z(x, y) as the product rather than the sum of x and y.

Then, V = z(X, Y ) = XY is a random variable and its following probability table is:

v 0 1 2 3

P (V = v) 12181418

Now we compute the mean of V ,

E(V ) = E(XY ) = 0

Observe that E(XY ) 6 = E(X)E(Y ).

Theorem 3 Let X and Y be independent random variables defined on a sample space Ω. Then

E(XY ) = E(X)E(Y )

In words, the mean of the product of two independent random variables is equal to the product of their means.

Theorem 4 Let X and Y be independent random variables defined on a sample space Ω. Then:

var(X + Y ) = var(X) + var(Y ).

In words, the variance of the sum of two independent random variables is equal to the sum of their variances.

Proof. By definition of variance we have

var(X + Y ) = E([(X + Y ) − E(X + Y )]^2 ) = E([(X − μX ) + (Y − μY )]^2 ),

where we have rearranged terms in the bracket using Theorem 2. Now we perform the indicated squaring operation to obtain

var(X + Y ) = E[(X − μX )^2 + 2(X − μX )(Y − μY ) + (Y − μY )^2 ] = E[(X − μX )^2 ] + 2E[(X − μX )(Y − μY )] + E[(Y − μY )^2 ],

Note that if X and Y are independent, the middle term on the right hand side vanishes. The other two terms are, by definition, precisely var(X) and var(Y ). Q.E.D.

Now if X and Y are independent, then so are aX and bY for any constants a and b. Thus, we can extend the previous result to aX and bY :

var(aX + bY ) = var(aX) + var(bY ).

Covariance and Correlation

Let X and Y be random variables with the joint distribution h(x, y), and suppose now that we want to measure how the possible values of X are related to the possible values of Y.

In our last theorem we showed that

var(X + Y ) = var(X) + var(Y ) + 2E[(X − μX )(Y − μY )],

and since X and Y were assumed to be independent, we concluded that the last term vanishes. However, this last expression should be studied more carefully. In particular, we are now going to pay attention to the last term in the preceding expression.

The covariance of X and Y , denoted by cov(X, Y ), is defined by

cov(X, Y ) =

i,j

(xi − μX )(yj − μY ) h(xi, yj ) = E[(X − μX )(Y − μY )]

or equivalently,

cov(X, Y ) =

i,j

xiyj h(xi, yj ) − μX μY = E(XY ) − μX μY

Using this notation, we can express the variance of the sum of the two random variables X and Y as

var(X + Y ) = var(X) + var(Y ) + 2cov(X, Y )

Notice that we treat X and Y symmetrically, i.e.

cov(X, Y ) = cov(Y, X),

and since X − μX and Y − μY each have mean zero,

cov(X − μX , Y − μY ) = cov(X, Y ),

The covariance is thus a measure of the extent to which the values of X and Y tend to increase or decrease together. If X has values greater than its mean μX whenever Y has values greater than its mean μY and X has values less than μX whenever Y has values less than μY , then (X − μX )(Y − μY ) has positives values and cov(X, Y ) > 0.

On the other hand, if values of X are above μX whenever values of Y are below μY and vice versa, then cov(X, Y ) < 0.

By a suitable choice of two random variables, we can make their covariance any number we like. For example, if a and b are constants, then

cov(aX, bY ) = E(aXbY ) − E(aX)E(bY ) = abE(XY ) − (aμX )(bμY ),

from which follows that

cov(aX, bY ) = ab cov(X, Y ).

It should be clear from this last equation that if cov(X, Y ) 6 = 0, then by varying a and b we can make cov(aX, bY ) positive or negative, as small or as large as we please.