random variables a random variable is simply a real-valued function defined on the sample space of...

23
Random Variables •A random variable is simply a real-valued function defined on the sample space of an experiment. • Example. Three fair coins are flipped. The number of heads, Y, that appear is a random variable. Let us list the sample space, S. Sample Point No. of Heads, Y Probabilit y (H,H,H) 3 1/8 (H,H,T) 2 1/8 (H,T,H) 2 1/8 (T,H,H) 2 1/8 (H,T,T) 1 1/8 (T,H,T) 1 1/8 (T,T,H) 1 1/8

Upload: alyson-green

Post on 13-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Random Variables• A random variable is simply a real-valued function defined on

the sample space of an experiment.

• Example. Three fair coins are flipped. The number of heads, Y, that appear is a random variable. Let us list the sample space, S.

Sample Point No. of Heads, Y Probability

(H,H,H) 3 1/8

(H,H,T) 2 1/8

(H,T,H) 2 1/8

(T,H,H) 2 1/8

(H,T,T) 1 1/8

(T,H,T) 1 1/8

(T,T,H) 1 1/8

(T,T,T) 0 1/8

Page 2: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Example, continued.

• P{Y = 0} = P({s|Y(s) = 0}) = P{(T,T,T)} = 1/8

• P{Y = 1} = P({s|Y(s) = 1}) = P{(H,T,T),(T,H,T),(T,T,H)} = 3/8

• P{Y = 2} = P({s|Y(s) = 2}) = P{(H,H,T),(H,T,H),(T,H,H)} = 3/8

• P{Y = 3} = P({s|Y(s) = 3}) = P{(H,H,H)} = 1/8

• Since Y must take on one of the values 0, 1, 2, 3, we must have

and this agrees with the probabilities listed above.

3

0i

3

