stat 213: intro to statistics and...

33
1 Stat 213: Intro to Statistics 3 and 4 H. Kim Fall 2007

Upload: dinhliem

Post on 09-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

1

Stat 213: Intro to Statistics 3 and 4

H. Kim

Fall 2007

Page 2: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

2

random phenomena

• we know that what outcomes could happen, but not whichparticular value will happen

• trial: a single attempt or realization of a random phenomenon

• outcome: the value measured, observed, or reported for anindividual instance of that trial

• event: a collection of outcomes

Page 3: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

3

examples

• example:

– trial: tossing a die and observing the face that appears

– outcomes: 1, 2, 3, 4, 5, 6

– event: odd number, 1, 3, 5

• example:

– trial: a toss of a coin

– outcomes: head(H); tail (T)

– event A: observe a head

• example:

– trial: three tosses of a coin

– outcomes:

– event A: observe exactly two heads

Page 4: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

4

probability

• probability is used as a tool: it allows you to evaluate thereliability of inference about the population when you haveonly sample information

• when the population is known, the probability is used todescribe the likelihood of observing a particular outcome

• when the population is unknown and only a sample from thepopulation is available, probability is used in makingstatements about makeup of population, i.e. in makingstatistical inferences

Page 5: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

5

probability

• that reports the likelihood of the event’s occurrence

• derived from equally likely outcomes

• the long-run relative frequency of the event’s occurrence

– law of large numbers (Jacob Bernoulli, 1713): thelong-run relative frequency of repeated independentevents settles down to the true relative frequency asthe number of trials increases

• the collection of all possible outcomes: sample space (S)

– P (A): the probability of the event A

– 0 ≤ P (A) ≤ 1

– P (S) = 1

Page 6: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

6

how to calculate the probability of event A ?

P (A) =count of outcomes in A

count of all possible outcomes

• example:

– trial: a toss of a coin

– outcomes: head(H); tail (T) =⇒ S = {H,T}– event A: observe a head = {H}– event B: observe a tail = {T}– P (A) = 1

2 ; P (B) = 12 ; P (S) = 1

Page 7: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

7

example

• trial: three tosses of a coin

– outcomes:

– event A: observe exactly two heads: = {HHT,HTH, THH}P (A) = 3

8

– event B: observe exactly two tails:

– event C: observe at least one tails:

– check that P (S) = P (all possible outcomes) = 1

Page 8: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

8

complement rule

• the complement of an event A, Ac, consists of all the evens in S

that are not in A event

• P (Ac) = 1− P (A)

• complement rule: P (A) = 1− P (Ac)

Page 9: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

9

disjoint; mutually exclusive

• when one event occurs, the other cannot and vice versa

• no outcomes in common

Page 10: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

10

additive rule

• the union of events A and B, A ∪B, is the event that A or B

or both occur

• for two disjoint events A and B, the probability that one orthe other occurs is the sum of the probabilities of the twoevents:

• P (A ∪B) = P (A) + P (B)

Page 11: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

11

intersection

• the intersection of events A and B, A ∩B, is the event thatboth A and B occur

– P (A ∩B)

Page 12: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

12

general additive rule

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

Page 13: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

13

laws

• DeMorgan’s laws:

P [Ac ∪Bc] = P [(A ∩B)c] and P [Ac ∩Bc] = P [(A ∪B)c]

• total law of probability:

P (A) = P (A ∩B) + P (A ∩Bc)

Page 14: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

14

multiplicative rule

• for two independent events A and B, the probability thatboth A and B occur is the product of the probabilities of thetwo events: P (A ∩B) = P (A)× P (B)

Page 15: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

15

tree diagram

• example: three tosses of a coin

1st 2nd 3rd event

H

T

Page 16: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

16

permutation

• an ordered arrangement

– suppose the outcome is a (1, 2).

– there are 2 different ways: (1, 2) and (2, 1)

• the number of ways to arrange n-distinct objects is given by:

n! = n× (n− 1)× (n− 2)× · · · × 2× 1

– the number of ways with two district values: 2! = 2× 1 = 2

– 0! = 1

Page 17: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

17

combination

• the order of the selection is not important

– suppose the outcome is a (1, 2).

– select 2-distinct objects: (1, 2) or (2, 1)

• the number of ways to select r-distinct objects from n-distinctobjects is given by: n

r

=n!

r!(n− r)!

–0@ 2

2

1A = 1

–0@ 2

1

1A = 2

Page 18: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

18

example

• A boxcar contains 7 electronic systems of which 2 are defective.3 are selected at random for testing. What is the probabilitythat

a. one of the 3 is defective ?

b. none are defective ?

Page 19: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

19

example

• Two commissioners are to be selected from a total of 5commissioners C1, C2, C3, C4, C5 to form a committee. Let S bethe sample space, A be the event that C2 will be in thecommittee and B be the event that C5 will be the committee.

a. List the events of S, A, B, A ∩B and A ∪B.

b. Calculate the probabilities of A, B, A ∩B, A ∪B and(A ∪B)c.

c. Are A and B mutually exclusive ? Why ?

Page 20: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

20

conditional probability

• probability that take into account a given condition

• P (A|B): probability of A given B

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

P (B)

Page 21: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

21

general multiplicative rule

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

Page 22: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

22

independence

• events A and B are independent whenever P (A|B) = P (A) orP (B|A) = P (B)

• if A and B are independent,

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

• disjoint events can’t be independent: the probability ofevent A is the same as the probability of event A after theevent B occurs ?

Page 23: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

23

example

