MICHIGAN STATE UNIVERSITY STT 351 SECTION 2 FALL 2008 LECTURE NOTES Chapter 3 Discrete Random Variables Nao Mimoto Contents 1 Random Variables 2 2 Probability Distributions for Discrete Variables 3 3 Expected Values and Variance 10 4 Popular Discrete Random Variables 13 4.1 Bernoulli Random Variable........................... 14 4.2 Binomial Random Variable........................... 15 4.3 Geometric Random Variable.......................... 21 4.4 Negative Binomial Random Variable..................... 22 4.5 Hypergeometric Random Variable....................... 23 4.6 Poisson Random Variable........................... 26 1
Lecture notes for Devore 7ed. Chapter 3 2 1 Random Variables Random Variable a real numbers. is a function whose domain is a sample space, and whose range is Example Roll a die once. Let a random variable X to be a number on the die. S = {1, 2, 3, 4, 5, 6} The the function X is mapping 1 1 2 2 3 3 4 4 5 5 6 6 Example Roll a die twice. Let a random variable X to be the sum of two numbers. S = { (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6) (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6) (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6) (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6) (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6) (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6) } The the function X is mapping (1, 2) 3 (3, 3) 6 (4, 5) 9 (2, 2) 4.
Lecture notes for Devore 7ed. Chapter 3 3 Discrete Random Variable is a r.v. whose range is a finite or countably infinite set. Continuous Variable is a r.v. whose range is a interval on a real line or a disjoint union of such intervals. It also must satisfy that for any constant c, P (X = c) = 0. Exercise 1 A concrete beam may fail either by shear(s) or flexure (F). Suppose three of failed beams are randomly selected, and the type of failure is determined for each one. Let X be the number of beams among the three selected that failed by shear. List each outcome in the sample space, along with the associated value of X. S X (F, F, F ) 0 (F, F, S) 1 (F, S, S) 2 (S, S, S) 3 2 Probability Distributions for Discrete Variables Probability Mass Function: variable Xis defined as (pmf) or probability distribution of a discrete random p(x) = P (X = x) If x 1, x 2, x 3,... represent the range of random variable X, then p(x i ) 0 for i = 1, 2, 3,... p(x) 0 for all other values of x i=1 p(x i) = 1
Lecture notes for Devore 7ed. Chapter 3 4 Example Roll a die once. Let a random variable X to be a number on the die. The pmf of X is p(1) = P (X = 1) = 1/6 p(2) = P (X = 2) = 1/6 p(3) = P (X = 3) = 1/6 p(4) = P (X = 4) = 1/6 p(5) = P (X = 5) = 1/6 p(6) = P (X = 6) = 1/6
Lecture notes for Devore 7ed. Chapter 3 5 Example Roll a die twice. Let a random variable X to be the sum of two numbers. S = { (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6) (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6) (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6) (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6) (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6) (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6) } The pmf of X is p(1) = P (X = 1) = 0 p(2) = P (X = 2) = 1/36 p(3) = P (X = 3) = 2/36 p(4) = P (X = 4) = 3/36 p(5) = P (X = 5) = 4/36 p(6) = P (X = 6) = 5/36 p(7) = P (X = 7) = 6/36 p(8) = P (X = 8) = 5/36 p(9) = P (X = 9) = 4/36 p(10) = P (X = 10) = 3/36 p(11) = P (X = 11) = 2/36 p(12) = P (X = 12) = 1/36 p(13) = P (X = 13) = 0
Lecture notes for Devore 7ed. Chapter 3 6 Cumulative Distribution Function: (cdf) of a discrete random variable X with pmf p(x) is defined for all x on real line by F (x) = P (X x) = p(y) For any number x, F (x) is the probability that the observed value of X will be at most x. y:y x Example Roll a die once. Let a random variable X to be a number on the die. The cdf of X is F (1) = P (X 1) = 1/6 F (2) = P (X 2) = 2/6 F (3) = P (X 3) = 3/6 F (4) = P (X 4) = 4/6 F (5) = P (X 5) = 5/6 F (6) = P (X 6) = 6/6 Example Roll a die twice. Let a random variable X to be the sum of two numbers. The cdf of X is F (1) = P (X 1) = 0 F (2) = P (X 2) = 1/36 F (3) = P (X 3) = 3/36 F (4) = P (X 4) = 6/36 F (5) = P (X 5) = 10/36 F (6) = P (X 6) = 15/36 F (7) = P (X 7) = 21/36 F (8) = P (X 8) = 26/36 F (9) = P (X 9) = 30/36 F (10) = P (X 10) = 33/36 F (11) = P (X 11) = 35/36 F (12) = P (X 12) = 36/36 F (13) = P (X 13) = 36/36
Lecture notes for Devore 7ed. Chapter 3 7 pmf cdf If X is a discrete random variable, then P (a X b) = P (X b) P (X a) = F (b) F (a) For example, P (3 X 5) = F (5) F (2)
Lecture notes for Devore 7ed. Chapter 3 8 Exercises 13 A mail-order sales business have six telephone lines. Let X denote the number of lines in use at a specified time. Suppose the pmf of X is as follows: x 0 1 2 3 4 5 6 p(x).1.15.2.25.2.06.04 Calculate the each of following probabilities: a P{ at most three lines are in use} = P (X 3) = (.1) + (.15) + (.2) + (.25) =.7 b P{ fewer than three lines are in use} = P (X < 3) = (.1) + (.15) + (.2) =.45 c P{ at least three lines are in use } = P (X 3) = 1 P (X 2) = 1.45 =.55 d P{ between two and five lines, inclusive, are in use} = P (2 X 5) = (.2) + (.25) + (.2) + (.06) =.71 e P{ between two and four lines, inclusive, are not in use} = P (2 X 4) = (.2) + (.25) + (.2)+ =.65 f P{ at least four lines are not in use} = P (X 2) = (.1) + (.15) =.25
Lecture notes for Devore 7ed. Chapter 3 9 Exercises 23 Given Calculate F (x) = 0 x < 0 P (X 0).06 0 x < 1 P (X 1).19 1 x < 2 P (X 2).39 2 x < 3 P (X 3).67 3 x < 4 P (X 4).92 4 x < 5 P (X 5).97 5 x < 6 P (X 6).1 6 x < 7 P (X 7) a p(2) b P (X > 3) = P (X = 2) = F (2) F (1) =.39.19 =.2 = 1 P (X 3) = 1 F (3) = 1.39 =.61 c P (2 X 5) = P (X 5) P (X 2) = F (5) F (1) =.97.19 =.78 d P (2 < X < 5) = P (X < 5) P (X < 2) = F (4) F (2) =.92.39 =.53
Lecture notes for Devore 7ed. Chapter 3 10 3 Expected Values and Variance Expected Value of a random variable X, whose range is x 1, x 2, x 3,... x n is defined as E(X) = µ = x i p(x i ) i=1 Example Roll a die once. Let a random variable X to be a number on the die. Then the expected value of X is E(X) = 1 1 6 + 2 1 6 + 3 1 6 + 4 1 6 + 5 1 6 + 6 1 6 = 3.5 Example Roll a die twice. Let a random variable Y to be the sum of two numbers. Then, 1 E(Y ) = 2 36 + 3 2 36 + 4 3 36 + 5 4 36 + 6 5 36 6 +7 36 + 8 5 36 + 9 4 36 + 10 3 36 + 11 2 36 + 12 1 36 = 7 Expected Value of a function of random variable X, say g(x) is defined as E ( g(x) ) = g(x i ) p(x i ) i=1 Example Let a random variable X to be a number of the rolled die. Then E(X 2 ) = 1 2 1 6 + 22 1 6 + 32 1 6 + 42 1 6 + 52 1 6 + 62 1 6 = 15.16667 ( 1 ) E = 1/1 1 X 6 + 1/2 1 6 + 1/3 1 6 + 1/4 1 6 + 1/5 1 6 + 1/6 1 6 = 0.40833 Note that they are not equal to ( E(X) ) 2 and 1/E(x).
Lecture notes for Devore 7ed. Chapter 3 11 E(3X + 5) = (3 1 + 5) 1 1 1 + (3 2 + 5) + (3 3 + 5) 6 6 6 +(3 4 + 5) 1 1 1 + (3 5 + 5) + (3 6 + 5) 6 6 6 = 15.5 Note that it is equal to 3E(X) + 5. Property 1 If a and b are constants, then E(aX + b) = ae(x) + b Variance of a random variable X is defined as V (X) = σ 2 = (x i µ) 2 p(x i ) = E ( X E(X) ) 2. i=1 Note that µ = E(X). Standard Deviation of X is defined as σ = σ 2. An alternate formula σ 2 = = = for a variance of a random variable X can be derived as follows: (x i µ) 2 p(x i ) i=1 (x 2 i 2x i µ + µ 2 ) p(x i ) i=1 x 2 i p(x i ) i=1 = E(X 2 ) 2µ 2x i µ p(x i ) + i=1 µ 2 p(x i ) i=1 x i p(x i ) +µ 2 p(x i ) i=1 = E(X 2 ) µ 2 ( = E(X 2 ) E(X) } {{ } µ ) 2 i=1 } {{ } 1
Lecture notes for Devore 7ed. Chapter 3 12 Property 1 If a and b are constants, then V (ax + b) = a 2 V (X) Example Let a random variable X to be a number of the rolled die. Then V (X) = (1 3.5) 2 1 6 +(2 3.5)2 1 6 +(3 3.5)2 1 6 +(4 3.5)2 1 6 +(5 3.5)2 1 6 +(6 3.5)2 1 6 = 2.9167 You could have gotten this by the alternative formula; V (X) = E(X 2 ) (E(X)) 2 = 15.16667 (3.5) 2 = 2.9167. Exercise 30 An individual who has auto insurance from a company A is randomly selected. Let Y be the number of moving violations for which the individual was cited during the last 3 years. The pdf of Y is y 0 1 2 3 p(y).60.25.10.05 a Compute E(Y ). E(Y ) = 0(.6) + 1(.25) + 2(.1) + 3(.05) =.6. b Suppose an individual with Y violations incurs a surcharge of $100Y 2. Calculate the expected amount of the surcharge. ( ) E(100Y 2 ) = 100 0 2 (.6) + 1 2 (.25) + 2 2 (.1) + 3 2 (.05) = 110.
Lecture notes for Devore 7ed. Chapter 3 13 4 Popular Discrete Random Variables If you have a coin which has probability p of landing head up when tossed, then, Bernoulli(p) Binomial(p, n) Geometric(p, n) Negative Binomal(p, r) Toss a coin once. 1 if head, 0 if tail. Number of heads in n tosses Number of tosses until you get the first head Number of tails until you get r heads Other type of discrete random variables includes: Hypergeometric(n, N, m) Poisson(λ) Number of white balls if n balls selected from an urn with N balls which includes m whites. Rare event with rate λ per unit time.
Lecture notes for Devore 7ed. Chapter 3 14 4.1 Bernoulli Random Variable Analogy: Toss a coin once. 1 if head, 0 if tail. pmf of Bernoulli(p) is { p(x = 0) = (1 p) pmf for Bernoulli(p) looks like p(x = 1) = p Does it add up? 1 p(x = x) = p + (1 p) x=0 = 1 Mean If r.v. X has Bernoulli(p) distribution, then E(X) = x i p(x i ) = (1)p + (0)(1 p) = p. i=1 Variance If r.v. X has Bernoulli(p) distribution, then E(X 2 ) = x 2 i p(x i ) = (1 2 )p + (0 2 )(1 p) = p. Therefore, V (X) = E(X 2 ) ( E(X) ) 2 = p p 2 = p(1 p) i=1
Lecture notes for Devore 7ed. Chapter 3 15 4.2 Binomial Random Variable Analogy: Number of heads in n tosses. pmf of Binomial(n, p) is { b(x = x) = ( n x) (1 p) n x p x for x = 0, 1, 2,... n 0 otherwise pmf for Binomial(6,.5) looks like this pmf for Binomial(10,.2) looks like this
Lecture notes for Devore 7ed. Chapter 3 16 cdf of Binomial(n, p) is Does it add up? If you sum the pmf, B(x) = x y=0 ( ) n (1 p) n y p y. y 1 p(x = x) = x=0 = = p(x i ) i=1 = 1. ( ) n (1 p) n x p x x x=0 ( ) n p + (1 p) Mean If r.v. X has Binomial(n, p) distribution, then E(X) = by using the identity ( ) n x = x x i p(x i ) = i=1 = = ( ) n x (1 p) n x p x x ( ) n x (1 p) n x p x x ( ) n 1 n (1 p) n x p x x 1 x=0 x=1 x=1 xn! (n x)!x! = n(n 1)! (n x)!(x 1)! = n ( ) n 1, x 1 for x = 1, 2, 3,... n. Then we have ( ) n 1 E(X) = n (1 p) n x p x x 1 x=1 ( ) n 1 = n (1 p) n j 1 p j j j=0 }{{} pmf of Bin(n-1, p) = np p
Lecture notes for Devore 7ed. Chapter 3 17 Variance If r.v. X has Binomial(n, p) distribution, then E(X 2 ) = = = ( ) n x 2 (1 p) n x p x x ( ) n x 2 (1 p) n x p x x ( ) n 1 xn (1 p) n x p x x 1 x=0 x=1 x=1 by again using the identity ( ) ( ) n n 1 x = n, x x 1 for x = 1, 2, 3,... n. By changing the index to j = x 1, we have E(X) = ( ) n 1 n (j + 1) (1 p) n j 1 p j j j=0 }{{} pmf of Bin(n-1, p) = np E(Y + 1) p where Y is a r.v. with Bin(n 1, p) distribution. Since E(Y + 1) = E(Y ) + 1, we have Therefore, ( ) E(X 2 ) = n (n 1)p + 1 V (X) = E(X 2 ) ( E(X) ) 2 ( ) = n (n 1)p + 1 (np) 2 = np(1 p)
Lecture notes for Devore 7ed. Chapter 3 18 Exercise 47 Use Appendix Table A.1 to obtain the followings: a B(4; 15,.3) b b(4; 15,.3) c b(6; 15,.7) =.515 = B(4; 15,.3) B(3; 15,.3) =.515.297 = B(6; 15,.7) B(5; 15,.7) =.015.004 =.09 d P (2 X 4) when X Bin(15,.3) = B(4; 15,.3) B(1; 15,.3) =.515.035 =.480 e P (2 X when X Bin(15,.3) = 1 P (X < 2) = 1 B(1; 15,.3) = 1.035 =.965 f P (X 1) when X Bin(15,.7) = B(1, 15,.7) =.000 g P (2 < X < 6) when X Bin(15,.3) = B(5; 15,.3) B(2; 15,.3) =.722.127 =.595 Exercise 49 A company that produces fine crystal knows from experience that 10% of its goblets have cosmetic flaws and must be classified as seconds. a Among six randomly selected goblets, how likely is it that only one is a second? This is Binomial(6,.1). So answer is b(1; 6,.1) = ( ) 6 (.9) 5 (.1) = 0.354 1
Lecture notes for Devore 7ed. Chapter 3 19 b Among six randomly selected goblets, what is the probability that at least two are seconds? = 1 P ( one is second) = 1 b(1; 6,.1) =.646 Exercise 58 A very large batch of components has arrived at a distributor. The batch can be characterized as acceptable only if the proportion of defective components is at most.1. The distributor decides to randomly select 10 samples from the batch, and accept the batch only if the number of defective components is the sample is at most 2. a What is the probability that the batch will be accepted when the actual proportion of defectives is.01?.05?.1?.2?.25? b Sketch operating characteristic curve. This problem can be modeled by Binomial(10,.1). So the probability of accepting the batch is P (X 2) = B(2; 10,.1) =.930 If actual proportion of defectives are different, then B(2; 10,.01) = 1 B(2; 10,.05) =.988 B(2; 10,.1) =.930 B(2; 10,.2) =.678 B(2; 10,.25) =.526
Lecture notes for Devore 7ed. Chapter 3 20 c Repeat the analysis with new rule of accepting the batch only if less than 1 out of 10 sample is defective. B(1; 10,.01) =.996 B(1; 10,.05) =.914 B(1; 10,.1) =.736 B(1; 10,.2) =.376 B(1; 10,.25) =.244 d Repeat the analysis with new rule of accepting the batch only if less than 2 out of 15 sample is defective. B(2; 15,.01) = 1 B(2; 15,.05) =.964 B(2; 15,.1) =.816 B(2; 15,.2) =.398 B(2; 15,.25) =.236
Lecture notes for Devore 7ed. Chapter 3 21 4.3 Geometric Random Variable Analogy: Number of tosses until you get the first head. pmf of Geometric(p) is p(x = x) = (1 p) x 1 p for x = 1, 2,... pmf for Geometric(.5) looks like Does it add up? p(x = x) = x=1 = p = p (1 p) x p x=1 = p = 1 (1 p) x 1 x=1 (1 p) j j=0 1 1 (1 p) Mean If r.v. X has Geometric(n, p) distribution, then E(X) = 1 p
Lecture notes for Devore 7ed. Chapter 3 22 Variance If r.v. X has Geometric(n, p) distribution, then V (X) = 1 p p 2 4.4 Negative Binomial Random Variable Analogy: Number of tails until you get r heads. pmf of Negativebinomial(r, p) p(x = x) = nb(x; r, p) = ( ) x+r 1 r 1 (1 p) x p r for x = 0, 1, 2,... pmf for Negativebinomial(3,.5) looks like Mean If r.v. X has Negativebinomial(r, p) distribution, then E(X) = r p
Lecture notes for Devore 7ed. Chapter 3 23 Variance If r.v. X has Negativebinomial(r, p) distribution, then V (X) = r(1 p) p 2 4.5 Hypergeometric Random Variable Analogy: Number of white balls if n balls selected from an urn with N balls which includes m whites. Pmf of Hypergeometric(n, m, N) is ( m N m ) p(x = x) = h(x; n, M, N) = x)( n x ( N n) for max(0, n N + m) x min(n, m), and 0 otherwise. pmf for Hypergeometric(10, 10, 30) looks like Mean If r.v. X has Hypergeometric(n, m, N) distribution, then E(X) = nm N
Lecture notes for Devore 7ed. Chapter 3 24 Variance If r.v. X has Hypergeometric(n, m, N) distribution, then V (X) = N n ( N 1 nm 1 m ) N N Exercise 49 A company that produces fine crystal knows from experience that 10% of its goblets have cosmetic flaws and must be classified as seconds. c If goblets are examined one by one, what is the probability that at most five must be selected to find four that are not seconds? The number of seconds examined until four non-seconds is Negativebinomial(4,.9) distribution. Therefore, the answer is P (X 1) = p(0) + p(1)
Lecture notes for Devore 7ed. Chapter 3 25 Exercise 71 A geologist has collected 10 specimens of basaltic rock and 10 specimens of granite. The geologist instructs a laboratory assistant to randomly select 15 of the specimen for analysis. a What is the pmf of the number of granite specimen selected for analysis. b What is the probability hat all specimens of one of the two types of rock are selected for analysis. c What is the probability that the number of granite specimens selected for analysis is within 1 standard deviation of its mean value? So if you let X to be the number of granite specimen selected, then X is Hypergeometric(15, 10, 20). Therefore, b ( ) P ( all are basaltic ) ( all are granite) = P (( all are basaltic ) + P ( all are basaltic ) ( ) P ( all are basaltic ) ( all are granite) = P (X = 0) + P (X = 15) = h(0; 15, 10, 20) + h(15; 15, 10, 20) c SD for Hypergeometric(15, 20, 10) is N n ( σ = N 1 nm 1 m ) N N = = 20 15 ( 20 1 1510 1 10 ) 20 20 5 15 19 4
Lecture notes for Devore 7ed. Chapter 3 26 4.6 Poisson Random Variable Analogy: Rare event with rate λ per unit time. pmf of Poisson(λ) is pmf for Poisson(λ) looks like p(x = x) = e λ λ x x! for x = 0, 1, 2,... Does it add up? p(x) = x=0 e λ λ x x=0 x! = e λ = e λ e λ = 1. x=0 λ x x! Using the identity e x = 1 + x + x2 2! + x3 3! + x4 4! +
Lecture notes for Devore 7ed. Chapter 3 27 Mean If r.v. X has Poisson(λ) distribution, then E(X) = x e λ λ x x! x=0 = e λ λ x 1 λ (x 1)! x=1 = λ e λ λ j j! j=0 }{{} by changing index to j = x-1 = λ Variance If r.v. X has Poisson(λ) distribution, then Therefore, E(X 2 ) = x 2 e λ λ x x! x=0 = λ x e λ λ x 1 (x 1)! x=1 = λ (j + 1) e λ λ j by changing index to j = x-1 j! j=0 ( = λ j e λ λ j ) e λ λ j + j! j! j=0 j=0 }{{} E(X) = λ(λ + 1) V (X) = E(X 2 ) ( E(X) ) 2 = λ(λ + 1) λ 2 = λ. Poisson as a limit If we let n, p 0, in such a way that np λ, then the pmf b(x; n, p) p(x; λ).
Lecture notes for Devore 7ed. Chapter 3 28 Exercise 80 Suppose the number X of tornadoes observed in a particular region during a 1-year period has a Poisson distribution with λ = 8. a Compute P (X 5) = p(0; 8) + p(1; 8) + p(2; 8) + p(3; 8) + p(4; 8) + p(5; 8). c What is the probability that the observed number of tornadoes exceeds the expected number by more than 1 standard deviation? Mean an SD for Poisson(8) is 8 and 8 = 2.83. So the answer is P (X > 10.83) = P (X > 11) = 1 P (X 10). Exercise 88 If proof testing of circuit boards, the probability that an particular diode will fail is.01. Suppose a circuit board contains 200 diodes. a How many diodes would you expect to fail, and what is the standard deviation of the number that are expected to fail? Here we have Binomial(200,.01), which can be approximated by Poisson(200.01). Therefore, expected value is 2, and standard deviation is 2. b What is the approximate probability that at least four diodes will fail on a randomly selected board? Since we are looking at Poisson(2), from the table A.2. P ( at least 4) = 1 P (X 3) = 1.857 =.143
Lecture notes for Devore 7ed. Chapter 3 29 c If five boards are shipped to a particular customer, how likely is it that at least four of them will work properly? Board will work only if all of 200 diodes works. Then P ( Board will work) = P (X = 0) =.135 Now each board will work with probability of.135, Choosing five board and see how many of them work is like Binomial(5,.135). Therefore, P ( at least four boards work) = b(4; 5,.135) + b(5; 5,.135) = 0.00418