Random Variables: - Definition of Random Variable

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Lec3 3.

Spring, 2005

Random variables
Denition of Random Variable Discrete Random Variables Continuous Random Variables Probability Distributions Events of Probability Zero The Mean of a Random Variable Denition Rules for the Mean The Variance of a Random Variable Denition Rules for the Mean Covariance and Correlation
1

Joint, Marginal and Conditional Distributions The Binomial Distribution

Denition of Random Variable A random variable is a variable whose value is a numerical outcome of a random phenomenon. Technically, it is actually a function that maps elements of the sample space S into numerical outcomes. Example: Tossing a coin four times HHHH HHHT HHT H HHT T S= . . . . . . TTTH TTTT Let X denote the number of heads. For example, given the outcome is HTTH, X = X ( ) = 2
3

Given the outcome is HTTT, X = X ( ) = 1 Then X is a random variable.

We usually denote the random variables by capital letters near the end of the alphabet, such as X or Y , and denote the realized values by the corresponding lower case letter, such as x or y . There are two types of random variables: A discrete random variable takes values in a nite or countable set, for example, in {1, 2, 3, 4, 5} or all integer values. A continuous random variable takes values in a continuum, for example, in an interval [0, 1].

A Discrete Random Variable Consider rolling two dice. (1, 1) (1, 6) . . ... . . S= . . (6, 1) (6, 6) Let X be the total value of the roll. Thus, X ((a, b)) = a + b, (a, b) S X , then, is a discrete random variable taking values 1, 2, . . . , 12.

A Continuous Random Variable Consider measuring the diameter of ball bearings coming o an assembly line. S = possible ball bearings Given each possible ball bearing , let Y ( ) be the diameter of . Clearly, Y > 0, but any positive diameter is theoretically possible. That is, Y takes values in (0, ). Thus, Y is a continuous random variable.

Probability Distributions The probability distribution of a random variable X tells us what values X can take and how to assign probabilities to those values. Discrete random variables The probability distribution of a discrete random variable X lists the possible values of X and their probabilities. X Probability x1 p1 x2 p2 x3 p3 ... ... xk pk

The probabilities pi must satisfy: 1. 0 pi 1 for all i. 2. p1 + p2 + + pk = 1.


8

Discrete Random Variables Discrete Uniform example : Let X be the result of a fair dice. The probability distribution of X is: X Probability 1
1 6

2
1 6

3
1 6

4
1 6

5
1 6

6
1 6

Bernoulli example : Bernoulli trial is an experiment with only two possible outcomes, success or failure. Let X = 1 indicate success with probability p and X = 0 indicate failure with probability 1 p. Then X follows Bernoulli distribution with parameter p.

For example, let X be the number of head of a fair toss, then 1 X Bernoulli( 2 ). The probability distribution of X is: X Probability 0
1 2

1
1 2

10

Example: Two Rolls of a Die (cont.) Recall X denotes the total value of the two rolls. 0 6 P (X = 1) = P (X = 7) = 36 36 1 5 P (X = 2) = P (X = 8) = 36 36 2 4 P (X = 3) = P (X = 9) = 36 36 3 3 P (X = 4) = P (X = 10) = 36 36 4 2 P (X = 5) = P (X = 11) = 36 36 5 1 P (X = 6) = P (X = 12) = 36 36 1 2 3 1 P (X 3) = + = = 36 36 36 12 6 5 4 3 2 1 P (7 X 11) = + + + + = 36 36 36 36 36 12
11

Continuous Random Variables The probability distribution of a continuous random variable X is described by a density curve f (x). The probability of any event is the area under the density curve f (x) and above the values of X that make up the event. The density curve f (x) must satisfy: 1. f (x) 0, for all x. 2. The total area under the curve is 1. Example Suppose the lifetime of light bulbs X follows a normal distribution with mean 1,000 hours and standard deviation 150 hours.
12

P (X > 1000) = ? P (X 750) =? P (X = 1000) = ?

13

Events of Probability Zero Note that a continuous probability distribution assigns probability 0 to any individual value. This is clear if we observe that for any function f and any value x,
x

f (x)dx = 0
x

For this reason, when working with continuous probability distributions only, P (X x) = P (X < x) P (X x) = P (X > x)

14

The Mean of a Random Variable Suppose X is a discrete random variable with k possible values, x1 , x2 , . . . , xk . Let pi = P (X = xi ). The mean or expected value of X is given by X = E (X ) = p1 x1 + p2 x2 + + pk xk
k

=
i=1

pi xi

15

If Y is a continuous random variable with density function f (y ), then the mean is given by Y = E (Y )

yf (y ) dy

(The book sweeps this under the rug, calling it advanced mathematics.)

16