0i},iP{Y}iY{P1

Page 3: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Cumulative distribution function of a random variable• For a random variable X, the function F defined by

is called the cumulative distribution function, or simply, the distribution function. Clearly, F is a nondecreasing function of t.

• All probability questions about X can be answered in terms of the cumulative distribution function F. For example,

,t t},P{XF(t)

b.a allfor F(a) F(b) b}XP{a

F(a) 1 a}P{X

Page 4: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Proof of

• For sets A and B, where B A, P(A B) = P(A) P(B).

• Let A = {s| X(s) b}, B = {s| X(s) a}, a < b.

• A B = {s| a< X(s) b}.

• P(A B) = P(A) P(B) = F(b) – F(a).

b.a allfor F(a) F(b) b}XP{a

Page 5: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Properties of the cumulative distribution function

• For a random variable X, the cumulative distribution function (c. d. f.) F was defined by

• 1. F is non decreasing. 2.

3.

4. F is right continuous.

• The previous properties of F imply that

.x x},P{XF(x)

1. F(b)limb

0. F(b)limb

).F(a F(a) a)P(X

Page 6: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Example of a distribution function

• Suppose that a bus arrives at a station every day between 10am and 10:30am, at random. Let X be the arrival time.

• Therefore, the distribution function is:

10.5t10 10),t(210-10.5

10-t t)P(X

10.5 t1,

10.5 t 10 10),2(t

10 t 0,

F(t)

Page 7: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Discrete vs. Continuous Random Variables

• If a set is in one-to-one correspondence with the positive integers, the set is said to be countable.

• If the number of values taken on by a random variable is either finite or countable, then the random variable is said to be discrete. The number of heads which appear in 3 flips of a coin is a discrete random variable.

• If the set of values of a random variable is neither finite nor countable, we say the random variable is continuous. The random variable defined as the time that a bus arrives at a station is an example of a continuous random variable.

• In Chapter 5, the random variables are discrete, while in Chapter 6, they are continuous.

Page 8: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Probability Mass Function

• For a discrete random variable X, we define the probability mass function p(a) of X by

• If X is a discrete random variable taking the values x1, x2, …, then

• Example. For our coin flipping example, we plot p(xi) vs. xi:

a}.P{X p(a)

.1)p(x1i

i

0 1 2 3

0.375

0.25

0.125x

p(x)

Page 9: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Example of a probability mass function on a countable set

• Suppose X is a random variable taking values in the positive integers.

• We define p(i) = for i = 1, 2, 3, …

• Since this defines a probability mass function.

• P(X is odd) = sum of heights of red bars = 2/3 and

• P(X is even) = sum of heights of blue bars = 1/3.

i2

1

,1)p(i1i

Page 10: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Cumulative distribution function of a discrete random variable

• The distribution function of a discrete random variable can be expressed as

where

p(a) is the probability mass function.

• If X is a discrete random variable whose possible values are x1, x2, x3 …, where x1<x2< x3 …, then its distribution function is a step function. That is, F is constant on the intervals [xi-1, xi) and then takes a step (or jump) of size p(xi) at xi. (See next slide for an example).

a xall

p(x),F(a)

Page 11: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Random variable Y, number of heads, when 3 coins are tossed

Probability Mass Function

Cumulative Distribution Function

Page 12: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Random variable with both discrete and continuous features

• Define random variable X as follows:(1) Flip a fair coin(2) If the coin is H, define X to be a randomly selected value from the interval [0, 1/2].(3) If the coin is T, define X to be 1.The cdf for X is derived next.

• For t < 0, P(X t) = 0 follows easily.

• For P(X t) = P(X t| coin is H)∙P(coin is H) = (2t)∙(1/2) = t

• For P(X t) = P(X 1/2) = 1/2.

• For P(X t) = P(X 1/2) + P(X = 1) = 1/2 + 1/2 = 1.

,21t0

,1t21

1,t

Page 13: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

CDF for random variable X from previous slide

• Let the cdf for X be F. Then

1 t1,

1t ,

t0 t,

0 t0,

F(t)2

12

1

21

Page 14: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Expected value of a discrete random variable• For a discrete random variable X having probability mass function

p(x), the expectation or expected value of X, denoted by E(X), is defined by

• We see that the expected value of x is a weighted average of the possible values that x can take on, each value being weighted by the probability that x assumes it. The expectation of random variable X is also called the mean of X and the notation µ = E(X) is used.

• Example. A single fair die is thrown. What is the expectation of the number of dots showing on the top face of the die? Let X be the number of dots on the top face. Then

0 :p(x)x

xp(x). E(X)

.5.36/21)6/1(6)6/1(5)6/1(4

)6/1(3)6/1(2)6/1(1E(X)

Page 15: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Intuitive idea of expectation of a discrete random variable

• The expected value of a random variable is the average value that the random variable takes on. If for some game, E(X) = 0, then the game is called fair.

• For random variable X, if half the time X = 0 and the other half of the time X = 10, then the average value of X is E(X) = 5.

• For random variable Y, if one-third of the time Y = 6 and two-thirds of the time Y = 15, then the average value of Y is E(Y) = 12.

• Let Z be the amount you win in a lottery. If you win a million dollars with probability 10-6 and it costs you $2 for a ticket, your expected winnings are E(Z) = 999998(10-6) + (–2)(1 – 10-6) = –1 dollars.

Page 16: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Pascal’s Wager—First Use of Expectation to Make a Decision

• Suppose we are unsure of God’s existence, so we assign a probability of ½ to existence and ½ to nonexistence.

• Let X be the benefit derived from leading a pious life.

• X is infinite (eternal happiness) if God exists, however we lose a finite amount (d) of time and treasure devoted to serving God if He doesn’t exist.

• E(X) =

• Thus, the expected return on piety is positive infinity. Therefore, says Pascal, every reasonable person should follow the laws of God.

.d 21

21

Page 17: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Expectation of a function of a discrete random variable.

• Theorem. If X is a discrete random variable that takes on one of the values xi, i 1, with respective probabilities p(xi), then for any real-valued function g,

• Corollary. For real numbers a and b,

• Example. Let X be a random variable which takes the values –1, 0, 1 with probabilities 0.2, 0.5, and 0.3, respectively. Let g(x) = x2. We have that g(X) is a random variable which takes on the values 0 and 1 with equal probability. Hence,

• Note that

).p(x)g(x E(g(X)) ii

i

0.5.(0.3)1(0.5)0(0.2)1

g(1)p(1)g(0)p(0))1)p(1g( E(g(X))

.E(X))()E(X 22

.X))(bE(g(X))aE(g (X))bg(X)E(ag 2121

Page 18: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Law of Unconscious Statistician (Theorem from previous slide)

• Example. Let Y = g(X) = 7X–X2. Let X be outcome for a fair die.

3

1i

3

1ii

1-iii

3

1iii ))(ygP(Xy)yP(g(X)y)yP(YyE(Y)

).xP(X)g(x)xP(X)g(x)xP(X)g(x

)xP(X)g(x)xP(X)g(x

)xP(X)g(x)xP(X)g(x

)}xP(X)xP(X){g(x

j

6

1jjj

6

4jji

3

1ii

i-7

3

1ii-7i

3

1ii

i-7

3

1iii

3

1ii

i-7i

3

1ii

.12y and ,10y ,6yLet ,6.1, i i,Let x 321i

Page 19: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Determining Insurance Premiums

• Suppose a 36 year old man wants to buy $50,000 worth of term life insurance for a 20-year term.

• Let p36 be the probability that this man survives 20 more years.

• For simplicity, assume the man pays premiums for 20 years. If the yearly premium is C/20, where C is the total of the premiums the man pays, how should the insurance company choose C?

• Let the income to the insurance company be X. We have

• For the company to make money,

)p(150000pCE(X) 3636

.p

)p(150000C

36

36

Page 20: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Variance and standard deviation of a discrete random variable

• The variance of a discrete random variable X, denoted by Var(X), is defined by

The

variance is a measure of the spread of the possible values of X.

• The quantity is called the standard deviation of X.

• Example. Suppose X has value k, k > 0, with probability 0.5 and value –k with probability 0.5. Then E(X) = 0 and Var(X) = E(X2) = k2. Also, the standard deviation of X is k.

].E(X))E[(X Var(X) 2

Var(X)X

Page 21: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Keno versus Bolita

• Let B and K be the amount that you win in one play of Bolita and Keno, respectively. (See Example 4.26 in the textbook.)

• E(B) = –0.25 and E(K) = –0.25

• In the long run, your losses are the same with the two games.

• Var(B) = 55.69 and Var(K) = 1.6875

• Based on these variances, we conclude that the risk with Keno is far less than the risk with Bolita.

Page 22: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

More about variance and standard deviation

• Theorem. Var(X) = E(X2) – (E(X))2.

• Theorem. For constants a and b,

• Problem. If E(X) = 2 and E(X2) = 13, find the variance of –4X+12. Solution. Var(X) = E(X2) – (E(X))2 = 13 – 4 = 9.

• Definition. E(Xn) is the nth moment of X.

.|a|

and Var(X),a b)Var(aX

XbaX

2

144. 16Var(X) 12)4XVar(

Page 23: Random Variables A random variable is simply a real-valued function defined on the sample space of an experiment. Example. Three fair coins are flipped

Standardized Random Variables

• Let X be a random variable with mean and standard deviation . The random variable X* = (X )/ is called the standardized X.

• It follows directly that E(X*) = 0 and Var(X*) = 1.

• Standardization is particularly useful if two or more random variables with different distributions must be compared.

• Example. By using standardization, we can compare the home run records of Babe Ruth and Barry Bonds.