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
© 2003 Pearson Prentice Hall Chapter 4 Discrete Random Variables 4-1 Learning Objectives © 2003 Pearson Prentice Hall 1. Distinguish Between the Two Types of Random Variables 2. Compute the Expected Value & Variance of Discrete Random Variables 3. Describe the Binomial Distribution and calculate probabilities for it 4. Understand derivation of formulas for mean and variance of binomial distribution 4-2 Data Types © 2003 Pearson Prentice Hall Data Numerical Discrete 4-3 Continuous Qualitative © 2003 Pearson Prentice Hall Discrete Random Variables 4-4 Random Variable © 2003 Pearson Prentice Hall Assign numeric values to outcomes of an “experiment” Random Variable takes on different possible values corresponding to experiment outcomes Example: Number of Tails in 2 Coin Tosses 4-5 © 2003 Pearson Prentice Hall Possible values are discrete Discrete Random Variable E.g., Whole Number (0, 1, 2, 3 etc.) Obtained by Counting Usually Finite Number of Values 4-6 But could be infinite (must be “countable”) © 2003 Pearson Prentice Hall Exercise 4.3: Discrete or Continuous? Number of misspelled words Amount of water through Hoover dam in a day How late for class Number of bacteria in a water sample Amount of CO produced from burning a gallon of unleaded gas Your weight Number of checkout lanes at grocery store Amount of time waiting in line at grocery store 4-7 © 2003 Pearson Prentice Hall Discrete Probability Distribution 1. List of All possible [x, p(x)] pairs x = Value of Random Variable (Outcome) p(x) = Probability Associated with Value 2. Mutually Exclusive (No Overlap) 3. Collectively Exhaustive (Nothing Left Out) 4. 0 p(x) 1 5. p(x) = 1 4-8 © 2003 Pearson Prentice Hall Discrete Probability Distribution Example Experiment: Toss 2 Coins. Count # Tails. Probability Distribution Values, x Probabilities, p(x) © 1984-1994 T/Maker Co. 4-9 0 1/4 = .25 1 2/4 = .50 2 1/4 = .25 Visualizing Discrete Probability Distributions © 2003 Pearson Prentice Hall Listing Table # Tails f(x) Count p(x) 0 1 2 1 2 1 .25 .50 .25 { (0, .25), (1, .50), (2, .25) } p(x) .50 .25 .00 Graph Equation p ( x) x 0 4 - 10 1 2 n! p x (1 p) n x x !(n x)! Summary Measures © 2003 Pearson Prentice Hall 1. Expected Value Mean of Probability Distribution Weighted Average of All Possible Values May not equal any of the possible values = E(X) = x p(x) 2. Variance Weighted Average Squared Deviation about Mean 2 = E[ (x (x p(x) 4 - 11 Thinking Challenge © 2003 Pearson Prentice Hall You toss 2 coins. You’re interested in the number of tails. What are the expected value & standard deviation of this random variable, number of tails? © 1984-1994 T/Maker Co. 4 - 12 © 2003 Pearson Prentice Hall x p(x) 0 .25 1 .50 2 .25 4 - 13 Expected Value & Variance Solution* x p(x ) x- (x -) 2 2 (x -) p( x ) © 2003 Pearson Prentice Hall Expected Value & Variance Solution* x p(x) x p(x ) 0 .25 0 1 .50 .50 2 .25 .50 = 1.0 4 - 14 x- (x -) 2 2 (x -) p( x ) © 2003 Pearson Prentice Hall Expected Value & Variance Solution* 2 x p(x) x p(x ) x- (x -) 0 .25 0 -1.00 1.00 .25 1 .50 .50 0 0 0 2 .25 .50 1.00 1.00 .25 = 1.0 4 - 15 2 (x -) p( x ) = .50 2 Exercise 4.25 © 2003 Pearson Prentice Hall Values 0, 1, 2 Dist X has probabilities .3, .4, .3 Dist Y has probabilities .1, .8, .1 Without doing any calculations: Which distribution has higher mean? Which distribution has higher variance? 4 - 16 © 2003 Pearson Prentice Hall Definition of Independence X and Y are independent if (and only if) For any sets of outcome values A and B P(X in A and Y in B) = P(X in A)P(Y in B) That is, any pair of events defined by outcome sets for X and Y are independent events 4 - 17 Binomial Distribution © 2003 Pearson Prentice Hall 1. Number of ‘Successes’ in a Sample of n Observations (Trials) # Reds in 15 Spins of Roulette Wheel # Defective Items in a Batch of 5 Items # Correct on a 33 Question Exam # Customers Who Purchase Out of 100 Customers Who Enter Store # of Bush-Cheney supporters in survey of 100 people 4 - 18 © 2003 Pearson Prentice Hall Binomial Distribution Properties 1. Sequence of n Identical Trials 2. Each Trial Has 2 Outcomes ‘Success’ (Desired/specified Outcome) or ‘Failure’ 3. Constant Trial Probability 4. Trials Are Independent 5. # of successes in n trials is a binomial random variable 4 - 19 Exercise: Binomial? © 2003 Pearson Prentice Hall Pick 6 students from this class Each flips a coin Count # of heads Pick 6 students from this class X= # of 1st year students selected Random digit dialing of 100 numbers # of Bush-Cheney supporters Random digit dialing of 100 numbers Sum of ages of respondents 4 - 20 © 2003 Pearson Prentice Hall Binomial Probability Distribution Function n x n x n! x n x p( x) p q p (1 p) x!(n x)! x p(x) = Probability of x ‘Successes’ n = Sample Size p = Probability of ‘Success’ x = Number of ‘Successes’ in Sample (x = 0, 1, 2, ..., n) 4 - 21 Binomial Probability Distribution Example © 2003 Pearson Prentice Hall Experiment: Toss 1 Coin 5 Times in a Row. Note # Tails. What’s the Probability of 3 Tails? n! x n x p( x ) p (1 p ) x !(n x )! 5! 3 5 3 p(3) .5 (1 .5) 3 !(5 3)! 0.3125 4 - 22 © 2003 Pearson Prentice Hall Cumulative Distribution Function Fx a Pr X a p x xa 4 - 23 © 2003 Pearson Prentice Hall Binomial Probability Table (Portion) n=5 p k .01 … 0.50 … .99 0 .951 … .031 … .000 1 .999 … .188 … .000 2 1.000 … .500 … .000 3 1.000 … .812 … .001 4 1.000 … .969 … .049 Cumulative Probabilities FX(k) 4 - 24 © 2003 Pearson Prentice Hall Binomial Distribution Characteristics Mean E ( x ) np P(X) .6 .4 .2 .0 np (1 p) X 0 Standard Deviation P(X) .6 .4 .2 .0 1 2 3 4 5 n = 5 p = 0.5 X 0 4 - 25 n = 5 p = 0.1 1 2 3 4 5 Exercise 4.37 © 2003 Pearson Prentice Hall N=4, x=2, q=.4– compute p(x) 4 - 26 Exercise 4.39 © 2003 Pearson Prentice Hall N=25, p=.5 Compute E(X), Var(X), sigma 4 - 27 Exercise 4.51 © 2003 Pearson Prentice Hall Pr(domestic abuse) = 1/3, or maybe 1/10 Sample of 15 women; 4 have been abused If p=1/3, what is Pr(X>=4)? If p=1/10, what is pr(X>=4)? Given evidence from the sample, which abuse rate seems more plausible? Note: this is a preview of thinking about sampling distributions 4 - 28 Exercise 4.109 © 2003 Pearson Prentice Hall Response rate p=.4 If mail 20, what is Pr(X>12)? If want 100 responses with Pr > .95, how many should you mail? 4 - 29 4.109 Solution © 2003 Pearson Prentice Hall By empirical rule, 95% of observations are within 2sigma Find n such that mu-2sigma > 100 Mu = .4n Sigma squared = npq=.24n Solving for n 292 Note that for n=292 E(X) =292*.4=116.8 In order to be sure to get 100, need to have a higher average number of returns 4 - 30 Useful Observation 1 © 2003 Pearson Prentice Hall For any X and Y E X Y x y p( x y) x y xp( x y ) yp( x y ) x y x y x p( x y) y p( x y) x y y xp x yp y x 4 - 31 y E X E Y x One Binary Outcome © 2003 Pearson Prentice Hall Random variable X, one binary outcome Code success as 1, failure as 0 P(success)=p, p(failure)=(1-p)=q E(X) = p Var X E X E X 2 E X E X 2 2 p *1 q * 0 p 2 2 p p p1 p 2 4 - 32 2 Mean of a Binomial © 2003 Pearson Prentice Hall Independent, identically distributed X1, …, Xn; E(Xi)=p; Binomial X = X i E X i E X i nE X1 np 4 - 33 By useful observation 1 Useful Observation 2 © 2003 Pearson Prentice Hall For independent X and Y E XY xy p ( x y ) x y xyp x p y x y xp x yp y xp x E Y x y x E Y xp x E Y E X E X E Y x 4 - 34 Useful Observation 3 For independent X and Y Var X Y E X Y E X Y 2 2 2 2 E X E Y 2 E XY E X Y 2 XY E X E Y 2 2 2 E X E Y 2 E X E Y 2 2 2 2 2 2 E X E X E Y E Y 2 E XY 2 E X E Y cancels by obs. 2 E X 2 E X 2 E Y 2 E Y 2 Var X Var Y Variance of Binomial © 2003 Pearson Prentice Hall Independent, identically distributed X1, …, Xn; E(Xi)=p; Binomial X = X i Var X i Var X i nVar X i np1 p 4 - 36 © 2003 Pearson Prentice Hall 4 - 37 End of Chapter Any blank slides that follow are blank intentionally. © 2003 Pearson Prentice Hall Useful Observation 4 (We’ll use this later) For any X Var kX E k 2 X 2 E kX 2 kE X 2 2 2 2 k E X k E X 2 k E X 2 k Var X 2 4 - 39 2