Professional Documents
Culture Documents
Math3200 Classnotes PDF
Math3200 Classnotes PDF
Department of Mathematics
Washington University in St. Louis
Class materials are available on course website
(www.math.wustl.edu/ jmding/math3200/ )
Spring 2017
Christian Taylor won the gold in men’s triple jump in 2016 Olympic
with a jump of 17.86 meters. It is amazing that how further a
human can jump comparing with a century ago. The record of
1896 Olympic, when men’s triple jump first presented in Olympic,
was only 13.71 m. To understand how the trip jump distance have
been improved, we collect Olympic records from 1896 to 2016.
I How would you like to present the data?
I What can you tell fro the data?
I Can you make any prediction on 2020 Olympic Men’s Triple
Jump distance?
I How would you quantify the uncertainty of 2020 Olympic
Men’s Triple Jump distance?
1
From: Veaux (2012) “Stats: Data and Models”
Jimin Ding, Math WUSTL Math 3200 Spring 2017 7 / 67
2
Example 3: Kidney Stones Treatment
In 1990s, a medical study was conducted to compare several
treatments of kidney stones, and found that 273 out of 350
patients who underwent open surgery were successfully cured,
while 289 out of 350 who underwent noninvasive percutaneous
nephrolithotomy were successfully cured.
I If you have a friend or relative who has kidney stone problem,
which treatment would you suggest him/her?
I Actually for kidney stones, the treatment is often assigned
based on the size of stones instead of random. See data from
the two subgroups of small and large stones.
New Treatment Standard Treatment
Small Stones 81 out of 87 (93%) 234 out of 270 87%)
Large Stones 192 out of 263 (73%) 55 out of 80 (69 %)
Total 273 out of 350 (78%) 289 out of 350 (83%)
Now which would you suggest?
2
From: Charig et al. (1986). “Comparison of treatment of renal calculi by
open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave
lithotripsy”, British Medical Journal.
Jimin Ding, Math WUSTL Math 3200 Spring 2017 8 / 67
3 4
Example 4: Care Pathway
An OB doctor (obstetrician) wanted to evaluate effect of a care
pathway protocol in childbirth that was implemented two years
ago. She counted the number of different types of delivery prior
and post implementation of the care pathway. She found that the
rate of C-sections dropped by 3%, and the rate of Spontaneous
Vaginal Deliveries increased by 2%.
I Do you think this care pathway is beneficial? Why?
I Can these small percentage changes caused by randomness in
data collection? How to distinguish a random change from a
true improvement?
I If there were 33 C-sections out of 100 inductions pre-pathway
and 30 C-sections out of 100 inductions post-pathway, are
these 3 cases enough to claim the benefit of the care pathway?
I If data were collected from 2000 patients, ... ?
3
From: a recent hospital consulting project
4
Clinical care pathways are essentially protocols that are used to manage
the quality in healthcare concerning the standardization of care processes.
Implementation of care pathway promotes organized and efficient patient care.
Jimin Ding, Math WUSTL Math 3200 Spring 2017 9 / 67
Example 5: “Do I really have cancer?”
I Program editor:
write your SAS program codes (commands and comments),
should be saved frequently ; xxx.sas.
I Log window:
contain errors, warnings, notes of how SAS interpret your
codes, check it every time you run a program; xxx.log.
I Output window:
results; xxx.lst.
I Explorer and Results Windows:
easy to use as data/file management tools, navigation tool.
5
From: a recent hospital consulting project
6
Clinical care pathways are essentially protocols that are used to manage
the quality in healthcare concerning the standardization of care processes.
Implementation of care pathway promotes organized and efficient patient care.
Jimin Ding, Math WUSTL Math 3200 Spring 2017 27 / 67
Summary Statistics for Single Numerical Variable
I Range
Pn
I Variance s2 = i=1 (xi − x̄)2 /(n − 1) (Standard Deviation s)
I IQR: Interquartile Q3 − Q1
Quantile: extension from median
Q1 (x̃0 .25): first quantile , median of the lower half
Q3 (x̃0 .75): third quantile ,median of the upper half
x̃p , p ∈ [0, 1]): In general, the 100pth quantile is the value
which has a fraction of p of the data less than or equal to it
and has a fraction of 1 − p of the data great than it.
Five number summary: min, Q1 , Q2 (= x̃), Q3 , max
Note that all above summary statistics are sensitive to location and
scale change, which might be less appealing. Here are some other
statistics which are insensitive to location and/or scale changes.
I Coefficient of Variation (CV): CV = s/x̄ a relative measure of
dispersion, insensitive to scale change
I Centered data: subtract sample mean from all observations
I Scaled data: divide sample standard deviation from all
observations
I Standardized data (z-scores): centered and then scaled
observations zi = (xi − x̄)/s
I Order statistics: rank of observation
Sample skewness and kurtosis
R example: on Labor Data
A B C
a. A<B<C
b. C<B<A
c. B<C<A
d. C<A<B
e. B<A<C
Jimin Ding, Math WUSTL Math 3200 Spring 2017 34 / 67
Boxplot
a. 0 b. -0.7 c. 0.7 d. 2 e. -1
Jimin Ding, Math WUSTL Math 3200 Spring 2017 42 / 67
Extension to Nonlinear and Multiple Regression
n
X
min [yi − (a + bxi )]2
a,b
i
I cov
I cor
I lm
I table, prop.table, margin.table
I CrossTable{gmodels}
• What happens if we put our hand in the bowl and pulled a ball out
randomly? Can we guess which color we are most likely to get?
• What happens if we put our hand in the bowl and pulled a ball out
without looking? Can we guess the color?
𝑷 𝑨 =𝒀
Read as: the probability of event A is Y
Notation!
• Probability of getting a heads on one coin flip is 1/2
𝑷 𝑯𝒆𝒂𝒅𝒔 = 𝟎. 𝟓
• Probability of rolling a 2 for a six-sided die is 1/6
S
A These events do not overlap, so
there is no outcome common to
both.
B
Multiple Events
• We could have multiple events of interest, say A and B
• There are two parts worth describing
• The part that “overlaps” or “intersects”
• The parts that do not overlap
Outcomes that are in both
events!
Now they do overlap! There
are outcomes common to both!
S
A
B
Event Operations: Intersection
• What if we really only care about the events common to both?
• C = outcomes in BOTH A and B
• That is, I want to the overlap of A and B
𝑪=𝑨 ∩𝑩
Read: A “intersect” B
B
Mutually Exclusive Events
• In some cases there won’t be any overlap between the sets
• In this case 𝑪 = 𝑨 ∩ 𝑩 = ∅, the empty set!
• Mutually exclusive events: two events whose intersection equals the
empty set (no outcomes common to both)
• Fact: Every event is made up of a union of mutually exclusive events
(just union all the elementary events!)
S Mutually exclusive events cannot happen
A at the same time.
Example: A and 𝑨𝒄 are mutually exclusive!
B
Event Operations: Union
• We can define new events using multiple events!
• C = the event that has all the outcomes contained in A and B
• That is, I want to join (union) the outcomes in A and B
P(A)= P(B)=
𝑷 𝑨𝒄 = 𝑷 𝑩𝒄 =
𝑷(𝑨 ∪ 𝑩) = 𝑷(𝑨 ∩ 𝑩) =
Rolling A Die Twice
• Record side on first and second roll:
(Side 1, Side 2)
• What’s the sample space?
𝑷 𝑩 =
B
A 𝑷 𝑨∩𝑩 =
0.04 0.30
0.13 𝑷 𝑨∩𝑩∩𝑪 =
0.03 𝑷 (𝑨 ∪ 𝑩 ∪ 𝑪)𝒄 =
0.02 0.04
0.07 C 0.37
Conditional Probability and Independence
• In some cases, being told that event A occurred implies that the
probability of event B changes
Conditional probability
• Conditional probability: the relative frequency we can expect an
event to occur under the condition that additional, preexisting
information is known about some other event
• Denoted 𝑷 𝑨 𝑩) 1) Probability of A given B
2) Probability of A, knowing B
3) Probability of A happening,
knowing B has already occurred
Major
Gender Int. Bus Geo Socio H. Develop PU Affairs Finance Row Freq 𝑷 𝑮𝒆𝒐 𝑴𝒂𝒍𝒆) =
Male 0.10 0.28 0.18 0.18 0.06 0.20 1.0
Female 0.20 0.20 0.20 0.16 0.08 0.16 1.0
𝑷 𝑰𝒏𝒕 𝑩𝒖𝒔 𝑭𝒆𝒎𝒂𝒍𝒆) =
Col Freq 0.12 0.26 0.18 0.18 0.06 0.19 1.0
Conditional probability
• If we know that B happened, we know that all outcomes outside of
B could not happen
• This means that events comprised only of these outside outcomes
now have zero probability!
A can still occur given B occurred
A
B All outcomes in B become the new
sample space!
Conditional probability
• We “standardize” the probability of A with the probability of B
A
B
Example
• Say we pulled a ball out and didn’t put it back in. This will change
the probability if we pull out another ball!
𝟓
𝑷 𝑶𝟐 | 𝑶𝟏 = = 𝟎. 𝟑𝟏𝟐𝟓 < 𝟎. 𝟑𝟕𝟓
𝟏𝟔
Shorthand for “Orange ball, 2nd pull”
Example
• Say we pulled a ball out and didn’t put it back in. This will change
the probability if we pull out another ball!
𝑷 𝑴𝟐 | 𝑶𝟏 =
𝑷 𝑶𝟐 | 𝑴𝟏 =
𝑷 𝑮𝟐 | 𝑮𝟏 =
Independent events
𝑃(𝐴 ∩ 𝐵) = 𝑃 𝐴 𝑃(𝐵)
Example
• A good free-throw percentage is 90%
• Assume the probability of making a free-throw on one
shot is 0.90
• Event = make two shots in a row
Fotosearch.com
• Let’s assume the second shot is independent of the first
𝐴 = 𝑀𝑎𝑘𝑒 1𝑠𝑡 𝐵 = 𝑀𝑎𝑘𝑒 2𝑛𝑑 First Second Probability
Miss Make P(Miss 1st)P(Make 2nd)=0.10*0.90 =0.09
Miss Miss P(Miss 1st)P(Miss 2nd)=0.10*0.10 =0.01
This is the event we want Make Make P(Make 1st)P(Make 2nd)=0.90*0.90=0.81
Make Miss P(Make 1st)P(Miss 2nd)=0.90*0.10 =0.09
Example
• A good free-throw percentage is 90%
• Assume the probability of making a free-throw on one
shot is 0.90
• Event = make two shots in a row
Fotosearch.com
• Let’s assume the second shot is independent of the first
𝐴 = 𝑀𝑎𝑘𝑒 1𝑠𝑡 𝐵 = 𝑀𝑎𝑘𝑒 2𝑛𝑑 First Second Probability
Miss Make P(Miss 1st)P(Make 2nd)=0.10*0.90 =0.09
Miss Miss P(Miss 1st)P(Miss 2nd)=0.10*0.10 =0.01
Make Make P(Make 1st)P(Make 2nd)=0.90*0.90=0.81
These two outcomes make up A
Make Miss P(Make 1st)P(Miss 2nd)=0.90*0.10 =0.09
Example
• A good free-throw percentage is 90%
• Assume the probability of making a free-throw on one
shot is 0.90
• Event = make two shots in a row
Fotosearch.com
• Let’s assume the second shot is independent of the first
𝐴 = 𝑀𝑎𝑘𝑒 1𝑠𝑡 𝐵 = 𝑀𝑎𝑘𝑒 2𝑛𝑑 First Second Probability
Miss Make P(Miss 1st)P(Make 2nd)=0.10*0.90 =0.09
These outcomes make up B Miss Miss P(Miss 1st)P(Miss 2nd)=0.10*0.10 =0.01
Make Make P(Make 1st)P(Make 2nd)=0.90*0.90=0.81
Make Miss P(Make 1st)P(Miss 2nd)=0.90*0.10 =0.09
Example
• A good free-throw percentage is 90%
• Assume the probability of making a free-throw on one
shot is 0.90
• Event = make two shots in a row
Fotosearch.com
• Let’s assume the second shot is independent of the first
𝐴 = 𝑀𝑎𝑘𝑒 1𝑠𝑡 𝐵 = 𝑀𝑎𝑘𝑒 2𝑛𝑑 First Second Probability
Miss Make P(Miss 1st)P(Make 2nd)=0.10*0.90 =0.09
𝑬𝒗𝒆𝒏𝒕 = 𝑨 ∩ 𝑩 Miss Miss P(Miss 1st)P(Miss 2nd)=0.10*0.10 =0.01
Make Make P(Make 1st)P(Make 2nd)=0.90*0.90=0.81
Why do I care about this? Make Miss P(Make 1st)P(Miss 2nd)=0.90*0.10 =0.09
Example
• A good free-throw percentage is 90%
• Assume the probability of making a free-throw on one
shot is 0.90
• Event = make two shots in a row
Fotosearch.com
• Let’s assume the second shot is independent of the first
𝐴 = 𝑀𝑎𝑘𝑒 1𝑠𝑡 𝐵 = 𝑀𝑎𝑘𝑒 2𝑛𝑑 First Second Probability
Miss Make P()P(B) =0.10*0.90 =0.09
Because A and B are independent!
Miss Miss P()P()=0.10*0.10 =0.01
𝑃 𝐴 = 𝑃 𝐵 = 0.90 Make Make P(A)P(B) =0.90*0.90 =0.81
𝑃 𝐴𝑐 = 𝑃 𝐵𝑐 = 0.10 Make Miss P(A)P() =0.90*0.10 =0.09
Mutually Exclusive vs Independence
• It’s easy to confuse mutually exclusive with independent, but these
are very different concepts
• Say we have two mutually exclusive events A and B, each with
positive probability
S
𝑨∩𝑩=∅ 𝑷(𝑨 ∩ 𝑩) = 𝟎
A
To be independent P(𝐴|𝐵) = 𝑃(𝐴)
B
𝑃(𝐴 ∩ 𝐵) = 𝑃 𝐴 𝑃(𝐵)
• This was because 𝑷 𝑨 = 𝑷(𝑨|𝑩), in general this isn’t true!
𝑃(𝐴 ∩ 𝐵)
𝑃 𝐴𝐵 = 𝑃(𝐴 ∩ 𝐵) = 𝑃 𝐴|𝐵 𝑃(𝐵)
𝑃(𝐵)
Multiplication Rule
• There are two ways to write this
𝑃 𝐴 ∩ 𝐵 = 𝑃 𝐴|𝐵 𝑃(𝐵)
𝑃 𝐴 ∩ 𝐵 = 𝑃 𝐵|𝐴 𝑃(𝐴)
• Called the multiplication rule
• This gives us a useful way to calculate probabilities of
intersections….assuming we know the conditional probability
Example
• You pull out two balls in a row (not putting them back in)
𝑷 𝑨 ∪ 𝑩 = 𝑷 𝑨 + 𝑷(𝑩)
• Here we don’t need to figure out C, we just add the probabilities!
• What happens if they aren’t mutually exclusive?
𝑷 𝑨 ∪𝑩 =
A
𝑷 𝑨 =
B
𝑷 𝑩 =
Addition Rule
• If we just add P(A) and P(B) we get too much area!
𝑷 𝑨 +𝑷 𝑩 = +
𝑷 𝑨 ∪ 𝑩 = 𝑷 𝑨 + 𝑷 𝑩 −𝑷(𝑨 ∩ 𝑩)
B 𝑷 𝑨 =
A
0.04 0.30 𝑷 𝑩 =
0.13
0.03 𝑷 𝑨∩𝑩 =
0.02 0.04
0.37 𝑷 𝑨∪𝑩 =
0.07 C
Complement Rule
• Recall: any event and its complement account for all outcomes in S
𝑺 = 𝑨 ∪ 𝑨𝒄
• What do we know about these events and their probabilities?
𝑷(𝑺) = 𝟏 𝑷 𝑨 ∪ 𝑨𝒄 = 𝑷 𝑨 + 𝑷(𝑨𝒄 )
• Since these two events are equivalent, their probabilities must be
equal! 𝒄 𝒄
𝑷 𝑺 =𝑷 𝑨∪𝑨 𝟏 = 𝑷 𝑨 + 𝑷(𝑨 )
Complement Rule
• Doing simple algebra, we get the probability of the complement
𝑷 𝑨𝒄 = 𝟏 − 𝑷(𝑨)
• This is called the complement rule
• If we know the probability of an event we can easily find out the
probability of its complement
• If we know the probability of the complement of an event, we can
find out the probability of the event.
Most useful if an event is “large” but
the complement event is “small”
Examples
• There are around 60 students in this class. What’s the probability
that two or more people have the same birthday?
• Ignore leap year, so 365 possible birthdays
• Total # of different combinations of 60 birthdays?
Birthdayexpress.com
⋯⋯⋯
60th power!
365 365 365 365 365 365
𝟑𝟔𝟓𝟔𝟎
Examples
• How can we possibly count every single combination where at least
two people had the same birthday!?
• Idea: Let’s count the complement instead!
• Complement Event: No two people have the same
birthday
Birthdayexpress.com
⋯⋯⋯
365 364 363 362 361 360
365*364*…*(365-60+1)
Examples
• Divide these two quantities and subtract from 1
𝟑𝟔𝟓∗𝟑𝟔𝟒∗⋯∗ 𝟑𝟔𝟓−𝟔𝟎+𝟏
𝑷 𝑨 =𝟏− = 0.994
𝟑𝟔𝟓𝟔𝟎
• What about a group of 23 people?
𝟑𝟔𝟓∗𝟑𝟔𝟒∗⋯∗ 𝟑𝟔𝟓−𝟐𝟑+𝟏
𝑷 𝑨 =𝟏− = … >0.5
𝟑𝟔𝟓𝟐𝟑
birthday!
• The complement rule allowed us to make this problem a lot easier!
Let’s Make A Deal (by Monte Hall 1960~70)
• There are three doors, two have a goat behind them, one has a new
car!
dreamstime.com
Clker.com
Let’s Make A Deal (by Monte Hall 1960~70)
• You choose a door and the game show host (who knows what’s
behind the doors) opens one of the other doors with a goat behind it
dreamstime.com
Clker.com
𝟐
𝑷 𝑪𝒂𝒓 𝑮𝒐𝒂𝒕 𝑺𝒉𝒐𝒘𝒏, 𝑪𝒉𝒂𝒏𝒈𝒆 𝑨𝒏𝒔𝒘𝒆𝒓) =
𝟑
The information, which seemed useless, doubles your chances of getting the car!
Bayes’ Rule
• Use to calculate the “reverse” probability
𝑃(𝐴 ∩ 𝐵) 𝑃 𝐵 𝐴 𝑃(𝐴)
𝑃 𝐴𝐵 = =
𝑃(𝐵) 𝑃 𝐵 𝐴 𝑃 𝐴 + 𝑃 𝐵 𝐴𝑐 𝑃(𝐴𝑐 )
• Tree diagrams/Venn Diagrams
Summary
• Probability of an event: the relative frequency with which that event
can be expected to occur
• Understand the relationship between sample spaces and events
• Event operations may be used to combine multiple events
• Know the three axioms of probability
• The size of the sample space determines how we assign probabilities
• Conditional probabilities “reduce the sample space”
• Mutually exclusive versus Independence
• Multiplication, Addition, and Complement rules make calculating
probabilities easier
• Bayes’ Rule can be used to calculate the “reverse” probability
Random Variables and Distributions
F (x) := P (X ≤ x), x ∈ R.
dF (x)
f (x) := , x ∈ R.
dx
P R
I Replacing by , the properties of cdf and pdf still hold.
I We will talk more about pdf for continuous r.v. later.