st 370 - probabilitylu/st370/note_5_lu.pdf · the conditional probability of an event agiven that...

36
Chapter 6 ST 370 - Probability Readings: Chapter 2.2-2.6 Recap: So far we’ve learned: Why we want a ‘random’ sample and how to achieve it (Sampling Scheme) How to use randomization, replication, and control/blocking to create a valid experi- ment. Methods for summarizing and graphing data in meaningful ways. Analyzing CRD type designs to investigate which factors are important for a particular response. How to analyze studies with quantitative explanatory variables and a quantitative re- sponse. Next up we will learn about probability and random variables which will allow us to understand the inferences we’ve looked at! In ANOVA and Regression we used the mean squares to find F-stats. The F-stats were used to calculate the p-values. But how did we come up with that? Now we will look at the mechanics of probability and eventually sampling distributions. 87

Upload: others

Post on 18-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Chapter 6

ST 370 - Probability

Readings: Chapter 2.2-2.6

Recap: So far we’ve learned:

• Why we want a ‘random’ sample and how to achieve it (Sampling Scheme)

• How to use randomization, replication, and control/blocking to create a valid experi-ment.

• Methods for summarizing and graphing data in meaningful ways.

• Analyzing CRD type designs to investigate which factors are important for a particularresponse.

• How to analyze studies with quantitative explanatory variables and a quantitative re-sponse.

• Next up we will learn about probability and random variables which will allow us tounderstand the inferences we’ve looked at!

In ANOVA and Regression we used the mean squares to find F-stats.

The F-stats were used to calculate the p-values.

But how did we come up with that? Now we will look at the mechanics of probabilityand eventually sampling distributions.

87

wlu4
Typewritten Text
Page 2: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Interpretation of Probability and Inference

• Probability is the of an event, in an ex-periment repeated an infinite number of times

– Ex: the probability of rolling snake eyes ((1, 1)) on two fair dice

– Ex: the probability of getting a head on a flipped coin

Theory of probability provides the basis for statistical inference (making claims about apopulation based on sample data)

• Ex: Suppose a coin is tossed n = 10 times and yields y = 10 heads. We want to testthe hypothesis:

– If hypothesis is true, how likely is this event?

– With 10/10 heads, reasonable to conclude not fair. What about 9/10? 7/10?

– To make a decision, need to know

The above plot gives the probability of observing a given number of heads from a fair coinin 10 tosses.

88

wlu4
Typewritten Text
relative frequency
wlu4
Typewritten Text
wlu4
Typewritten Text
H0: the coin is a fair coin (i.e. you have equal chance to get a head or tail)
wlu4
Typewritten Text
wlu4
Typewritten Text
the probability distribution of an event given H0 is true.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
Sample Space: the set of all possible outcomes of a random experiment, denoted by S.
wlu4
Typewritten Text
For example, toss a coin twice. S = {HH, HT, TH, TT}. Event: a subset of the sample space, usually denoted by capital letters, say A or B.
wlu4
Typewritten Text
Page 3: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Probability

• The Probability of the event is the likelihood or chance that a particular outcome orevent from a random process will occur. We write

• Probabilities are numbers between

• May be written as proportion (0.15), percent (15%), or a fraction (3/20).

• P(Event)=1 implies

• P(Event)=0 implies

• P(one of all possible events occur) =1

Example - Use the relative frequency idea to find the probabilities associated with theevents possible from flipping a fair coin twice.

• ∩ is the intersection of two events

• ∪ is the union

Example - What is the probability of getting 0 heads? 1 head? 2 heads? The probabilityof getting 0, 1, or 2 heads? Consider the events A= I get 1 or 2 heads and B= I get 0 or 1heads. What is the probability of both A and B occurring?

89

