Download Bernoulli Trials and more Study notes Aerodynamics in PDF only on Docsity!
Bernoulli Trials
Definition : Suppose an experiment can have only two possible
outcomes, e. g ., the flipping of a coin or the random generation of
a bit.
- Each performance of the experiment is called a Bernoulli trial.
- One outcome is called a success and the other a failure.
- If p is the probability of success and q the probability of failure, then q = 1 - p.
Many problems involve determining the probability of k successes
when an experiment consists of n mutually independent Bernoulli
trials.
Bernoulli Trials
Example : What is the probability that exactly four heads occur
when a fair coin is flipped seven times?
Example: A coin is biased so that the probability of heads is 2 / 3.
What is the probability that exactly four heads occur when the
coin is flipped seven times?
Theorem : The probability of exactly k successes in n independent
Bernoulli trials, with probability of success p and probability of
failure q = 1 − p , is
C ( n , k ) p
k
q
n − k
An Example with Conditional Probabilities
Box 1 contains three blue and seven red balls
Box 2 contains six blue and four red balls
Select an unknown box at random, and pull out a ball
You pulled out a red ball
What is the probability that you have selected Box 1?
Let E be the event that you have chosen a red ball
Let H be the event that you have chosen the first box
H: Hypothesis E: Evidence
Bayes’ Theorem
Applying Bayes’ Theorem
Suppose that one person in 100,000 has a particular disease. There is a test for the disease that gives a positive result 99 % of the time when given to someone with the disease. When given to someone without the disease, 99.5% of the time it gives a negative result. Find (a) the probability that a person who tests positive has the disease; and (b) the probability that a person who tests negative does not have the disease. Should someone who tests positive be worried? (False negative rate = 0.01; false positive rate = 0.005) For (a). H: the person has the disease. E: the person tests positive For (b). H: the person does not have the disease. E: the person tests negative
Applying Bayes’ Theorem
Solution : Let D be the event that the person has the disease, and E be the event that this person tests positive. We need to compute
p D ( | E ) from p D ( ) , p E ( | D ), p E ( | D ), p ( D ).
p ( D ) = 1/100, 000 = 0.00001 p ( D ) = 1 - 0.00001 =0.
| .99 | .01 | .005 |. | | | | 0.99 0. 0.99 0.00001 0.005 0.
p E D p E D p E D p E D p E D p D p D E p E D p D p E D p D = = = = =
=
» Can you use this formula to explain why the resulting probability is surprisingly small? So, don’t worry too much, if your test for this disease comes back positive.
Generalized Bayes’ Theorem
Random Variables
Definition : A random variable is a function from the sample
space of an experiment to the set of real numbers. That is, a
random variable assigns a real number to each possible
outcome.
( A random variable is a function , not a variable. It is not
“random” in the colloquial sense of the term )
Example : Suppose that a fair coin is flipped three times. Let X ( t ) be
the random variable that equals the number of heads that appear
when t is the outcome.
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 3, 0 2,
X HHH X TTT X HHT X HTH X THH X TTH X THT X HTT = = = = = = = =
Expected Value
Definition : The expected value (or expectation or mean )
of the random variable X on the sample space S is equal to
x S E X p s X s Î
= å
Example-Expected Value of a Die : Let X be the number
that comes up when a fair die is rolled. What is the
expected value of X?
Solution : The random variable X takes the values 1, 2, 3,
4, 5, or 6. Each has probability 1/6. It follows that
E X = × + × + × = =
Expected Value
RESULT : The expected number of successes when n
mutually independent Bernoulli trials are performed
is n x p , where p is the probability of success on each
trial.
Linearity of Expectations
The Hatcheck Problem : A new employee started a job checking hats, but forgot to put the claim check numbers on the hats. So, the n customers just receive a random hat from those remaining. What is the expected number of hats returned correctly? Solution : Let X be the random variable that equals the number of people who receive the correct hat. We have X = X 1 + X 2 + ··· + Xn , where Xi = 1 if the i th person receives the hat and Xi = 0 otherwise.
- Because it is equally likely that the checker returns any of the hats to the i th person, it follows that the probability that the i th person receives the correct hat is 1 / n.
- Consequently for each i
E X ( i ) = 1 × p X ( i = 1 ) + 0 × p X ( i = 0 ) = 1 1/× n + 0 =1/ n.
- By the linearity of expectations, it follows that:
E X ( ) = E X ( 1 ) + E X ( 2 ) + + E X ( n )= n ×1/ n - 1.
Consequently, the average number of people who receive the correct hat is exactly one. ( Surprisingly, this answer remains the same no matter how many people have checked their hats!) “ indicator random variable”
Linearity of Expectations
Number of inversions : You are give an array A[1,…,n] of n distinct integers. An inversion in this array is a pair of indices (i,j) such that A[i] > A[j]. What is the expected number of inversions in a random array of n elements? Solution : Let X be the RV (random variable) that equals the number of inversions. Let Xij be the indicator RV that equals 1 if (i,j) is an inversion, and 0 otherwise