Title: Stat 31, Section 1, Last Time
1Stat 31, Section 1, Last Time
- Foundations of Probability
- Events, Sample Space
- Probability Function
- Big Rules of Probability
- The not rule
- Pnot A 1 PA
- The or rule
- PA or B PA PB PA and B
2Big Rules of Probability
- Now head towards a rule for and
- Needs a new concept
- Conditional Probability
- Idea If event A is known to have occurred,
- what is chance of B?
- Note knowing A means sample space is
restricted to A
3Conditional Probability
- E.g. Roll a die, A even, B 1,2,3
- PB, when A is known ???
- (i.e. Somebody rolls, and only tells you even.
Note lt 3 is no longer 50-50, - Since fewer evens are lt 3)
4Conditional Probability
- E.g. Roll a die, A even, B 1,2,3
- PB, when A is known ???
- Try equally likely
- CAREFUL This is wrong!!!
- Problem for B, should not include 4 or 6
5Conditional Probability
- E.g. Roll a die, A even, B 1,2,3
- PB, when A is known ???
- Correct Answer
- Makes sense, since chance should go down from ½.
6Conditional Probability
- General definition
- Probability of B given A
- Next, by multiplying by PA, get and rule of
probability
7And Rule of Probability
- Big Rule III
- PA B PAB PB PBA PA
- Memory trick like canceling fractions, but
make bar vertical, not a fraction - Note 2 ways to do this. Good strategy look at
both, as one is often easier.
8The And Rule of Probability
- HW
- 4.93
- 4.95
- 4.100 (ignore tree diagram, 0.44)
9Big Rules of Probability
- Example illustrating power (and use) of rules
- Toss a Coin
- if H take a ball from I R R G G G
- if T take a ball from II R R G
- Now study progressively harder problems
10Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. A
- PR I 2/5
- (chance of R, if know from Urn 1)
- Simple equally likely calculation (just
counting) works here
11Related HW
- HW C11
- A company makes 40 of its cars at factory A, and
the rest at factory B. Factory A produces 10
lemons, and Factory B produces 5 lemons. A car
is chosen at random. What is the probability
that - It came from Factory A? (0.4)
- It is a lemon, if it came from Fact. A? (0.1)
12Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. B PR I ???
- Try simple counting
- PR I
??? - Caution This is wrong!!!
- Reason balls are not equally likely.
13Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. B PR I ???
- Correct Answer
- PR I PI R PR (OK, but hard)
- PR I PI (2/5)(1/2) 1/5
- Note lt ¼ (from wrong answer above)
14Related HW
- HW C11
- It is a lemon, from Factory A? (0.04)
- (think carefully about contrast with (b))
15Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. C PR ???
- Try simple counting
- PR ???
- Caution This is wrong!!!
- Reason again balls are not equally likely.
16Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. C PR ???
- Note now expect gt ½, since Rs in II are
more likely (thus get more weight) - Need to take which urn into account, so write
event in terms of the urn ball came from
17Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. C Correct Answer
- PR P(R I) or (R II) (expand)
- PR I PR II 0 (or
Rule) - 1/5 PR II PII
(from B) - 1/5 (2/3)(1/2) 8/15
- Note slightly gt ½ (as expected)
18Related HW
- HW C11
- It is a lemon? (0.07)
19Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. D PI R ???
- Saved for last, since this is hardest
- Although only turn around of e.g. A
- This is common One Cond. Prob. much easier than
the reverse
20Balls in Urns Example
- H ? R R G G G T ? R R G
- E.g. D PI R
- Makes sense if see R, less likely from I
21Related HW
- HW C11
- It came from Factory A, if it is a lemon?
(4/7) - 4.101
- 4.103
22And now for something completely different
- Travis Boyer Suggestion
- I was thinking about something to do for your
"something completely different" time and thought
maybe a preview to the UNC Mens basketball games
would be fun. You could use comparative
histograms to compare us with our opponents stats
like points, rebounds, wins, and many more, or
look at the Vegas betting odds to tie in the
probability aspects. - Cool Idea, but I need a partner.
23Plotting Bivariate Data
- Recall
- Toy Example
- (1,2)
- (3,1)
- (-1,0)
- (2,-1)
24And now for something completely different
- Viewing Higher Dimensional Data
- Extend to higher dimensions
- E.g. replace pairs by triples
- Make 3-d scatterplot
- As points in space
- Think about point cloud
25And now for something completely different
26And now for something completely different
27And now for something completely different
28And now for something completely different
29And now for something completely different
30And now for something completely different
31And now for something completely different
- 1-d
- View
- Proj-
- ection
- on
- X
- Axis
32And now for something completely different
33And now for something completely different
- 1-d
- View
- Proj-
- ection
- on
- Y
- Axis
34And now for something completely different
35And now for something completely different
- 1-d
- View
- Proj-
- ection
- on
- Z
- Axis
36And now for something completely different
- Proj-
- ection
- on
- X-Y
- Plane
37And now for something completely different
- Proj-
- ection
- on
- X-Y
- Plane
- rotated
- up
38And now for something completely different
- Proj-
- ection
- on
- X-Z
- Plane
39And now for something completely different
- Proj-
- ection
- on
- X-Z
- Plane
- rotated
- up
40And now for something completely different
- Proj-
- ection
- on
- Y-Z
- Plane
41And now for something completely different
- Proj-
- ection
- on
- Y-Z
- Plane
- rotated
- up
42And now for something completely different
43And now for something completely different
- Put
- Into
- Single
- Plot -
- 1d on
- Diagnl
44And now for something completely different
- Put
- Into
- Single
- Plot -
- 2d off
- Diagnl
45And now for something completely different
- Called
- Drafts-
- mans
- Plot
- (study
- 3d
- Objects
- In 2d)
46Recall Above Example
- H ? R R G G G T ? R R G
- E.g. D PI R
- Note have turned around Cond. Probs
47Bayes Rule
- Idea Formal framework for turning around
conditional probabilities - IF events are mutually
exclusive and include everything - Set theoretically
- intersections are empty
- union is sample space
- Called a partition of the sample space
48Bayes Rule
- IF events are mutually
exclusive and include everything - THEN
- (decomposition of PA in terms of
Bs) - Usefulness turns around Cond. Probs.
- So can write hard one in terms of easy ones
49Bayes Rule
- E.g. Balls Urns, part D, above
- Urn I (H)
- Urn II (T)
- A R (red ball)
- Note disjoint includes everything
50Bayes Rule Example
- Disease Testing
- Fundamental to modern medicine
- But most are not 100 accurate
- Study Error Rate
- Actually Error Rates, since 2 types of error
- Will see some surprises
- (about turning around cond. probs.)
51Disease Testing Example
- Suppose 1 of population has a disease.
- (fairly rare, but there are rarer diseases)
- Tests are calibrated by applying to known cases
- Give test to 100 w/ Disease and 1000 Healthy
- Suppose 80 have reactions 50 are
- What is error rate? (how good is the test???)
52Disease Testing Example
- What is error rate?
- Note 4 types of error
- P H 50/1000 0.05
- (Chance of healthy person called sick)
- P- D (100 80) / 100 0.20
- (Chance of healthy person called sick)
- So error rate is 20 or 5?
- (or something in between???)
53Disease Testing Example
- Careful We care about the opposite conditional
probabilities (turned around) - PD
- I.e. IF have a reaction
- THEN what are chances of disease?
- Make much difference?
- Guess 80 or 95 (or in between)???
- Sell house and move to Bahamas???
54Disease Testing Example
- Apply Bayes Rule to turn around cond. probs.
- Only 14 !?! (what about 80 to 90?)
55Disease Testing Example
- Error rate only 14 (unlikely have disease?)
- Reason 1 Rarity of disease magnifies errors
- Reason 2 Test Population different from real
population - View Bayes Rule Calculation as adjustment for
this
56Bayes Rule HW
- C12 The workforce in a town has
- (20, 50, 30)
- workers with
- (no HS, HS, no C, C)
- education. Past experience indicates that
- (10, 30, 90)
- of workers with
- (no HS, HS, no C, C)
- Education can perform a given task. Find the
probability that a randomly chosen worker - Can perform the task (0.61)
- Is College educated if (s)he can perform the task
(0.34)
57Independence
- (Need one more major concept at this level)
- An event A does not depend on B, when
- Knowledge of B does not change
- chances of A
- PA B PA
58Independence
- E.g. I Toss a Coin, and somebody on South Pole
does too. - PH(me) T(SP) PH(me) ½.
- (now way that can matter, i.e. independent)
59Independence
- E.g. I Toss a Coin twice
- (toss number indicated with subscript)
- Is it lt ½?
- What if have 5 Heads in a row?
- (isnt it more likely to get a Tail?)
- (Wanna bet?!?)
60Independence
- E.g. I Toss a Coin twice,
- Rational approach
- Look at Sample Space
- Model all as equally likely
- Then
- So independence is good model for coin tosses
61New Ball Urn Example
- H ? R R R R G G T ? R R G
- Again toss coin, and draw ball
- Same, so R I are independent events
- Not true above, but works here, since proportions
of R G are same