Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
ECO 72 INTRODUCTION TO ECONOMIC STATISTICS Topic 5 Discrete Random Variables These slides are copyright © 2003 by Tavis Barr. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). Discrete Random Variables ● ● ● ● ● What is a random variable? Probability distributions Mean and variance of a discrete random variable Binomial Distribution Poisson Distribution What is a Random Variable? ● Describing every outcome of an experiment may not be an efficient way of working with the information. – – ● Example: We test a new drug on lab rats. We have all kinds of vital information on every rat, but maybe all we care about is whether a given rat survived Random Variables summarize what is interesting about an experiment. What is a Random Variable? (cont'd) ● A random variable is a mapping from outcomes of an experiment to the real number line, such that: 1.Every outcome gets mapped to one and only one number; but 2.more than one outcome may get mapped to the same number. Example of a Random Variable Random Variable Fuzzy vague sample space 0 1 2 3 4 5 6 7 Real Number Line Example: Consider the experiment of flipping a coin five times. Some resulting random variables: How many times did it land on Heads? ● How many times did it land on Tails? ● “1” if it landed on the same face every time, “0” if not ● Probability Distribution A probability distribution is a list of all possible values of a random variable and a probability associated with each outcome. Example: Taxis are only allowed to carry 4 passengers. The probability that they are carrying a given number is: Number Probability 0 1 2 3 4 .30 .35 .15 .10 guess! Discrete vs. Continuous ● ● ● Discrete random variables usually take on a finite number of outcomes, so the outcomes and associated probabilities can be listed in a table Continuous random variables take on a range of values, i.e., an infinite number of possible outcomes We'll deal with discrete random variables first and get to continuous ones in a couple of weeks Mean of a Discrete Random Variable If {X1, X2, ...XN} are the values that the variable can take on, and {P(X1),P(X2),...P(XN)} are the associated probabilities, then the formula for the mean is: i=N =∑ X i P X i i=1 = X 1 P X 1 X 2 P X 2 ⋯ X N P X N Population Mean vs. Weighted Sample Mean ● Remember the formula for the sample mean with a weighted sample: i=N i=N – ● ● ● w = ∑ X i w i / ∑ w i i=1 i=1 Probabilities always add up to one So if we treated our probabilities as weights, the population mean is like a kind of weighted mean It's a population parameter, though, not a sample feature Population Mean – Example i=N Formula: = ∑ X i P X i i=1 Example: Our beloved New York Taxicabs # of passengers 0 1 2 3 4 .30 .35 .15 .10 .10 Sum Prob. Xi∙P(Xi) .00 .35 .30 .30 .40 1.35 Variance of a Discrete Random Variable If {X1, X2, ...Xn} are the values that the variable can take on, and {P(X1),P(X2),...P(Xn)} are the associated probabilities, then the formula for the variance is: i=N =∑ X i− P X i 2 2 i=1 2 2 2 = X 1− P X 1 X 2− P X 2⋯ X N − P X N Population Variance – Example i=N 2 2 = X − Formula: ∑ i P X i i=1 Example: Our beloved New York Taxicabs (=1.35) # Psg Prob. 0 1 2 3 4 .30 .35 .15 .10 .10 Xi 1.35 .35 .65 1.65 2.65 (Xi)2 1.8225 .1225 .4225 2.7225 7.0225 Sum (Xi)2P(Xi) .5468 .0429 .0634 .2723 .7023 1.6277 Median and Mode of a Random Variable ● ● The median is the value where there is at most a 50 percent probability that the variable lies above or below that value The mode is the value with the highest probability Number Probability 0 1 2 3 4 ● ● .30 .35 .15 .10 .10 Median is 1 since less than 50% are below 1 and less than 50% are above 1 Mode is also 1 since it's the number with the highest prob. Binomial Distribution ● A Bernoulli trial is an experiment that can have two outcomes – – – ● True or False Yes or no Heads or tails A dummy or indicator variable is a random variable created from a Bernoulli Trial that assigns “1” to one outcome and “0” to the other Binomial Distribution – Formula ● Binomial variable asks question: – – – – ● Suppose we have n independent Bernoulli trials. Probability of “Yes”/”True”/”Success” is p. What is the probability of k successes? Here, n and p are parameters and k is an outcome. Answer: n! k n−k P X =k = p 1− p k !n−k ! Binomial Distribution – Example 1 ● N Bernoulli trials, each with prob. p of success ● Pr of k successes: ● n! k n−k P X =k = p 1− p k !n−k ! Example: Suppose we toss a coin five times. What is probability of it landing heads three times? Binomial Distribution – Example 1 ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k k !n−k ! ● Example: Suppose we toss a coin five times. What is probability of it landing heads three times? – n = 5, p = .5; we want to know P(X=3) Binomial Distribution – Example 1 ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k k ! n−k ! ● Example: Suppose we toss a coin five times. What is probability of it landing heads three times? – – N = 5, p = .5; we want to know P(X=3) 5! P X =3 = 0.53 1−0.55−3 3!5−3! Binomial Distribution – Example 1 ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k k ! n−k ! ● Example: Suppose we toss a coin five times. What is probability of it landing heads three times? – – N = 5, p = .5; we want to know P(X=3) 5! 3 5−3 P X =3 = 0.5 1−0.5 3!5−3! 120 = ×0.125×0.25 6×2 Binomial Distribution – Example 1 ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k k ! n−k ! ● Example: Suppose we toss a coin five times. What is probability of it landing heads three times? – – N = 5, p = .5; we want to know P(X=3) 5! 3 5−3 P X =3 = 0.5 1−0.5 3!5−3! 120 = ×0.125×0.25=0.3125 6×2 Binomial Distribution – Example 2 ● ● ● N Bernoulli trials, each with prob. p of success n! k n−k p 1− p Pr of k successes: P X =k = k !n−k ! Example: – Suppose a workplace is 40 percent women. – There are six managers;managers are promoted at random. – What is the probability of them all being men? Binomial Distribution – Example 2 ● ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k Example: k ! n−k ! – Suppose a workplace is 40 percent women. – There are six managers;managers are promoted at random. – What is the probability of them all being men? ● Here, n = 6, p = .4, and we want to know P(X=0) Binomial Distribution – Example 2 ● ● ● N Bernoulli trials, each with prob. p of success Pr of k successes: P X =k = n! p k 1− pn−k k !n−k ! Example: – Suppose a workplace is 40 percent women. – There are six managers; managers are promoted at random. – What is the probability of them all being men? ● ● Here, n = 6, p = .4, and we want to know P(X=0) 6! 0 6−0 P X =0 = 0.4 1−0.4 note : 0!=1 0! 6−0! 720 = ×1×0.0467 1×720 Binomial Distribution – Example 2 ● ● ● N Bernoulli trials, each with prob. p of success n! k n−k p 1− p Pr of k successes: P X =k = k !n−k ! Example: – Suppose a workplace is 40 percent women. – There are six managers; managers are promoted at random. – What is the probability of them all being men? ● ● Here, n = 6, p = .4, and we want to know P(X=0) 6! P X =0 = 0.40 1−0.46−0 note : 0!=1 0! 6−0! 720 = ×1×0.0467=0.0467 1×720 Binomial Distribution – Example 3 ● ● ● N Bernoulli trials, each with prob. p of success n! k n−k Pr of k successes: P X =k = p 1− p k ! n−k ! Example: – – – 10% of microchips are defective. We pull a batch of 10 chips What is the probability of at least one defective? Binomial Distribution – Example 3 ● ● ● N Bernoulli trials, each with prob. p of success n! Pr of k successes: P X =k = p k 1− pn−k k !n−k ! Example: – – – 10% of microchips are defective. We pull a batch of 10 chips What is the probability of at least one defective? ● ● Much easier to figure out probability of none defective Here, n = 10, p = 0.10, and we want to use k = 0 Binomial Distribution – Example 3 ● ● ● N Bernoulli trials, each with prob. p of success n! k n−k Pr of k successes: P X =k = p 1− p k !n−k ! Example: – – 10% of microchips are defective; look at 10 chips What is the probability of at least one defective? ● ● ● Much easier to figure out probability of none defective Here, n = 10, p = .10, and we want to use k = 0 P X =0 = 10! 0.10 1−0.110−0 0! 10−0! note : 0!=1 Binomial Distribution – Example 3 ● ● ● N Bernoulli trials, each with prob. p of success n! Pr of k successes: P X =k = p k 1− pn−k k !n−k ! Example: – – 10% of microchips are defective; look at 10 chips What is the probability of at least one defective? ● ● ● Much easier to figure out probability of none defective Here, n = 10, p = .10, and we want to use k = 0 P X =0 = 10 ! 0.10 1−0.110−0=1×1×0.3486=0.3486 0 ! 10−0! Binomial Distribution – Example 3 ● ● ● N Bernoulli trials, each with prob. p of success n! k n−k Pr of k successes: P X =k = p 1− p k ! n−k ! Example: – – 10% of microchips are defective; look at 10 chips What is the probability of at least one defective? ● ● Much easier to figure out probability of none defective Here, n = 10, p = .10, and we want to use k = 0 10! 0.10 1−0.110−0=1×1×0.3486=0.3486 0! 10−0! ● P X =0 = ● P X ≠0=1−P X =0=1−0.3486=0.6514 Binomial Distribution – Mean and Variance ● If X is binomially distributed with parameters n and p, then: – – ● Its mean is np Its variance is np(1p) Examples: – The mean number of women promoted should be... Binomial Distribution – Mean and Variance ● If X is binomially distributed with parameters n and p, then: – – ● Its mean is np Its variance is np(1p) Examples: – – The mean number of women promoted should be 6∙0.4 = 2.4. The standard deviation: 6×0.4×0.6= 1.44=1.2 The mean number of defective microchips should be... Binomial Distribution – Mean and Variance ● If X is binomially distributed with parameters n and p, then: – – ● Its mean is np Its variance is np(1p) Examples: – – The mean number of women promoted should be 6∙0.4 = 2.4. The standard deviation: 6×0.4×0.6= 1.44=1.2 The mean number of defective microchips should be 10∙.1 = 1. The std. dev.: 10×0.1×0.9= .9=.9486 Poisson Distribution ● Poisson Distribution maps how many times a given event happens in a time interval. – – ● Number of people arriving at a line every hour Number of auto fatalities that happen in a day If the mean number of times the event happens every hour (or day or year) is ... – – What is the expected number of times? How likely is it that the event will happen once? Twice? Fifteen times?.... Poisson Distribution – Amnesia ● Poisson distribution assumes amnesia: How many times it has already happened is irrelevant to whether it will happen again. – – How many people have had an auto accident on a given day does not affect the probability of an additional person getting into an accident How many people have already arrived at a bus stop in an hour does not affect the probability of one more person arriving during that hour Poisson Distribution – Formula If X is a random variable following the Poisson distribution with mean , then the probability that X will take on a particular value t is P(X = t) = et/t! Where e = 2.7182818.... Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – On some stretch of highway, there is a mean of two accidents per day. – What is the probability that here will be one accident? – What is the probability that there will be at least one accident? Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – – On some stretch of highway, there is a mean of two accidents per day. What is the probability that there will be exactly one accident? ● Here, µ=2, and we want to know P(X=1), i.e., t = 1 Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – – On some stretch of highway, there is a mean of two accidents per day. What is the probability that there will be exactly one accident? ● ● Here, =2, and we want to know P(X=1), i.e., t = 1 P(X = 1) = et/t! = e221/1! = 0.135 ∙ 2/1 = 0.27 Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – Mean of two accidents per day; what is the probability that there will be at least one accident? ● Here, =2, and we want to know P(X>0), i.e., t = 1,2,3,4... Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – Mean of two accidents per day; what is the probability that there will be at least one accident? ● ● Here, =2, and we want to know P(X>0), i.e., t = 1,2,3,4... This is impossible so we compute P(X > 0) = 1 – P(X = 0) Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – Mean of two accidents per day; what is the probability that there will be at least one accident? ● ● ● Here, =2, and we want to know P(X>0), i.e., t = 1,2,3,4... This is impossible so we compute P(X > 0) = 1 – P(X = 0) P(X = 0) = et/t! = e220/0! = 0.135∙1/1 = 0.135 Poisson Distribution – Example 1 ● ● Probability that a Poisson variable with mean t equals some number t: P(X = t) = e /t! Example: – Mean of two accidents per day; what is the probability that there will be at least one accident? ● ● ● ● Here, =2, and we want to know P(X>0), i.e., t = 1,2,3,4... This is impossible so we compute P(X > 0) = 1 – P(X = 0) P(X = 0) = et/t! = e220/0! = 0.135∙1/1 = 0.135 P(X > 0) = 1 – P(X = 0) = 1 – 0.135 = 0.865 Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... P(X ≥ 3) = 1 – P(X<3) = 1 – P(X=0) – P(X=1) – P(X=2) Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● ● ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... P(X ≥ 3) = 1 – P(X<3) = 1 – P(X=0) – P(X=1) – P(X=2) P(X = 0) = e330/0! = 0.0497∙1/1 = 0.0497 Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● ● ● ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... P(X ≥ 3) = 1 – P(X<3) = 1 – P(X=0) – P(X=1) – P(X=2) P(X = 0) = e330/0! = 0.0497∙1/1 = 0.0497 P(X = 1) = e331/1! = 0.0497∙3/1 = 0.1491 Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● ● ● ● ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... P(X ≥ 3) = 1 – P(X<3) = 1 – P(X=0) – P(X=1) – P(X=2) P(X = 0) = e330/0! = 0.0497∙1/1 = 0.0497 P(X = 1) = e331/1! = 0.0497∙3/1 = 0.1491 P(X = 2) = e332/2! = 0.0497∙9/2 = 0.2237 Poisson Distribution – Example 2 ● Example: – A mean of three people arrive in a line in an average minute. In one given minute, what is the probability that at least three people will arrive? ● ● ● ● ● ● Here, µ=3, and we want to know P(X ≥ 3), i.e. t = 3,4,5.... P(X ≥ 3) = 1 – P(X<3) = 1 – P(X=0) – P(X=1) – P(X=2) P(X = 0) = e330/0! = 0.0497∙1/1 = 0.0497 P(X = 1) = e331/1! = 0.0497∙3/1 = 0.1491 P(X = 2) = e332/2! = 0.0497∙9/2 = 0.1988 P(X ≥ 3) = 1 – .0497 – .1491 – .2237 = 1 .4225 = .6775 Poisson Distribution – Mean If X is a Poisson distributed variable with mean , then its expected value is also . – This may sound obvious, but it doesn't immediately follow that the formulas compute that way. Poisson Distribution – Variance Less obviously, its variance is also . – – The random variable in our first example has mean 2 and variance 2 The random variable in our second example has mean 3 and variance 3 Poisson Approximation to Binomial ● ● When x is more than about 50, x! Becomes too big for most computers When n is large and p small, we can use a Poisson variable with =np to approximate a Binomial Poisson Approximation to Binomial ● When n is large and p small, we can use a Poisson variable with =np to approximate a Binomial – Example: ● ● 52 cards in a deck; .0769 (4/52) are Aces If we draw 5 cards, what is the chance of drawing exactly one Ace? Poisson Approximation to Binomial ● When n is large and p small, we can use a Poisson variable with =np to approximate a Binomial – Example: ● ● ● 52 cards in a deck; .0769 (4/52) are Aces If we draw 5 cards, what is the chance of drawing exactly one Ace? Here, n = 5, p = .0769, we want to know P(X=1) Poisson Approximation to Binomial ● When n is large and p small, we can use a Poisson variable with =np to approximate a Binomial – Example: ● ● ● ● 52 cards in a deck; .0769 (4/52) are Aces If we draw 5 cards, what is the chance of drawing exactly one Ace? Here, n = 5, p = .0769, we want to know P(X=1) So we use Poisson with = np = 5∙.0769 = .3845 Poisson Approximation to Binomial ● When n is large and p small, we can use a Poisson variable with =np to approximate a Binomial – Example: ● ● ● ● 52 cards in a deck; .0769 (4/52) are Aces If we draw 5 cards, what is the chance of drawing exactly one Ace? Here, n = 5, p = .0769, we want to know P(X=1) So we use Poisson with = np = 5∙.0769 = .3845