wlu4
Typewritten Text
P(A) is the probability for an event A
wlu4
Typewritten Text
wlu4
Typewritten Text
0 and 1
wlu4
Typewritten Text
a certain event
wlu4
Typewritten Text
an impossible event
wlu4
Typewritten Text
wlu4
Typewritten Text
Toss a coin twice. What is the event of getting exactly one head? two heads? exact one head: A = {HT, TH}; two heads: B = {HH} (correct answer); B = HH (wrong answer). Why?
wlu4
Typewritten Text
wlu4
Typewritten Text
Difference between an outcome and an event: HH is an outcome (or an element) in S; {HH} is an event, which is a subset of S.
wlu4
Typewritten Text
wlu4
Typewritten Text
Recall S = {HH,HT,TH,TT}. Possible events: A = {HH} (two heads); B = {HT,TH} (exact one head); C = {TT} (two tails). Suppose we repeat the experiment (i.e. toss a fair coin twice) 1000 times. It is expected to see that about 250 times of observing two heads, about 500 times of observing exact one head, and about 250 times of observing two tails. Then, P(A) = 250/1000 = 0.25; P(B) = 500/1000 = 0.5; P(C) = 250/1000 = 0.25.
wlu4
Typewritten Text
wlu4
Typewritten Text
: the event that consists of all outcomes that are contained in both of the two events. e.g., A1 = {HH,HT,TH}, A2 = {HH}.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
the event that consists of all outcomes that are contained in either of the two events. e.g., B1 = {HH, HT}, B2 = {HT, TH}.
wlu4
Typewritten Text
wlu4
Typewritten Text
Q: What are events A1 and B1 defined here?
wlu4
Typewritten Text
complement event: a set that consists of all outcomes that are not contained in the event.
wlu4
Typewritten Text
wlu4
Typewritten Text
A = {HH, HT, TH}, B = {HT, TH, TT}. P(A) = 0.75; P(B) = 0.75. P(A intersect B) = P({HT,TH}) = 0.5.
wlu4
Typewritten Text
wlu4
Typewritten Text
mutually exclusive events: the intersection of two events is an empty set.
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 4: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Example - Try this with flipping a coin three times! That is, write out the events and findthe probability of obtaining 0 heads in 3 flips, 2 heads in 3 flips, 1 head in 3 flips, and 0heads in 3 flips. Also, find the probability of obtaining at least 1 head. Find the probabilityof obtaining at least 1 head and no more than 2 heads.

Conditional Probs, Laws of Probs, and Independence

The probability of an event will sometimes depend on whether we know that other eventshave occurred.

For example, the probability of getting a 1 in the toss of a six-sided die is .

If we know that an odd number has fallen, then the probability of occurrence of a 1 is.

The conditional probability of an event A given that an event B has occurred is equal to

Basic Example - The game host puts $10K, $100 and $1 in three briefcases. You, the player,can select any case you like. Then you are offered the second chance to select another caseand the case will be opened. Suppose you see the second case does not have $10k, then whatis the chance that the first chosen case has $10K dollars?

90

wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
------------
wlu4
Typewritten Text
wlu4
Typewritten Text
the sample space and events
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
sample space: S = {HHH,HHT,HTH,THH,HTT,THT,TTH,TTT} 3 heads: A = {HHH}; 2 heads: B = {HHT,HTH,THH}; 1 head: C = {HTT,THT,TTH}; 0 heads: D = {TTT}. Probability based on relative frequency: all outcomes in S are equally likely to occur. If we repeat the experiment many many times, you are expected to see about the same number of occurrences for each outcome (i.e. the relative frequency of each out come is 1/8). P(A) = 1/8; P(B) = 3/8; P(C) = 3/8; P(D) = 1/8. at least one head: E = {HHH,HHT,HTH,THH,HTT,THT,TTH}; P(E) = 7/8. at most one head: F = {HTT,THT,TTH,TTT}; P(F) = 4/8 = 1/2. no more than two heads: G = {HHT,HTH,THH,HTT,THT,TTH,TTT}; P(G) = 7/8.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
1/6
wlu4
Typewritten Text
1/3
wlu4
Typewritten Text
why?
wlu4
Typewritten Text
P(A|B) = P(A intersect B)/P(B)
wlu4
Typewritten Text
Intuitive: given the second case does not have 10k, the 10k must be in the first case or the last case. Therefore, the conditional probability is 1/2. Formally: define A = {the first case has 10k}, B = {the second case does not have 10k}. S = {(10k, 100, 1),(10k,1,100),(100,10k,1),(100,1,10k),(1,100,10k),(1,10k,100)}
wlu4
Typewritten Text
Then, A = {(10k, 100, 1),(10k,1,100)}; B = {(10k, 100, 1),(10k,1,100),(1,100,10k),(1,10k,100)}
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
A intersect B = {(10k, 100, 1),(10k,1,100)}. P(A|B) = P(A intersect B)/P(B) = (2/6)/(4/6) = 0.5.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 5: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Independent EventsTwo events and are said to be if and only if any one of thefollowing 3 conditions hold:

P (A|B) = P (A)

P (B|A) = P (B)

P (A ∩B) = P (A)P (B).

Otherwise, the events are said to be

Independence Examples

• Consider a couple that has 2 children. We are looking at the gender of the children inorder. The events possible here are MF (1st chile male, second female), FM , FF , andMM . All events are equally likely. Let A be the event that the younger child is female,and B be the event that the older child is male. Are A and B dependent?

• (Credit Card Example) - The proportion of NCSU students with a VISA card is 0.48,the proportion with a MasterCard is 0.64, the proportion with both is 0.35.

1. Calculate the conditional probability that a randomly sampled student has a VISAgiven he/she has a MasterCard.

2. Are the events ‘having a VISA’ and ‘having a MasterCard’ independent?

91

