01 Lecture1-Randomness-Probability
01 Lecture1-Randomness-Probability
Randomness
IPS Chapter 4
4.1: Randomness
4.2: Probability Models
4.3: Random Variables
4.4: Means and Variances of Random Variables
4.5: General Probability Rules
© 2012 W.H. Freeman and Company
Probability: The Study of Randomness
4.1 Randomness
4.2 Probability Models
Sample spaces
Probability rules
The probability of
heads is 0.5 =
the proportion of
times you get
heads in many
repeated trials.
Imagine that these coins were spread out so that half were heads up and half
were tails up. Close your eyes and pick one. The probability of it being heads is
0.5. However, if you don’t put it back in the pile, the probability of picking up
another coin that is heads up is now less than 0.5.
H - HHH
A. A basketball player shoots
H
three free throws. What are M - HHM
the possible sequences of H S = { HHH, HHM,
H - HMH HMH, HMM, MHH,
hits (H) and misses (M)? M
MHM, MMH, MMM }
M - HMM
M…
Note: 8 elements, 23
…
C. A nutrition researcher feeds a new diet to a young male white rat. What
are the possible outcomes of weight gain (in grams)?
Example: If you flip two coins, and the first flip does not affect the second flip:
S = {HH, HT, TH, TT}. The probability of each of these events is 1/4, or 0.25.
The probability that you obtain “only heads or only tails” is:
P(HH or TT) = P(HH) + P(TT) = 0.25 + 0.25 = 0.50
Coin Toss Example:
Probability rules (cont’d) S = {Head, Tail}
Probability of heads = 0.5
Probability of tails = 0.5
Venn diagram:
P(not A) = P(Ac) = 1 − P(A)
Sample space made up of an
event A and its complementary
Ac, i.e., everything that is not A.
Tailc = not Tail = Head
P(Tailc) = 1 − P(Head) = 0.5
Probabilities: finite number of outcomes
Finite sample spaces deal with discrete data—data that can only
take on a limited number of values. These values are often integers or
whole numbers.
Throwing a die:
S = {1, 2, 3, 4, 5, 6}
What is the probability that a random M&M is either red, yellow, or orange?
This is S:
There are 36 possible outcomes in S, all equally likely (given fair dice).
Thus, the probability of any one of them is 1/36.
Venn diagram:
Event A and event B. The intersection
represents the event {A and B} and
outcomes common to both A and B.
A couple wants three children. What are the arrangements of boys (B) and girls
(G)?
Genetics tell us that the probability that a baby is a boy or a girl is the same, 0.5.
Sample space: {BBB, BBG, BGB, GBB, GGB, GBG, BGG, GGG}
Î All eight outcomes in the sample space are equally likely.
The probability of each is thus 1/8.
Î Each birth is independent of the next, so we can use the multiplication rule.
Example: P(BBB) = P(B)* P(B)* P(B) = (1/2)*(1/2)*(1/2) = 1/8
A couple wants three children. What are the numbers of girls (X) they could have?
The same genetic laws apply. We can use the probabilities above and the addition
rule for disjoint events to calculate the probabilities for X.
A bottle cap is tossed three times. We define the random variable X as the
number of number of times the cap drops with the open side up.
A bottle cap is tossed three times. The number of times the cap drops with
the open side up is a discrete random variable (X). X can only take the
values 0, 1, 2, or 3.
The probability distribution of a
random variable X lists the values
and their probabilities:
U - UUU
Value of X 0 1 2 3
U Probability .027 .189 .441 .343
D - UUD
U
UDD UUD
U - UDU DUD UDU
D
DDD DDU UUD UUU
D - DDU
D…
…
The probability of any event is the sum of the probabilities pi of the
values of X that make up the event.
A bottle cap is tossed three times. We define the random variable X as the
number of number of times the cap drops with the open side up.
What is the probability that cap lands with the open side up fewer than three
times?
P(X<3) = P(X=0) + P(X=1) + P(X=2) = .343 + .441 + .189 = 0.973 or
P(X<3) = 1 – P(X=3) = 1 - 0.343 = 0.657
Continuous random variables
A continuous random variable X takes all values in an interval.
Example: There is an infinity of numbers between 0 and 1 (e.g., 0.001, 0.4, 0.0063876).
P(X=1) = (1 – 1)*1 = 0
P(X < 0.5 or X > 0.8) = P(X < 0.5) + P(X > 0.8) = 1 – P(0.5 < X < 0.8) = 0.7
We generate two random numbers between 0 and 1 and take Y to be their sum.
Y can take any value between 0 and 2. The density curve for Y is:
0.25 0.5
0.125
0 0.5 1 1.5 2
Continuous random variable and population distribution
% individuals with X
such that x1 < X < x2
The shaded area under a density
curve shows the proportion, or %,
of individuals in a population with
values of X between x1 and x2.
Example: Probability
distribution of women’s
heights.
=>
x z
Standardized height (no units)
(x − µ)
z=
σ
What is the probability, if we pick one woman at random, that her height will be
some value X? For instance, between 68 and 70 inches P(68 < X < 70)?
(x − µ) N(µ, σ) =
z=
σ N(64.5, 2.5)
(70−64.5)
For x = 70", z= = 2.2
2.5 0.9192
0.9861
The area under the curve for the interval [68" to 70"] is 0.9861 − 0.9192 = 0.0669.
Thus, the probability that a randomly chosen woman falls into this range is 6.69%.
P(68 < X < 70) = 6.69%
Inverse problem:
σ = 0.2 oz.
Lowest
2%
x = 8 oz. µ=?
Here we know the area under the density curve (2% = 0.02) and we know x (8 oz.).
We want µ.
In table A we find that the z for a left area of 0.02 is roughly z = -2.05.
(x − µ)
z= ⇔ µ = x − (z * σ ) µ = 8 − (−2.05*0.2) = 8.41oz.
σ
Thus, your favorite chocolate bar weighs, on average, 8.41 oz. Excellent!!!
Mean of a random variable
The mean x bar of a set of observations is their arithmetic average.
A bottle cap is tossed three times. We define the random variable X as the
number of number of times the cap drops with the open side up (“U”).
A bottle cap is tossed three times. We define the random variable X as the
number of number of times the cap drops with the open side up.
Value of X 0 1 2 3
The mean µ of X is
Probability .027 .189 .441 .43 µ = (0*.027)+(1*.189)+(2*.441)+(3*.343)
= 2.1
Mean of a continuous random variable
= ∑ (x i − µX ) 2 pi
A bottle cap is tossed three times. We define the random variable X as the
number of number of times the cap drops
Value of X 0 1 2 3
with the open side up. µX = 2.1.
Probability .027 .189 .441 .343
The variance σ2 of X is
σ2 = .027*(0−2.1)2 + .189*(1−2.1)2 + .441*(2−2.1)2 +
.343*(3−2.1)2
11907 22869 00441 27783 63
Rules for means and variances
σR = √196.786 = 14.03%
The portfolio has a smaller mean return than an all-stock portfolio, but it is also
less risky.
Probability: The Study of Randomness
4.5 General Probability
Rules
Conditional probability
Tree diagrams
Bayes’s rule
General addition rules
General addition rule for any two events A and B:
What is the probability of randomly drawing either an ace or a heart from a deck of
52 playing cards? There are 4 aces in the pack and 13 hearts. However, 1 card is
both an ace and a heart. Thus:
Example: The probability that a cloudy day will result in rain is different if
you live in Los Angeles than if you live in Seattle.
What is the probability of randomly drawing two hearts from a deck of 52 playing
cards? There are 13 hearts in the pack. Let A and B be the events that the first
and second cards drawn are hearts, respectively. Assume that the first card is
not replaced before the second card is drawn.
P(A) = 13/52 = 1/4 P(B | A) = 12/51
ÎP(two hearts) = P(A)* P(B | A) = (1/4)*(12/51) = 3/51
Notice that the probability of a heart on the second draw depends on which card
was removed on the first draw.
Independent Events
What is the probability of randomly drawing two hearts from a deck of 52 playing
cards if the first card is replaced (and the cards re-shuffled) before the second
card is drawn.
P(A) = 1/4 P(B | A) = 13/52 = 1/4
ÎP(A and B) = P(A)* P(B) = (1/4)*(1/4) = 1/16
Notice that the two draws are independent events if the first card is replaced
before the second card is drawn.
Internet 0.47
user
Diagnosis
Disease sensitivity 0.8
incidence Positive
Cancer
0.0004 Negative False negative
0.2
Mammography
0.1 False positive
0.9996 Positive
No cancer
Negative
Incidence of breast 0.9
cancer among Diagnosis
specificity Mammography
women ages 20–30
performance
She could either have a positive test and have breast cancer or have a positive
test but not have cancer (false positive).
Diagnosis
Disease sensitivity 0.8
incidence Positive
Cancer
0.0004 Negative False negative
0.2
Mammography
0.1 False positive
0.9996 Positive
No cancer
Incidence of breast Negative
cancer among 0.9
Diagnosis
women ages 20–30 specificity Mammography
performance
Possible outcomes given the positive diagnosis: positive test and breast cancer
or positive test but no cancer (false positive).
P(cancer and pos )
P(cancer | pos ) =
P (cancer and pos) + P( nocancer and pos )
0.0004*0.8
= ≈ 0.3%
0.0004*0.8 + 0.9996*0.1
This value is called the positive predictive value, or PV+. It is an important piece
of information but, unfortunately, is rarely communicated to patients.
Bayes’s rule
An important application of conditional probabilities is Bayes’s rule. It is
the foundation of many modern statistical applications beyond the
scope of this textbook.
P(C | Ai )P(Ai )
P(Ai | C) =
P(C | A1 )P(A1 ) + P(C | A2 )P(A2 ) +L + P(C | Ak )P(Ak )
P(C | Ai )P(Ai )
This time, we use Bayes’s rule: P(Ai | C) =
P(C | A1 )P(A1 ) + P(C | A2 )P(A2 ) +L + P(C | Ak )P(Ak )
A1 is cancer, A2 is no cancer, C is a positive test result.
An oil rig has three blind shear rams to cut off the flow of oil in
the event of a blowout. We define the random variable X as
the number of number of rams that succeed when activated.
An oil rig has three blind shear rams. The number of rams that
succeed when activated is a discrete random variable (X).
X can only take the values 0, 1, 2, or 3.
The probability distribution of a
random variable X lists the values
and their probabilities:
An oil rig has three blind shear rams to cut off the flow of oil in
the event of a blowout. We define the random variable X as
the number of number of rams that succeed when activated.
What is the probability that an oil rig with three blind shear rams successfully
prevents a blowout?
P(X≥1) = P(X=1) + P(X=2) + P(X=3) = .334 + .408 + .166 = 0.909 or
P(X≥1) = 1 – P(X=0) = 1 - 0.091 = 0.909
Mean of a random variable
The mean x bar of a set of observations is their arithmetic average.
An oil rig has three blind shear rams to cut off the flow of oil in
the event of a blowout. We define the random variable X as
the number of number of rams that succeed when activated.
SFF SSF Value of X 0 1 2 3
FSF SFS
FFF FFS SSF SSS Probability .091 .334 .409 .166
An oil rig has three blind shear rams to cut off the flow of oil in
the event of a blowout. We define the random variable X as
the number of number of rams that succeed when activated.
The mean µ of X is
Value of X 0 1 2 3 µ = (0*.091)+(1*.334)+(2*.409)+(3*.166)
Probability .091 .334 .409 .166
= 1.65
Variance of a discrete random variable
For a discrete random variable X
with probability distribution Æ
and mean µX, the variance σ2 of X is found by multiplying each
squared deviation of X by its probability and then adding all the
products.
An oil rig has three blind shear rams to cut off the flow of oil.
The random variable X is the number of number of rams that