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
Probability Distributions: Finite Random Variables Random Variables A random variable is a numerical value associated with the outcome of an experiment. Examples: The number of heads that appear when flipping three coins The sum obtained when two fair dice are rolled In both examples, we are not as interested in the outcomes of the experiment as we are in knowing a number value for the experiment Example—Flipping a Coin 3 Times Suppose that we flip a coin 3 times and record each flip. S = {HHH, HHT, HTH, HTT, THH, THT, TTT, TTT} Let X be a random variable that records the # of heads we get for flipping a coin 3 times. Example (cont) The possible values our random variable X can assume: X = x where x = {0, 1, 2, 3} Notice that the values of X are: Countable, i.e. we can list all possible The values are whole numbers values When a random variable’s values are countable the random variable is called a finite random variable. And when the values are whole #’s the random variable is discrete. Probabilities Just as with events, we can also talk about probabilities of random variables. The probability a random variable assumes a certain value is written as P(X =x) Notice that X is the random variable for the # of heads and x is the value the variable assumes. Probabilities We can list all the probabilities for our random variable in a table. The pattern of probabilities for a random variable is called its probability distribution. For a finite discrete random variable, this pattern of probabilities is called the probability mass function ( p.m.f ). X=x P(X=x) 0 1/8 1 3/8 2 3/8 3 1/8 Probability Mass Function We consider this table to be a function because each value of the random variable has exactly one probability associated with it. Because of this we use function notation to say: f X x P X x X=x 0 1 2 3 P(X=x) 1/8 3/8 3/8 1/8 Properties of Probability Mass Function Because the p.m.f is a function it has a domain and range like any other function you’ve seen: Domain: {all whole # values random variable} Range: 0 f X x 1 Sum: f x 1 X All x Representing the p.m.f. Because the p.m.f function uses only whole # values in its domain, we often use histograms to show pictorially the distribution of probabilities. Here is a histogram for our coin example: P(X=x) 0.4 0.3 0.2 P(X=x) 0.1 0 0 1 2 X=x 3 Things to notice: The height of each rectangle corresponds to P(X=x) The sum of all heights is equal to 1 P(X=x) 0.4 0.3 0.2 P(X=x) 0.1 0 0 1 2 X=x 3 Cumulative Distribution Function The same probability information is often given in a different form, called the cumulative distribution function, c.d.f. Like the p.m.f. the c.d.f. is a function which we denote as Fx(x) (upper case F) with the following properties: Domain: the set of all real #s Range: 0≤ Fx(x) ≤1 Fx(x) = P(X≤x) As x →∞, Fx(x) →1 AND As x →-∞, Fx(x) →0 Graphing the c.d.f. Let’s graph the c.d.f. for our coin example. According to our definitions from the previous slide: Domain: the set of all real #s Range: 0≤ Fx(x) ≤1 Fx(x) = P(X≤x) Graphing (cont) Here’s the p.m.f. : X=x 0 1 2 3 P(X=x) 1/8 3/8 1/8 3/8 Because the domain for the cdf is the set of all real numbers, any value of x that is less than zero would mean that Fx(x) is 0 since there is no way for a flip of three coins to have less than 0 heads. The probability is zero! Also, because the number of heads we can get is always at most 3, Fx(x) = 1 when x ≥ 3. Graphing (cont) Now we need to look at what happens for the other values. If 0≤ x <1, then Fx(x) = P(X ≤ x) = P(X=0) = 1/8 If 1≤ x <2, then Fx(x) = P(X ≤ x) = P(X=1) +P(X=0)= 1/8+3/8=4/8 If 2≤ x <3, then Fx(x) = P(X ≤ x) = P(X=2)+P(X=1) +P(X=0)= 1/8+3/8+3/8=7/8 The c.d.f. All of the previous information is best summarized with a piece-wise function: 0 1 84 FX x 8 7 8 1 if x0 if 0 x 1 if 1 x 2 if 2 x3 if x3 The graph of the c.d.f. F(X) -6 -5 -4 -3 -2 1.125 1 0.875 0.75 0.625 0.5 0.375 0.25 0.125 0 -1 0 X=x 1 2 3 4 5 6 Things to notice The graph is a step-wise function. This is typically what you will see for finite discrete random variables. Domain: the set of all real #s Range: 0≤ Fx(x) ≤1 Fx(x) = P(X≤x) As x →∞, Fx(x) →1 AND As x →-∞, Fx(x) →0 At each x-value where there is a jump, the size of the jump tells us the P(X=x). Because of this, we can write a p.m.f. function from a c.d.f. function and vice-versa Expected Value of Finite Discrete Random Variable Expected Value of a Discrete Random Variable is x P( X x) all x Note, this is the sum of each of the heights of each rectangle in the p.m.f., multiplied by the respective value of X in the pmf. Example Box contains four $1 chips, three $5 chips, two $25 chips, and one $100 chip. Let X be the denomination of a chip selected at random. The p.m.f. of X is displayed below. X $1.00 $5.00 $25.00 $100.00 fX(X) 0.40 0.30 0.20 0.10 Questions What is P(X=25)? What is P(X≤25)? What P(X≥5)? Graph the c.d.f. What is the E(X)? Answers P( X $25) f X ($25) 0.2 P ( X $25) P ( X $1) P ( X $5) P ( X $25) f X ($1) f X ($5) f X ($25) 0.4 0.3 0.2 0.9 P( X $25) FX ($25) 0.9 P( X $5) f X ($5) f X ($25) f X ($100) P X 5 0.3 0.2 0.1 0.6 1 P X 5 1 P X 1 1 FX 1 1 0.4 0.6 Answer(CDF) Cumulative Distribution Function 1.2 1.0 FX (x ) 0.8 0.6 0.4 0.2 0.0 -20 0 20 40 60 x 80 100 120 Expected Value x x f X (x) f X (x) $ 1 0.4 0.40 $ 5 0.3 1.50 $ 25 0.2 5.00 $ 100 0.1 10.00 Sum 1.0 X $16.90 Bernoulli Random Variables Bernoulli Random Variables are a special case of discrete random variables In a Bernoulli Trial there are only two outcomes: success or failure Bernoulli Random Variable Let X stand for the number of successes in n Bernoulli Trials, X is called a Binomial Random Variable Binomial Setting: 1. You have n repeated trials of an experiment. 2. On a single trial, there are two possible outcomes, success or failure. 3. The probability of success is the same from trial to trial. 4. The outcome of each trial is independent. Expected Value of a Binomial R.V. is E(X)=np, p is probability of success Loaded Coin Suppose you have a coin that is biased towards heads. Let’s suppose that on any given flip of the coin your get heads about 60% of the time and tails 40% of the time. Let X be the random variable for the number of heads obtained in flipping the coin three times. Loaded Coin S = {HHH, HHT, HTH, HTT, THH, THT, TTT, TTT} A “success” in this experiment will be the occurrence of a head and a “failure” will be when we get a tail. Because getting a head is more likely now, we need to look at what the probability is for getting each of the outcomes in our sample space. Loaded coin For example: What is the probability of getting HHH? Because each trial or flip is independent, we can say that: PH H H PH PH PH 0.600.600.60 0.216 Similarly, we can also ask what the probabilities are for other outcomes in our experiment. Loaded Coin Outcome HHH HHT HTH HTT THH THT TTH TTT Probability (0.60)(0.60)(0.60)=0.216 (0.60)(0.60)(0.40)=0.144 (0.60)(0.40)(0.60)=0.144 (0.60)(0.40)(0.40)=0.096 (0.40)(0.60)(0.60)=0.144 (0.40)(0.60)(0.40)=0.096 (0.40)(0.40)(0.60)=0.096 (0.40)(0.40)(0.40)=0.064 Loaded Coin: p.m.f. X=x P(X=x) 0 0.064 1 0.288 2 0.432 3 0.216 Loaded Coin: Graph of pmf PMF P(X=x) 0.5 0.4 0.3 Series1 0.2 0.1 0 0 1 2 X=x 3 Your Turn! Graph the cdf of our biased coin example Excel: BINOMDIST F(x) 1.2 1 0.8 0.6 0.4 0.2 0 -5 -3 -1 1 X 3 5