wlu4
Typewritten Text
-----
wlu4
Typewritten Text
independent
wlu4
Typewritten Text
dependent
wlu4
Typewritten Text
Recall P(A|B) = P(A intersect B)/P(B). This implies P(A intersect B) = P(A|B)P(B). By the first definition of independence, we have P(A intersect B) = P(A)P(B), which gives the third definition. Similarly, we can show all three definitions are equivalent.
wlu4
Typewritten Text
wlu4
Typewritten Text
S = {MM, MF, FM, FF}. A = {MF,FF}, B = {MF,MM}. P(A) = P(B) = 2/4 = 0.5. A intersect B = {MF}. P(A intersect B) = 1/4 = 0.5 * 0.5 = P(A)*P(B). Therefore, A and B are independent.
wlu4
Typewritten Text
--------
wlu4
Typewritten Text
wlu4
Typewritten Text
outcomes
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
Define A = {student has a VISA card}; B = {student has a master card}. P(A) = 0.48; P(B) = 0.64. P(A intersect B) = 0.35. P(A|B) = P(A intersect B)/P(B) = 0.35/0.64 = 0.547.
wlu4
Typewritten Text
Because P(A|B) is not equal to P(A), A and B are not independent.
Page 6: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Laws of ProbabilitySometimes probabilities of events can be obtained by using multiplicative and additive rules.

:

P (A ∩B) = P (B|A)P (A) = P (A|B)P (B)

Notice that if A and B are , then

P (A ∩B) = P (A)P (B)

The multiplicative law can be extended to cover 3 or more events:

P (A ∩B ∩ C) = P (A ∩B)P (C|A ∩B) = P (A)P (B|A)P (C|A ∩B).

Using the Multiplicative Law(Urn Example) - An urn contains 10 marbles, 4 are red (R) and 6 are black (B).

1. If 2 are randomly chosen from the urn, what is the probability that both are black?

2. If 1 is randomly chosen, then replaced, and then another randomly chosen (making theselections independent evenets), what is the probability of selecting a red then a black?

Example - Flip a fair coin 3 times, find the probability of observing 3 heads (HHH) assumingindependent flips.

92

wlu4
Typewritten Text
multiplicative law
wlu4
Typewritten Text
independent
wlu4
Typewritten Text
Remark: "the use of multiplicative law": when calculating the probability of the intersection of events, it may be easier to first calculate the conditional probability (say P(A|B)) and the marginal probability (say P(B)), and then compute the probability of intersection using the multiplicative law.
wlu4
Typewritten Text
Define A = {the first chosen is black}; B = {the second chosen is black}. A intersect B = {both are black} P(A) = 6/10 = 0.6; P(B|A) = 5/9 (why? sampling without replacement) P(A intersect B) = P(B|A)P(A) = (5/9)*0.6 = 0.333.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
"sampling with replacement"
wlu4
Typewritten Text
A = {first chosen is red}; B = {second chosen is black}. A intersect B = {RB}. P(A intersect B) = P(A)P(B) = (4/10)*(6/10)=0.24.
wlu4
Typewritten Text
Similarly, P({both black}) = P({first black})P({second black}) = (6/10)*(6/10) = 0.36.
wlu4
Typewritten Text
P({HHH}) = P({first is H})P({second is H})P({third is H}) = 0.5*0.5*0.5 = 0.125.
Page 7: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

:

P (A ∪B) = P (A) + P (B)− P (A ∩B)

Note: If A and B are disjoint, then P (A ∪B) = P (A) + P (B).

:

P (A ∪B ∪ C) = P (A) + P (B) + P (C)− P (A ∩B)

−P (A ∩ C)− P (B ∩ C) + P (A ∩B ∩ C)

Using the Additive Law

• (Credit Card Example) - The proportion of NCSU students with a VISA card is 0.48,the proportion with a MasterCard is 0.64, the proportion with both is 0.35.Find the probability that a randomly sampled student has a VISA or MasterCard (orboth).

• Can A and B be disjoint if P (A) = 0.4 and P (B) = 0.7? What if P (B) = 0.3?

93

wlu4
Typewritten Text
additive law
wlu4
Typewritten Text
Application: used to calculate the probability of the union of events.
wlu4
Typewritten Text
Here, disjoint means mutually exclusive.
wlu4
Typewritten Text
Extension to the union of three events
wlu4
Typewritten Text
P(A union B) = P(A) + P(B) - P(A intersect B) = 0.48 + 0.64 - 0.35 = 0.77. How about the probability that a randomly sampled student only has one type of card (i.e. has visa but no master or has master but no visa)?
wlu4
Typewritten Text
P(A union B) - P(A intersect B) = 0.77 - 0.35 = 0.42.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
Recall if A and B are disjoint, then P(A intersect B) = 0. In addition, we have P(A intersect B) = P(A) + P(B) - P(A union B) = 0.4 + 0.7 - P(A union B) = 1.1 - P(A union B) >= 1.1 - 1 = 0.1 > 0. So, A and B can not be disjoint. When P(B) = 0.3, it is possible.
wlu4
Typewritten Text
wlu4
Typewritten Text
Remark: "relationship between independence and disjoint". Suppose P(A) > 0 and P(B) > 0. Then, "A and B are disjoint" implies A and B are not independent; and "A and B are independent" implies A and B are not disjoint.
Page 8: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

