Pitman MTH 135/ STA 104 Probability Week 5 Read: Pitman sections 3.1-3.3 Guest Lecturer: Drew Gronewold!!! Discrete Random Variables * Introduction to Random Variables Roll a fair die until an ace (1) appears; how many non-aces do you see first? This is an example of a *RANDOM VARIABLE*, a number that depends on chance. a) What *is* a random variable? One answer: A function from the sample space to the real numbers |R Another: A number that depends on chance Secret: Usually upper-case letters from the end of the alphabet are used... so if you see X, Y, or Z, it's probably a RV Let's call the number of non-aces X. b) What questions can we ask & answer about random variables? One: P[ X < 3 ] = 1 - (5/6)^3 = 1 - 125/216 = 91/216 = .4213 Another: P[ X = 2 ] = P[ X >= 2 ] - P[ X >= 3 ] = (5/6)^2 - (5/6)^3 = 25/36 - 125/216 = 25/216 = .1157 OR = P[~A ~A A] = (5/6)(5/6)(1/6) = 25/216 = .1157 Yet Another: What would X be, on average, in lots of repeated trials? Variation: Instead of P[Ace]=1/6, count # of failures before 1st success if successes have probability p, 0=17: = 1 - (16/20)*(15/19)*(14/18) = 29/57 = .5088 X = max number selected; what are the possible values of X and their probabilities? P[X=20] = 3/20 = .1500 P[X=19] = 3 * (18/20) * (17/19) * (1/18) = 51/380 = .1342 P[X=18] = 3 * (17/20) * (16/19) * (1/18) = 34/285 = .1193 P[X=17] = 3 * (16/20) * (15/19) * (1/18) = 2/19 = .1053 P[X>=17]= .5088 P[X=x] = 3 * (x-1)*(x-2)/(20*19*18) = (x-1)(x-2)/2280, x = 3,4,...,20 Another way: P[X=x] = C(x-1,2) / C(20,3) (also correct) DEF: A (real-valued) RANDOM VARIABLE is a (real-valued) function on the sample space Omega. Example: if Omega is the usual 36-point space for two rolls of a fair die, say, { (r,g) : 1 <= r,g <= 6 } all equally-likely, then X(r,g) = r Y(r,g) = |r-g| Z(r,g) = r+g are all random variables. What is the probability that Y=1? What is that EVENT? DEF: The *RANGE* or a random variable is just the set of its possible values. The *DISTRIBUTION* of a random variable is any specification of P[ X in A ] for every set A... if X has only finitely-many (or countably-many) values, the DISTRIBUTION can be specified by giving the probability of each outcome in the range, f(x) = P[ X = x ] and then P[ X in A ] = sum { f(x) : x in A } is specified for every A. For other random variables, like "uniform" and "normal" among others, we'll have to do something else--- we start that just after Fall Break. It's always good enough to specify F(x) = P [ X <= x ] for every x; then we can work out the probability that X is in any interval, any union of intervals, etc; more later. If X is any random variable and g is any function, then X = G(X) is another random variable: W g Omega -----> |R ---------> |R Actually, W could be a function from Omega to any set at all (say, "E") and g could be a function from E to the real numbers, and we'd still be okay. What is the DISTRIBUTION of X = g(W) ??? ------------- Random Vectors and Joint Distributions Draw two socks at random, without replacement, from a drawer containing multi-colored socks, 6 black 4 white 2 green Let B be the number of Black socks, W the number of White socks. The *DISTRIBUTION* of B and W are easy to write down; each has only 3 values in its range, with probability table (why?). To make it easier to compare & add numbers, I'll put everything over the same denominator instead of our usual convention of "lowest terms": 0 2 1 B 15/66 15/66 36/66 (**) W 28/66 6/66 32/66 This table doesn't let us know everything--- for example, what is the probability that we draw a matching pair? What's the probability that we have one each of black and white socks? We don't have enough to tell (e.g., we can't tell about the probability of a green pair). The *JOINT* distribution of B and W tells us the probability of every possible PAIR (b,w) of numbers... we can present it in a table W 0 1 2 +------------------------------ 0 | 1/66 8/66 6/66 || 15/66 | || B 1 | 12/66 24/66 0 || 36/66 | || 2 | 15/66 0 0 || 15/66 | || =============================== 28/66 32/66 6/66 66/66 Note that the MARGINAL SUMS are the same numbers we had before in (**); they are called the "marginal probabilities". Now we can see the probability of a matching pair: Black White Green 15/66 + 6/66 + 1/66 = 22/66 = 1/3. or the probability of a black-and-white pair, 24/66 = 4/11. * Expectations If we draw some random variable X repeatedly, what will be its AVERAGE VALUE? For example, if we roll a fair die 600 times, what will the average be? If we denote the outcome on the i'th roll by X_i this looks like: X_1 + X_2 + X_3 + ... + X_600 Avg = ---------------------------------- 600 and it's a little hard to tell. BUT--- if instead we think of how many 1's we will find, and how many 2's, and how many 3's and 4's and so forth, we see the sum should be exactly X_1 + X_2 + X_3 + ... + X_600 = 1 * (# of 1's in 600 rolls + 2 * (# of 2's in 600 rolls + 3 * (# of 3's in 600 rolls + 4 * (# of 4's in 600 rolls + 5 * (# of 5's in 600 rolls + 6 * (# of 6's in 600 rolls which should be about (why?) ~~ 1 * 100 + 2 * 100 + 3 * 100 + 4 * 100 + 5 * 100 + 6 * 100 = 2100 so the average should be about 2100 Avg ~ ----------- = 3.5 600 More generally, if we have any function g() and want to know the average value of g(X) for a random variable X that takes each value x with probability f(x), then in a large number N of tries the average will be about Sum [ g(x) * N * f(x) ] Avg[ g(X) ] ~~ ----------------------------------- = Sum g(x) * f(x) N (note the N cancels top-and-bottom, so we can take the limit N->oo easily) This is a *weighted average of g(x)*, weighted by the PROBABILTY that X=x; the fair-die example had g(x) = x f(x) = 1/6 for x = 1,2,3,4,5,6 ---------------- DEFINITION: The MEAN of X is E[X] = Sum { x * f(x) } (usually denoted "mu") The EXPECTATION of g(X) is E[g(X)] = Sum { g(x) * f(x) } Nobody will get upset if you mix up the words MEAN and EXPECTATION. Note that mu has the same UNITS as X does--- if X is measured in feet, meters, seconds, or fortnights then so is mu. ----------------- On average, any RV X will be equal to its mean "mu"... but how far from mu will X be? * Can't measure this by the average of ( X - mu ) (that average is always zero); the points where X>mu are balanced out by the points where X>mu AND when X<