Rules for Means Let X and Y be random variables, and let a, b and c be xed numbers, then E (aX + bY + c) = aE (X ) + bE (Y ) + c aX +bY +c = aX + bY + c That is, expectation is a linear operator. Furthermore, for any constant c, E (c) = c.

17

Variance of a Random Variable Suppose X is a discrete random variable with k possible values, x1 , x2 , . . . , xk . Let pi = P (X = xi ). The variance of X is given by
k 2 = X i=1 k

pi (xi X )2 =
i=1

pi x2 i

2 X

or Var(X ) = E [(X E (X ))2 ] = E (X 2 )[E (X )]2 The standard deviation of X is given by X = SD(X ) = Var(X )

If X is a continuous random variable with density curve f (x),


2 X +

(xX ) f (x)dx =

x2 f (x)dx2 X

18

Rules for Variances

Var(aX ) = a2 Var(X) Var(X + b) = Var(X) Var(aX + b) = ? Var(X +Y ) = Var(X )+Var(Y )+2 Cov(X, Y ) Var(aX + bY + c) = ? where Cov(X, Y) is the covariance of X and Y .

19

Joint, Marginal, and Conditional Distributions


Suppose X and Y are two discrete random variables. The joint distribution of X and Y is P (X = xi , Y = yj ) The marginal distributions of X and Y are P (X = xi ) P ( Y = yi )

The conditional distribution of one variable, say X , given the other, say Y , takes a specic value is P (X = xi |Y = yj )

20

Conditional Probability
In general, if P (B ) = 0, the conditional probability of event A given B has occurred, denoted by P (A|B ), is given by P (A B ) P (A|B ) = P (B )

21

Covariance The quantity Cov(X, Y ), called the Covariance of random variables X and Y , is equal to Cov(X, Y ) = E [(X E (X ))(Y E (Y ))] = E (XY ) E (X )E (Y )

If X and Y are discrete random variables, Cov(X, Y ) =


i,j

pij (xi X )(yj Y ) pij xi yj


i,j

X Y

where pij = P (X = xi , Y = yj ).

22

Correlation The correlation between X and Y is Cov(X, Y ) = Var(X ) Var(Y ) is between -1 and 1 and measures the strength of the linear relationship between X and Y . If X and Y are independent random variables, Cov(X, Y ) = 0, In that case, Var(X + Y ) = Var(X ) + Var(Y ) Var(aX + bY + c) = a2 Var(X ) + b2 Var(Y ) However, Cov(X, Y ) = 0 X and Y are independent.
23

=0

Example
Consider the following joint probability table
X = the average number of dates a person has in a month Y = their annual income in thousands of dollars

Y X 0 1 2 10 .12 .1 .05 20 .12 .25 .2 30 .08 .05 .03

Fill in the marginal distribution of X and Y in the table. Calculate the mean and the variance of both X and Y . Whats the covariance and correlation of X and Y . Are X and Y independent? Why? Find the conditional distribution of X given that Y = 20.
24

The Binomial Distribution The binomial distribution is a very common discrete probability distribution that arises in the following situation: A xed number, n, of trials The n trials are independent of each other Each trial has exactly two outcomes: success and failure The probability of a success, p, is the same for each trial If X is the total number of successes in a binomial setting, then we say that the probability distribution of X is a binomial distribution with parameters n and p: X B (n, p)
25

Examples number of 1s in 10 rolls of a die number of correct guesses on a multiple-choice exam (with 25 questions and 4 choices each) number of Democratic voters in a sample of 3000 people; Binomial or not? X = number of stocks on the NY stock exchange which increase in price on Oct 20, 2003 X = number of games the Bears will win next season X = number of girls among the next 50 children born in Cook County hospital
26

A couple decides to have children until they have a girl. X = number of boys the couple will have

27

Binomial probability
If X B (n, p), n k P (X = k ) = p (1 p)nk k k = 0 , 1, 2, . . . , n
Why? Since the trials are independent, any particular sequence of 0s and 1s with k 1s and (n k) 0s has probability pk (1 p)nk of happening. There are (n k) 0s.


n k

distinct sequences with k 1s and

Mean and Variance of a Binomial


E (X ) = np Var(X ) = np(1 p) SD(X ) = np(1 p)

28

Example Sarah drives to work everyday, but she doesnt want to buy a parking permit. She decides to take her chances and risk getting a parking ticket each day. Suppose 1. A parking permit for a week (5 days) costs $ 50. 2. A parking ne costs $ 30. 3. The probability of getting a parking ticket each day is 0.3. 4. Her chances of getting a ticket each day is independent of other days. 5. She can get only 1 ticket per day. What is her probability of getting at least 1 parking ticket in 1 week (5 days)? What is the expected number of parking tickets that Sarah will get per week?
29

You might also like