A special case of additive law is obtained by taking B = Ac, where Ac is the complement ofA.

:

P (A) + P (Ac) = 1 implies P (A) = 1− P (Ac)

(de M’er’e’s problem) - This marked the birth of probability theory.In 17th century, once De M’er’e asked Pascal, which is more likely:

• A: rolling at least one six in four throws of a single dice

• B: rolling at least one double six in 24 throws of a pair of dice?

94

wlu4
Typewritten Text
wlu4
Typewritten Text
complement law
wlu4
Typewritten Text
wlu4
Typewritten Text
Application: sometimes, the probability of the complement of an event is much easier to compute than itself. Then, we will first compute the probability of its complement and apply the complement law to find the probability of the event of interest. For example, such events are usually defined by at least or at most ....
wlu4
Typewritten Text
wlu4
Typewritten Text
What is A complement? A_c = {no six in four throws} = A1 intersect A2 intersect A3 intersect A4, where Aj denote the event the jth throw is not a six. Since this is a fair dice, P(A1) = P(A2) = P(A3) = P(A4) = 5/6. In addition, throws are independent. By multiplicative law, P(A_c) = P(A1)*P(A2)*P(A3)*P(A4) = (5/6)^4. Therefore, P(A) = 1 - (5/6)^4 = 0.518. What is B complement? B_c = {no double six in 24 throws}. P(no double six in one throw of a pair of fair dice) = 35/36. P(B) = 1- P(B_c) = 1 - (35/36)^24 = 0.491.
Page 9: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Combining Rules (System reliability Example) - Ai=“Component i works”, P (Ai) = 0.9,i = 1, · · · , 4. Suppose components work or fail independently.

Calculate the probability that the system works, i.e. either both 1 and 2 work, or both 3and 4 work.

95

wlu4
Typewritten Text
P(system works} = P((A1 intersect A2) union (A3 intersect A4)) = P(A1 intersect A2) + P(A3 intersect A4) - P(A1 intersect A2 intersect A3 intersect A4) = P(A1)*P(A2) + P(A3)*P(A4) - P(A1)*P(A2)*P(A3)*P(A4) = 0.9^2 + 0.9 ^2 - 0.9^4 = 0.9639.
wlu4
Typewritten Text
Page 10: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Chapter 7

ST 370 - Random Variables

Readings: Chapter 2.8, Chapter 3.1-3.4, 3.6, Chapter 4.1-4.4, 4.6-4.7

Motivating Ex.:Assume that all men’s basketball teams playing this season are equally strong. We areinterested in the number of points scored by NC State in each game.

• Before each game, we know the population of possible values.

• Each value occurs with some probability.

• However, we do not know what will be the number of points scored by NC State duringthe next game.

The outcome is random, hence a random variable.

• A Random Variable (RV) is a real-valued function

– Domain =

– Range =

An RV assigns a real number to each outcome possible.

Two Types of RVs we’ll discuss

• : takes on a subset of intervals of real numbers

• : takes on finite or countably infinite # of values

96

wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
all possible outcomes in sample space
wlu4
Typewritten Text
all possible values of a random variable
wlu4
Typewritten Text
continuous RV
wlu4
Typewritten Text
discrete RV
Page 11: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Discrete Random Variables

Example

• Discrete random variable assumes only a finite or countably infinite # of values

• Ex: Flip a coin 3 times - Let Y = # of heads from the 3 tosses

– Range of Y ?

– Called in probability

• Each outcome has a

• Function f(y) = P (Y = y) is called the

Distribution

• PMF can be represented as a table:

Value of Y y1 y2 ... ynProbability f(y1) f(y2) ... f(yn)

• Or by a formula

fY (y) = P (Y = y) =

(3

y

)0.5y(1− 0.5)3−y

for y = 0, 1, 2, 3 (and fY (y) = 0 otherwise).

97

wlu4
Typewritten Text
0, 1, 2, or 3.
wlu4
Typewritten Text
probability mass function (PMF)
wlu4
Typewritten Text
probability
wlu4
Typewritten Text
wlu4
Typewritten Text
the relative frequency of each
wlu4
Typewritten Text
possible outcome
wlu4
Typewritten Text
S = {HHH,HHT,HTH,THH,HTT,THT,TTH,TTT}
wlu4
Typewritten Text
the event {Y = 2} = {HTH, THH, HHT}
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
P(Y = 0) = 1/8; P(Y = 1) = 3/8; P(Y = 2) = 3/8; P(Y = 3) = 1/8.
wlu4
Typewritten Text
Page 12: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