P (A) = 0.4, P (B) = 0.2, P (C) = 0.1, P (A|B) = 0.3 and P (A∩C) = 0.04

• P (A ∩B) =

• P (A ∪B) =

• P (A|C) =

• P (Cc) =

• are A and B mutually exclusive? why ?

• are A and B independent ? why ?

• are A and C independent ? why?

Page 24: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

24

example

• the probability of rain today is 0.2 and same for tomorrow; theprobability of rain on both days is 0.1; what is the probabilityof some rain tomorrow if it is raining today ?

Page 25: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

25

contingency table and conditional probability

A B C total

M n1 n2 n3 nM = n1 + n2 + n3

F n4 n5 n6 nF = n4 + n5 + n6

total nA nB nC n = nA + nB + nC

= n1 + n4 = n2 + n5 = n3 + n6 = nM + nF

• P (A) = nAn

, P (B) = nBn

, P (C) = nCn

• P (M) = nMn

, P (F ) = nFn

• P (M ∩B) = n2n

, P (C ∩ F ) = n6n

• P (M |B) = P (M∩B)P (B)

= n2/nnB/n

= n2nB

• P (C|F ) = P (C∩F )P (F )

= n6/nnF /n

= n6nF

Page 26: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

26

example

• A group of 200 voters in a certain electoral poll are classifiedaccording to gender and candidate preference. Suppose that avoter is selected from this group.

preferred candidate

gender A B C total

male (M) 20 36 24 80

female (F) 40 44 36 120

total 60 80 60 200

• Find P (F ), P (B), P (Bc), P (B ∩ F ), P (B ∪ F ) and P (B|F ).

• Are F and B independent ? Why ?

Page 27: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

27

reversing the conditioning

• suppose the sample space can be partitioned into 2sub-populations, S1 and S2, and they are mutually exclusive

A = (A ∩ S1) ∪ (A ∩ S2)

P (A) = P (A ∩ S1) + P (A ∩ S2)

= P (A|S1)P (S1) + P (A|S2)P (S2)

P (S1|A) =P (S1 ∩A)

P (A)=

P (S1 ∩A)P (A|S1)P (S1) + P (A|S2)P (S2)

Page 28: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

28

example

• A sample is selected from one of two population, S1 and S2, with

probability P (S1) = 0.7 and P (S2) = 0.3. If the sample has been

selected from S1, the probability of observing an event A is

P (A|S1) = 0.2. Similarly, if the sample has been selected from S2,

the probability of observing A is P (A|S2) = 0.3.

– If a sample is randomly selected from one of the two populations,

what is the probability that event A occurs ?

– If a sample is randomly selected and event A is observed, what is

the probability that the sample was selected from population S1?

Page 29: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

29

Bayes’s rule

• want to find the probability of Si given the information theevent A is observed with prior probability P (Si)

P (Si|A) =P (Si ∩A)

P (A)

=P (A|Si)P (Si)

P (A|S1)P (S1) + P (A|S2)P (S2)

Page 30: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

30

example

• suppose that in a particular city, airport A handles 50% of all airline

traffic, and airports B and C handle 30% and 20%, respectively; the

detection rate for weapons at the three airports are 0.9, 0.5 and 0.4,

respectively; if a passenger at one of the airports is found to be

carrying a weapon through the boarding gate, what is the

probability that the passenger is using airport B ?

• P (airport A handles airline traffic) = 0.5

• P ( ) = 0.9

• P (a passenger is carrying a weapon|airport B) = ( )

• P (airport B|a passenger is carrying a weapon) = ( )

Page 31: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

31

total law of probability

• suppose the sample space can be partitioned into k

sub-populations, S1, S2, · · · , Sk (let say, k = 3) and they aremutually exclusive

A = (A ∩ S1) ∪ (A ∩ S2) ∪ (A ∩ S3)

P (A) = P (A ∩ S1) + P (A ∩ S2) + P (A ∩ S3)

= P (A|S1)P (S1) + P (A|S2)P (S2) + P (A|S3)P (S3)

Page 32: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

32

Bayes’s rule

• want to find the probability of Si given the information theevent A is observed with prior probability P (Si)

P (Si|A) =P (Si ∩A)

P (A)

=P (A|Si)P (Si)

P (A|S1)P (S1) + P (A|S2)P (S2) + P (A|S3)P (S3)

• general form for i = 1, · · · , k

P (Si|A) =P (A|Si)P (Si)

P (A|S1)P (S1) + · · ·+ P (A|Sk)P (Sk)

Page 33: Stat 213: Intro to Statistics and 4contacts.ucalgary.ca/.../courses/STAT213/F2007/...F07-LEC5-Topic_3.pdf · random phenomena we know that what ... A group of 200 voters in a certain

33

the previous example

• suppose that in a particular city, airport A handles 50% of all airline

traffic, and airports B and C handle 30% and 20%, respectively; the

detection rate for weapons at the three airports are 0.9, 0.5 and 0.4,

respectively; if a passenger at one of the airports is found to be

carrying a weapon through the boarding gate, what is the

probability that the passenger is using airport B ?

• S1= airport A handles airline traffic; P (S1) = 0.5

• S2= airport B handles airline traffic; P (S2) = 0.3

• S3= airport C handles airline traffic; P (S3) = 0.2

• D = detection for weapons at an airport

P (D|S1) = 0.9, P (D|S2) = 0.5 and P (D|S3) = 0.4

• P (S1|D) = P (D|Si)P (Si)P (D|S1)P (S1)+P (D|S2)P (S2)+P (D|S3)P (S3)