Where have we been? Discrete Random Variables n n STAT 200 Tom Ilvento n Moving towards n n We want to shift towards inferential properties of statistics To do this we need some sense of probability distributions for discrete and continuous random variables Random Variables n n n n n Expected Values and Variance of Random Variables Special Distributions n Binomial Distribution n Normal Distribution Central Limit Theorem And into inferences n Single sample n Two samples Random Variables – variables that assume numerical values associated with random outcomes from an experiment n Discrete n Continuous Probability Distributions for Random Variables Example of a random variable This will lead us to n We started with an introduction to statistics and the descriptive nature of statistics for qualitative and quantitative variables And the basic ideas and tools of probability n n Suppose we were recording the number of dentists that use nitrous oxide (laughing gas) in their practice We know that 60% of dentists use the gas. 1 Nitrous Oxide Example n n Nitrous Oxide Example Let X = number of dentists in a random sample of five dentists that use use laughing gas. X is a random variable that can take on the following values: n 0, 1, 2, 3, 4, 5 n X Nitrous Oxide Example n 0 P(X) .0102 1 2 3 0 1 2 3 4 5 Nitrous Oxide Example And then assign probabilities to each value of the random variable X X We can list the values of our random variable X 4 5 .0768 .2304 .3456 .2592 .0778 X 0 1 P(X) .0102 2 3 4 5 .0768 .2304 .3456 .2592 .0778 What is the probability of 4 of 5 dentists selected randomly Using laughing gas? Note: we will look at how we assign probabilities to this random variable later. Nitrous Oxide Example Nitrous Oxide Example Probability Distribution of X What is the probability of less than 2 of 5 using laughing gas? 0.4 p(X) 0.3 If I randomly selected 5 dentists, how many would I expect to use laughing gas? 0.2 0.1 0 0 1 2 3 4 5 Number of Dentists 2 How can you tell it is a discrete random variable? Types of Random Variables n n The variable in the dentist example is called a discrete random variable n Finite number of distinct possible values n We can assume that the values can be listed or counted Random Variables that fall along points on an interval, and can’t be fully counted, are call Continuous Random Variables n n n To describe a discrete random variable n n Countable Usually is described as “the number of…” Tends to be whole numbers n Number of students applying to a university n Number of errors on a test n Number of bacteria per cubic centimeter of water n Number of heart beats of a patient Specifying a discrete random variable – Tossing two coins Specify the possible values it can assume Assign probabilities to each value n Let X=number of heads observed n n n n n So X takes on the following values n n n Specifying a discrete random variable – Tossing two coins n We can a priori assign probabilities to X Number of Heads Sample Points n n TT .25 1 HT TH .50 2 HH .25 O 1 2 TT HT or TH HH Specifying a discrete random variable – Tossing two coins p(x) Probabilities 0 Heads Heads Heads Tails Tails Heads Tails Tails This completely defines the discrete random variable X Connecting probabilities to the values results in the probability distribution 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 The probabilities are distributed over the values 3 Probability Distribution: p(x) n Can be shown by a n n n n n Graph Table Formula – will come later Probability Distribution: p(x) n Specifies the probability associated with each value Requirements: n n p(x) $0 3p(x) = 1 for all values of x Probability Distributions of Discrete Random Variables n n n Sometimes the probabilities are known a priori Sometimes they are observed in experiments, a posteriori And sometimes we use a formula which seems to apply to a class of discrete random variables, such as the Binomial Distribution Probability of one male in three births n Notation n p(x=0) = .25 n p(x=1) = .50 n p(x=2) = .25 Here’s our approach n Show the sample points in three births by showing all the possible outcomes in three births n Let X= number of male offspring n Assign probabilities and depict the probability distribution n Sum the probabilities for at least one male Example: Problem 4.19 page 172 n n n n Males have XY chromosomes Females have XX chromosomes Assume each are equally likely to be contributed If a couple has three children, what is the probability of at least one male? Probability of one male in three births Birth 1 Birth 2 Birth 3 F M M F M F 2x2x2=8 F F M Combinations of males and females in three births F F F M M M M M F M F M M F F There are: 4 Probability of one male in three births Number of Males Sample Points p(X) 0 FFF 1/8 1 FMF FFM MFF 3/8 2 FMM MMF MFM 3/8 3 MMM 1/8 Probability of one male in three births Probability Distribution p(X) Let X= number of male offspring and find it’s probability distribution 0.4 0.3 0.2 0.1 0 0 n Probability of at least one male in three births = P(1 male) + P(2 males) + P(3 males) n n n n n n We could have solved this using the compliment – n 1 – P(no males) = 1 – 1/8 = 7/8 Mean and Variance of a Discrete Variable n n n We can think of our observed probability distribution for x as having a mean and variance That are identical to the population mean and variance For the population n : represents the mean n F 2 represents the variance 2 3 The relationship between observed relative frequency distribution and the population Probability of one male in three births n 1 If we were to observe a large number of observations of a discrete random variable x The relative frequency distribution of x Would begin to resemble the probability distribution for the population Expected Values of Discrete Random Values n n An expected value is another term for the mean when dealing with a probability distribution The expected value of a discrete random variable is n E ( x ) = ∑ xi ⋅ p ( xi ) = µ i =1 The sum of each value times the probability of that value 5 The Expectation of a Discrete Variable n n n I take each value of the discrete variable Multiply by the probability associated with the value Sum the calculations Expectation of the Male Baby Example Number of Males p(X) 0 FFF 1/8 = .125 1 FMF FFM MFF 3/8 = .375 2 FMM MMF MFM 3/8 = .375 3 MMM 1/8 = .125 n E ( x ) = ∑ xi ⋅ p ( xi ) = µ Sample Points i =1 Expectation of the Male Baby Example The Variance of a Discrete Variable n n The variance of a discrete random variable is given as the Expectation of the squared deviations about the population mean: n E[(x − µ )2 ] = ∑ ( xi − µ )2 p( xi ) = σ 2 i =1 Sum of the squared deviation of each value from the mean times the probability of the value The Variance of a Discrete Variable n n n n n I take each value of the discrete variable Subtract the mean Square the result Multiply by the probability associated with the value Sum the calculations n E[( x − µ ) 2 ] = ∑ ( xi − µ ) 2 p( xi ) = σ 2 i =1 Variance of the Male Baby Example Number of Males Sample Points p(X) 0 FFF 1/8 = .125 1 FMF FFM MFF 3/8 = .375 2 FMM MMF MFM 3/8 = .375 3 MMM 1/8 = .125 6 Variance of the Male Baby Example Mean and Variance of Discrete Random Variable n n n Nitrous Oxide Example X 0 1 P(X) .0102 2 3 4 5 If I randomly selected 5 dentists, how many would I expect to use laughing gas? X 0 P(X) .0102 • E(X) = 3 • S2 = 1.1998 • S = 1.09535 n p(X) 0.2 n 0 0 1 2 3 4 2 3 4 5 .0768 .2304 .3456 .2592 .0778 So what? 0.3 0.1 1 If I randomly selected 5 dentists, what is the variance (F 2)? Probability Distribution of the Discrete Variable X 0.4 In our example, F = .866 Nitrous Oxide Example .0768 .2304 .3456 .2592 .0778 Probability Distribution of X Remember, we said the variance is the mean squared deviation about the mean The standard deviation is the square root of the variance Knowing the mean and standard deviation of a probability distribution can be used with n Chebyshev’s Rule n Empirical Rule We can find probabilities under the curve 5 Number of Dentists 7 Solitaire Example Solitaire Example n n Some results of one class n =219 There are 53 outcomes of this discrete random variable n Dollars won/lost - -$52 to +$208 n Number of cards 0 to 52 In reality, there are some values that just don’t happen Student solitaire example Dollars Cards Freq P(x) -$52 0 7 .0320 -$47 1 11 .0502 -$42 2 26 .1187 -$37 3 24 .1096 -$32 4 23 .1050 Solitaire Probability Distribution 0.1400 Expected Cards 8.2694 Expected Return $41.35 Net Return -$10.65 0.1200 0.1000 0.0800 0.0600 0.0400 0.0200 53 49 45 .0411 41 9 37 52 33 0.0000 $208 29 n It is very hard to a priori determine the odds of winning, so I ask students to help in an experiment to see. You can contribute by playing ten games n It is best to play a game, record the result in dollars, exit the game, and then start again n Send your results to ilvento@udel.edu p(X) n Solitaire Example 25 n n 21 n n 17 n Under GAME picks OPTIONS Pick draw three Pick Vegas Style Pick Keep Score 9 n n Vegas Style plays a game where it costs you $52 to play one hand. The draw three options turns the deck over three cards at a time and let’s you go through the deck three times. You get $5 for each card you place on the top (i.e., Ace, two, three... of a suit). If you get all 52 cards on top you would get back $208 (52 x 5) - 52 13 n n 5 n I have been asking my students to help in an experiment playing solitaire on the computer You need to get on any computer with solitaire and set the game We have been using the Vegas style solitaire game. 1 n Solitaire Example # Cards 8 Ilvento Solitaire results Solitaire Example 52 49 46 43 11.506 $57.53 $5.53 40 37 34 31 28 25 22 19 16 13 7 10 4 Expected Cards Expected Return Net Return 1 p(X) Solitaire Probability Distribution 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 # Cards 9