• Our interest will often lie in characteristics of the RV such as:

– What is the

– What is the

– How much

• In the end, knowing these things will allow us to make inference!

Properties of discrete probability distributions

To be a pmf, f(y) must have the properties -

1. for every y

2. , where∑

y is the sum taken over the support of Y

(i.e. all realizations of Y where f(y) > 0)

Let’s check the pmf of the coin example meets these requirements.

98

wlu4
Typewritten Text
0 <= f(y) <= 1
wlu4
Typewritten Text
sum_{y} f(y) = 1
wlu4
Typewritten Text
P(Y = 0) = 1/8; P(Y = 1) = P(Y = 2) = 3/8; P(Y = 3) = 1/8.
wlu4
Typewritten Text
range of RV
wlu4
Typewritten Text
probability mass function for each value of RV
wlu4
Typewritten Text
is the probability of the RV taking values in certain range?
Page 13: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Computing probabilities

• Note that for different realizations yi and yj, the events

• Using what we know about probabilities:

P (Y = yi or Y = yj) =

• Let’s compute P (Y ≥ 2) for the coin example

Computing probabilities

• Generally, we can use this logic to find: (Note: We do need to be careful about ≥ vs >and ≤ vs <)

=∑y:y≤b

f(y)

=∑y:y>a

f(y)

=∑

y:a≤y≤b

f(y).

99

wlu4
Typewritten Text
are mutually exclusive
wlu4
Typewritten Text
Here, y_i and y_j are different values of Y.
wlu4
Typewritten Text
P(Y = y_i) + P(Y = y_j).
wlu4
Typewritten Text
why? (recall the additive law for disjoint events.)
wlu4
Typewritten Text
P(Y >= 2) = P(Y=2) + P(Y=3) = 3/8 + 1/8 = 1/2.
wlu4
Typewritten Text
P(Y <= b)
wlu4
Typewritten Text
P(Y > a)
wlu4
Typewritten Text
P(a <= Y <= b)
Page 14: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Another Example Let X (Any capital can be used to denote a RV) = # of attempts topass a driving test. Suppose the tests are independent and you pass with probability 0.7.

• Determine the support of X

• Find f(x), the pmf of X

• Find∑

x f(x)

• Find P (X =≤ 2 or X = 4)

• Find P (X ≥ 3)

100

wlu4
Typewritten Text
wlu4
Typewritten Text
(here support mean the range of X)
wlu4
Typewritten Text
x = 1, 2, 3, ...
wlu4
Typewritten Text
P(X = x) = ? The event {X = x} implies what? (Ans: it takes x attempts to pass the driving test. In other words, the first x-1 attempts are all failures and the last one is success.) Here, pass a test in one attempt (success) is 0.7; and fail a test in one attempt (failure) is 0.3. And all attempts are independent. Therefore, we have P(X = x) = 0.3^(x-1)*0.7.
wlu4
Typewritten Text
= 0.7 + 0.3*0.7 + 0.3^2*0.7 + ... = 0.7*(1+0.3+0.3^2+...) = 0.7*(1/(1-0.3)) = 1.
wlu4
Typewritten Text
P(X = 1) + P(X = 2) + P(X = 4) = 0.7 + 0.21 + 0.0189 = 0.9289
wlu4
Typewritten Text
= 1 - P(X=1) - P(X=2) = 1 - 0.7 - 0.21 = 0.09.
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
= sum_x P(X = x)
wlu4
Typewritten Text
wlu4
Typewritten Text
= sum_x 0.3^(x-1)*0.7
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 15: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

The pmf defines a RV’s

• The does as well

Example - What is the CDF for the driving attempts example?

Example - There is a chance that a bit transmission is received in error. Let Y = # of bitsin error for the next four bits transmitted.

• Possible outcomes of Y ?

Value of YProbability 0.6561 0.2916 0.0486 0.0036 0.0001

• What is the cdf of Y ? Let’s plot it as well.

101

wlu4
Typewritten Text
distribution
wlu4
Typewritten Text
cumulative distribution function
wlu4
Typewritten Text
CDF: F(y) = P(Y <= y).
wlu4
Typewritten Text
0
wlu4
Typewritten Text
1
wlu4
Typewritten Text
2
wlu4
Typewritten Text
3
wlu4
Typewritten Text
4
wlu4
Typewritten Text
P(X < = x) = sum_{y <= x} 0.3^(y-1)*0.7 = 1 - 0.3^x, x = 1,2, ....
wlu4
Typewritten Text
F(y) = 0, when y < 0; F(0) = P(Y <= 0) = 0.6561; F(1) = P(Y < = 1) = 0.6561+0.2916 = 0.9477; F(2) = P(Y <= 2) = 0.6561+0.2916 + 0.0486 = 0.9963; F(3) = P(Y <= 3) = 0.6561+0.2916 + 0.0486 + 0.0036 = 0.9999; F(4) = P(Y <= 4) = 0.6561+0.2916 + 0.0486 + 0.0036 + 0.0001 = 1. F(y) = 1, when y > 4.
wlu4
Typewritten Text
CDF is a step increasing function with the jumps at the possible values of the RV.
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 16: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Binomial Distribution

Recognizing a Distribution

• Note: Coin example has a common structure to it.

• Similar experiments with similarly defined RV’s yield the same

• This particular distribution so common, it is called the

• Knowing and being able to recognize common distributions will save us from having toderive things over and over!

When does a RV follow the Binomial Distribution?Consider the following experiments:

• a coin is flipped, the outcome is either a head or a tail.

• a baby is born, the baby is either born in March or is not.

In each of these examples, there are two

For convenience, we can label these

Bernoulli Trials

• An experiment with only two possible mutually exclusive outcomes (such as S or F) iscalled a Beroulli Trial.

– Bernoulli trials are the basis of three families of distributions:

∗ distribution

∗ distribution

∗ distribution

• Denote the as P (S) = p

• Then the is P (F ) = 1− p = q

102

wlu4
Typewritten Text
probability distribution
wlu4
Typewritten Text
binomial distribution
wlu4
Typewritten Text
wlu4
Typewritten Text
wlu4
Typewritten Text
possible outcomes
wlu4
Typewritten Text
outcomes as success or failure
wlu4
Typewritten Text
binomial
wlu4
Typewritten Text
geometric
wlu4
Typewritten Text
negative binomial
wlu4
Typewritten Text
success probability
wlu4
Typewritten Text
failure probability
Page 17: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

We have a Binomial Experiment if:

1. Full experiment consists of a sequence of

2. on each trial (BernoulliTrials)

3. Probability of success P (S) = p is , where 0 ≤p ≤ 1

Define the RV Y =

Then Y is said to follow a binomial distribution.

Defining the PMF of the Binomial DistributionEx: Suppose we have a Binomial Experiment with n = 3 trials and P (S) = p where p is anunknown parameter

• Let Y be the # of successes –

• Support of Y ?

Computing P (Y = y)

Outcome P (Outcome) y Reps P (Y = y)SSS ppp = p3 3 1 p3

SSF

SFS

FSS

SFF

FSF

FFS

FFF

103

wlu4
Typewritten Text
n independent trials
wlu4
Typewritten Text
two possible outcomes (S or F)
wlu4
Typewritten Text
the same across all trials
wlu4
Typewritten Text
the number of successes in n trials
wlu4
Typewritten Text
Y ~ B(n, p)
wlu4
Typewritten Text
0, 1, 2, 3
wlu4
Typewritten Text
pp(1-p)
wlu4
Typewritten Text
2
wlu4
Typewritten Text
wlu4
Typewritten Text
p(1-p)p = p^2(1-p)
wlu4
Typewritten Text
wlu4
Typewritten Text
= p^2(1-p)
wlu4
Typewritten Text
(1-p)pp = p^2(1-p)
wlu4
Typewritten Text
2
wlu4
Typewritten Text
2
wlu4
Typewritten Text
3
wlu4
Typewritten Text
3p^2(1-p)
wlu4
Typewritten Text
p(1-p)(1-p)
wlu4
Typewritten Text
1
wlu4
Typewritten Text
(1-p)p(1-p) = p(1-p)^2
wlu4
Typewritten Text
= p(1-p)^2
wlu4
Typewritten Text
(1-p)(1-p)p = p(1-p)^2
wlu4
Typewritten Text
1
wlu4
Typewritten Text
1
wlu4
Typewritten Text
3
wlu4
Typewritten Text
3p(1-p)^2
wlu4
Typewritten Text
(1-p)(1-p)(1-p) = (1-p)^3
wlu4
Typewritten Text
0
wlu4
Typewritten Text
1
wlu4
Typewritten Text
(1-p)^3
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 18: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

PMF of the Binomial Distribution For general n, the event (Y = y) occurs when thereare exactly

• Consider one such outcome w/1st y trials successful last n− y failures:

SSS · · ·SFFF · · ·F

• Probability of this outcome?

• How many different sequences with exactly y successes in n trials?

The pmf of a binomial distributed random variable Y is:

y = 0, 1, 2, · · · , n, 0 ≤ p ≤ 1

Binomial Distribution ExampleSuppose 60% of NCSU students favor closed-book exams. A random sample (outcomesindependent) of 5 NCSU students is drawn.

1. Define Success/Failure, n, p, and a RV Y that follows the Binomial distribution

2. Calculate P (exactly 1 in favor)

3. Calculate P (less than 2 in favor)

4. Calculate P (4 or more in favor)

104

wlu4
Typewritten Text
y success outcomes
wlu4
Typewritten Text
p^y * (1-p)^(n-y)
wlu4
Typewritten Text
choose y trials out of n, which is a combination number, C(n,y) = n!/(y! * (n-y)!)
wlu4
Typewritten Text
P(Y = y) =
wlu4
Typewritten Text
n!/(y! * (n-y)!) *
wlu4
Typewritten Text
p^y * (1-p)^(n-y)
wlu4
Typewritten Text
wlu4
Typewritten Text
success: a sampled student favors closed-book exam failure: a sampled student dosen't favor closed-book exam n = 5; p = 0.6; Y = the # of students favoring closed-book exam in the 5 sampled students Y ~ B(5, 0.6)
wlu4
Typewritten Text
P(Y = 1) =
wlu4
Typewritten Text
C(5,1)*0.6^1*0.4^4 = 5*0.6^1*0.4^4 = 0.0768
wlu4
Typewritten Text
wlu4
Typewritten Text
P(Y < 2) = P(Y = 0) + P(Y=1) = C(5,0)*0.6^0*0.4^5 + 0.0768 = 0.01024+0.0768 = 0.08704
wlu4
Typewritten Text
wlu4
Typewritten Text
P(Y >= 4) = P(Y=4) + P(Y=5) = C(5,4)*0.6^4*0.4^1 + C(5,5)*0.6^5*0.4^0 = 0.2592+0.07776 = 0.33696.
Page 19: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Characteristics of RVs that are of InterestQuestions of interestAs we said earlier, we will be interested in things like the of the

RV or the in the observed outcomes etc.

• Want to know the mean or average value of the RV, i.e. Expected Value - denoted as

• Interested in the variability of the RV, i.e. Variance - denoted as

• Expected Value of a discrete RV Y with pmf f(y) is

– Sum over the entire support of Y

• If Y has support y1, y2, · · · , ym, then

• Notice this mean is denoted by µY , a greek symbol. This implies it is the true

Binomial Expected Value

• Let’s calculate the expected value of Y from the 3 coin example

• Generally, if Y ∼ Bin(n, p),

105

wlu4
Typewritten Text
expected value
wlu4
Typewritten Text
variations
wlu4
Typewritten Text
E(X)
wlu4
Typewritten Text
Var(X) or V(X)
wlu4
Typewritten Text
E(Y) = sum_y y*P(Y=y)
wlu4
Typewritten Text
E(Y) = y1*P(Y = y1) + ... + ym*P(Y = ym)
wlu4
Typewritten Text
parameter value (usually unknown) for the population.
wlu4
Typewritten Text
E(Y) = 0*(1/8) + 1*(3/8) + 2*(3/8) + 3*(1/8) = 12/8 = 1.5
wlu4
Typewritten Text
E(Y) = n*p
wlu4
Typewritten Text
This agree with the intuition because we did n independent trials and each trial has the same probability p to get a success outcome, then the expected number of successes in n trials is n*p.
Page 20: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

• Variance of a discrete RV Y with pmf p(y) is

– Again sum over entire support of Y

• Standard Deviation of Y is defined as the positive square root of V ar(Y )

• To actually find a variance, it is often easier to work with the Variance–ComputingFormula

V ar(Y ) = E(Y 2)− [E(Y )]2

– where E(Y 2) =∑

y y2 × f(y)

• Let’s calculate V ar(Y ) from the 3 coin example

• Generally, if Y ∼ Bin(n, p), then

Multiple Choice Test ExampleConsider a multiple choice test with 20 questions, each with five possible answers (a,b,c,d,e),only one of which is correct. Let Y= # of questions guessed correctly.

1. Let’s verify Y follows a binomial, calculate E(Y ), and calculate V ar(Y ).

2. If scores of 50% and higher are passing, find the formula (i.e. don’t simplify) for theprobability of passing by guessing.

106

wlu4
Typewritten Text
V(Y) = sum_y (y - E(Y))^2*P(Y=y)
wlu4
Typewritten Text
SD(Y)
wlu4
Typewritten Text
V(Y) = n*p*(1-p)
wlu4
Typewritten Text
E(Y^2) = 0^2*(1/8)+1^2*(3/8)+2^2*(3/8)+3^2(1/8) = 24/8 = 3 V(Y) = E(Y^2) - (E(Y))^2 = 3 - 1.5^2 = 3 - 2.25 = 0.75
wlu4
Typewritten Text
success outcome: guess the answer correctly; failure: guess the answer wrong. success probability: p = 0.2 (random guess 1/5). the guesses for all questions are independent Y ~ B(20, 0.2) E(Y) = 20*0.2 = 4; V(Y) = 20*0.2*0.8 = 3.2.
wlu4
Typewritten Text
P(Y > = 0.5*20) = P(Y >= 10) =sum_{y>=10} C(20,y)*0.2^y*0.8^(20-y) = 0.0026.
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 21: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Other Discrete Distributions

• We have looked at our quantities of interest only using the Binomial Distribution

• There are many other distributions that aren’t named but some others that are - suchas:

– Hypergeometric

– Negative Binomial

– Poisson

– Discrete Uniform

A No-Name Distribution Example

• Suppose the probability of winning a given amount on a scratch off lottery ticket isWin($) Chance

0 0.821 0.15 0.0510 0.0220 0.009

1000 0.001Total 1

• Let’s find the mean, variance, and standard deviation of the RV: Y = Amount Won

107

wlu4
Typewritten Text
Geometric distribution
wlu4
Typewritten Text
E(Y) = 0*0.82+1*0.1+5*0.05+10*0.02+20*0.009+1000*0.001= 1.73
wlu4
Typewritten Text
wlu4
Typewritten Text
V(Y) = (0-1.73)^2*0.82+(1-1.73)^2*0.1+(5-1.73)^2*0.05+(10-1.73)^2*0.02+(20-1.73)^2*0.009+(1000-1.73)^2*0.001 = 1003.957
wlu4
Typewritten Text
SD(Y) = square root of V(Y) = 31.68
wlu4
Typewritten Text
wlu4
Typewritten Text
Page 22: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 23: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Chapter 3 Making Inference Hypothesis Testing Idea:You love Pepsico and their products. They are having a promotion where their bottle capsare either winners (a free Pepsico product) or losers. Your friend claims you will hardly everwin, in fact he thinks only 1 in 20 bottles is a winner. You think the chance of winning ismuch higher than that.

To prove him wrong you grab 50 randomly selected Pepsico bottles and find that 12 ofyour caps are winners. How can we show your friend you are most likely correct?

108

wlu4
Typewritten Text
If your friend is correct (null hypothesis), then the success probability p = 1/20 = 0.05 (i.e. the probability to get a winner bottle). Here, you did an experiment of randomly selecting 50 bottles. Define Y = the # of winner bottles in the 50 sampled bottles. Y follows a binomial distribution (why?), i.e. Y ~ B(50, 0.05) if your friend is correct. We calculate the probability for your observed outcome, i.e. P(Y = 12) = C(50, 12)*0.05^12*(1-0.05)^38 = 0.00000422. In other words, if your friend is correct (i.e. null hypothesis is correct), it is very unlikely to see 12 winner bottle out of 50 since the probability is very tiny. This gives strong evidence that your friend might be wrong. In fact, more formally, we will compute the following probability for making inference P(Y >= 12) = 0.00000497, which is also very tiny. This is the probability to get the observed outcome or even more extreme value than the observed outcome when the null hypothesis is true.
wlu4
Typewritten Text
wlu4
Typewritten Text
---------
wlu4
Typewritten Text
wrong
Page 24: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and

Continuous Random Variables

A has an interval or collection of intervals as its supportEx:

• Y=maximum daily temperature (interval [−40◦F, 130◦F ]).

• Y=lifetime (in years) of electronic equipment 0 < Y <∞

• Y=weight loss (or gain) after a 6 month period −∞ < Y <∞.

For Discrete RVs we had the pmf, f(y) = P (Y = y).

For Continuous RVs we have the pdf, or

• A pdf, f(x), describes the probability distribution of a continuous random variable.

• Probability a randomly chosen value will lie between any 2 given values is representedin terms of the area between the two values under the pdf.

A function f(y) is a pdf if

1. f(y) is a , i.e. f(y) ≥ 0 for all y

2. The area under f(y) is one, i.e. the P (−∞ < Y <∞) = 1

Similar to pmf property∑

y f(y) = 1

We can find probabilites using integrals:

109

wlu4
Typewritten Text
continuous RV
wlu4
Typewritten Text
probability density function
wlu4
Typewritten Text
Remark: note that for a continuous rv X, P(X = x) = 0 for any given x.
wlu4
Typewritten Text
In other words, P(a < X < b) = P(a <= X <= b) = P(a<= X < b) = P(a < X <= b).
wlu4
Typewritten Text
wlu4
Typewritten Text
nonnegative function
wlu4
Typewritten Text
P(a < X < b) = int_a^b f(x) dx.
Page 25: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 26: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 27: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 28: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 29: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 30: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 31: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 32: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 33: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 34: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 35: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and
Page 36: ST 370 - Probabilitylu/ST370/Note_5_lu.pdf · The conditional probability of an event Agiven that an event Bhas occurred is equal to Basic Example- The game host puts $10K, $100 and