11. Basic probability_Revised

Download Report

Transcript 11. Basic probability_Revised

พื ้นฐานความน่าจะเป็ น
Basic Probability
Goals
วัตถุประสงค์ การเรี ยนรู้ :
 นิยามความน่าจะเป็ นและอธิบายหลักการเบื ้องต้ นได้
 ใช้ contingency tables ในการวิเคราะห์ได้
 เข้ าใจและสามารถประยุกต์ใช้ กฏเบื ้องต้ นของความน่าจะเป็ นได้
 คานวณความน่าจะเป็ นแบบมีเงื่อนไขได้
 เข้ าใจเหตุการณ์ ที่เป็ นอิสระและไม่เป็ นอิสระต่อกัน
 เข้ าใจและประยุกต์ใช้ กฏของเบย์ (Bayes’ Theorem) สาหรับความ
น่าจะเป็ นแบบมีเงื่อนไข
Sample Spaces and Events
การทดลองแบบสุ่ม (Random Experiments)
Sample Spaces and Events
การทดลองแบบสุ่ม (Random Experiments)
Definition
ระบบหรื อการทดลองใด ๆ ที่ผลลัพธ์จากการดาเนินการแต่ละครัง้ มีความ
แตกต่างกัน ทัง้ ๆ ที่ดาเนินการหรื อทาการทดลองซ ้าลักษณะเดิม
Sample Spaces and Events
Sample Spaces
Definition
Sample Space
ตัวอย่าง
การโยนลูกเต๋า 1 ลูก 1 ครัง้ จะมีผลลัพธ์ที่เป็ นไปได้ ทงหมด
ั้
6 แบบ
การเลือกไพ่ 1 ใบ จากไพ่ 1 สารับ มีผลลัพธ์ ท่เี ป็ นไปได้ 52 แบบไ
Sample Spaces and Events
ตัวอย่างการนิยาม Sample Space
กระบวนการฉีดขึน้ รูปพลาสติก ต้ องมีการควบคุมความหนาของชิ้นงานทีฉ่ ีดขึน้ รู ป
พบว่ าความของงานแต่ ละชิ้นไม่ เท่ ากันขึน้ อยู่กบั ปัจจัยต่ าง ๆ เช่ นวิธีการทางาน เครื่องจักร
โมล และความละเอียดของเครื่องมือวัด ขนาดความหนาของชิ้นงานทีเ่ ป็ นไปได้ ท้งั หมด
สามารถนิยามได้ ดงั นี้
Example (continued)
Example (continued)
Example (continued)
Sample Spaces
Tree Diagrams
 Sample spaces สามารถแสดงได้ ด้วย tree diagrams.



เมื่อsample space สามารถวิเคราะห์แยกเป็ นขัน้ ๆ ได้ ถ้ าแทนจานวนทางเลือกของ
ผลลัพธ์ที่เป็ นไปได้ ในขันที
้ ่ 1 ด้ วย n1 จะแทนแต่ละทางเลือกได้ ด้วย กิ่งของต้ นไม้ n1 กิ่ง
ถ้ าแทนจานวนทางเลือกของผลลัพธ์ที่เป็ นไปได้ ในขันที
้ ่ 2 ด้ วย n2 จะแทนแต่ละทางเลือกได้ ด้วย
กิ่งของต้ นไม้ n2 กิ่ง
…………………….
Sample Spaces
Example 2 การส่ งข้ อความผ่ านระบบ 3 ข้ อความต่ อเนื่อง คุณลักษณะที่สนใจคือแต่ ละข้ อความมาถึง Late
และ On time จะได้
Events

Simple event



Complement ของเหตุการณ์ A (แทนด้ วย A’)



เหตุการณ์จาก Sample Space ที่มีเพียงคุณลักษณะเดียว
เช่น ไพ่ red card จากไพ่ 1 สารับ
ผลลัพธ์ทงหมดที
ั้
่ไม่อยู่ในเหตุการณ์ A
เช่น ไพ่ทงหมดที
ั้
่ไม่ใช่หน้ า diamonds
เหตุการณ์ร่วม (Joint event)

เหตุการณ์ใด ๆ ที่ต้องอธิบายด้ วยคุณลักษณะ 2 อย่างพร้ อม ๆ กัน

เช่น ไพ่ ace ที่เป็ นสี แดง จากไพ่สารับหนึง่
Visualizing Events

Contingency Tables
Ace

Not Ace
Black
2
24
26
Red
2
24
26
Total
4
48
52
Tree Diagrams
2
Sample
Space
Full Deck
of 52 Cards
Total
24
2
24
Sample
Space
Mutually Exclusive Events

Mutually exclusive events

เหตุการณ์ที่จะไม่เกิดร่วมกัน
example:
A = ไพ่ Queen สีแดง; B = ไพ่ Queen สีดา

Events A และ B เป็ นเหตุการณ์ mutually exclusive
Collectively Exhaustive Events

เหตุการณ์รวม


เหตุการณ์ใด ๆ จะต้ องเกิดขึ ้น
เชตของเหตุการณ์ทงหมดจะครอบคลุ
ั้
ม Sample Space
example: จากเหตุการณ์ต่อไปนี ้
A = Ace
B = สีดา
C = ข้ าวหลามตัด D = โพธิ์แดง


Events A, B, C และ D เป็ นเหตุการณ์ที่ collectively
exhaustive (แต่ไม่ mutually exclusive)
Events B, C และ D เป็ นเหตุการณ์ที่ collectively
exhaustive
Sample Spaces and Events
Basic Set Operations
Sample Spaces and Events
Venn Diagrams
Sample Spaces and Events
Definition
Probability


การประเมินเป็ นตัวเลขเกี่ยวกับโอกาสการเกิดขึ ้นของ
เหตุการณ์ที่สนใจใด ๆ
1
Certain
มีคา่ ระหว่าง 0 ถึง 1
0 ≤ P(A) ≤ 1 For any event A

ผลรวมของเหตุการณ์ mutually exclusive
และ collectively exhaustive ทังหมด
้
เท่ากับ 1
.5
P(A)  P(B)  P(C)  1
เมื่อ A, B, and C และ mutually exclusive และ
collectively exhaustive
0
Impossible
Assessing Probability

Approaches to assessing the probability of un uncertain
event:
1. a priori classical probability
probabilit
y of occurrence
X
numberof ways the event can occur

T
total numberof elementaryoutcomes
2. empirical classical probability
probability of occurrence
number of favorable outcomes observed
total number of outcomes observed
2-2 Interpretations of Probability
Definition
The notations may varies depend on the types of books
Interpretations of Probability
Example 3
Interpretations of Probability
คุณสมบัตขิ องความน่ าจะเป็ น
Addition Rules
Addition Rule:กฏการบวก
Mutually Exclusive Events
Addition Rules
Three or More Events
Addition Rules
Venn diagram of four mutually exclusive events
Addition Rules
Computing Probabilities

The probability of a joint event, A and B:
number of outcomes satisfyingA and B
P( A and B) 
total number of elementary outcomes

Computing a marginal (or simple) probability:
P(A)  P(A and B1)  P(A and B2 )    P(A and Bk )

Where B1, B2, …, Bk are k mutually exclusive and collectively
exhaustive events
Joint Probability Example
P(Red and Ace)

number of cards that are red and ace
2

total number of cards
52
Type
Color
Red
Black
Total
Ace
2
2
4
Non-Ace
24
24
48
Total
26
26
52
Marginal Probability Example
P(Ace)
 P( Ace and Re d)  P( Ace and Black ) 
Type
2
2
4


52 52 52
Color
Red
Black
Total
Ace
2
2
4
Non-Ace
24
24
48
Total
26
26
52
Joint Probabilities Using
Contingency Table
Event
B1
Event
B2
Total
A1
P(A1 and B1) P(A1 and B2)
A2
P(A2 and B1) P(A2 and B2) P(A2)
Total
P(B1)
Joint Probabilities
P(B2)
P(A1)
1
Marginal (Simple) Probabilities
General Addition Rule Example
P(Red or Ace) = P(Red) +P(Ace) - P(Red and Ace)
= 26/52 + 4/52 - 2/52 = 28/52
Type
Color
Red
Black
Total
Ace
2
2
4
Non-Ace
24
24
48
Total
26
26
52
Don’t count
the two red
aces twice!
Conditional Probability




สมมติในการผลิตชิ ้นส่วน มีเหตุการณ์ที่สนใจคือ D เหตุการณ์ที่ชิ ้นส่วนบกพร่อง และ F
เหตุการณ์ที่ชิ ้นส่วนมีรอยขูดขีดที่ผิว
ถ้ าวิศวกรสนใจเหตุการณ์ที่ชิ ้นส่วนบกพร่องเนื่องจากมีรอยขูดขีดที่ผิว (E)
จะแทนความน่าจะเป็ นของ E ด้ วย P(D|F) อ่านว่าความน่าจะเป็ นแบบมีเงื่อนไขของ
D given F
และแปรความหมายว่ าความน่ าจะเป็ นทีช่ ิ้นส่ วนจะบกพร่ องเมื อ่ มี รอยขูดขี ดที ผ่ ิ ว
Conditional Probability
Conditional probabilities for parts with surface flaws
Conditional Probability
Definition
Computing Conditional
Probabilities

A conditional probability is the probability of one
event, given that another event has occurred:
P(A and B)
P(A | B) 
P(B)
The conditional
probability of A given
that B has occurred
P(A and B)
P(B | A) 
P(A)
The conditional
probability of B given
that A has occurred
Where P(A and B) = joint probability of A and B
P(A) = marginal probability of A
P(B) = marginal probability of B
Conditional Probability Example


Of the cars on a used car lot, 70% have air
conditioning (AC) and 40% have a CD player
(CD). 20% of the cars have both.
What is the probability that a car has a CD
player, given that it has AC ?
i.e., we want to find P(CD | AC)
Conditional Probability Example
(continued)

Of the cars on a used car lot, 70% have air conditioning
(AC) and 40% have a CD player (CD).
20% of the cars have both.
CD
No CD
Total
AC
.2
.5
.7
No AC
.2
.1
.3
Total
.4
.6
1.0
P(CD and AC) .2
P(CD | AC) 
  .2857
P(AC)
.7
Conditional Probability Example
(continued)

Given AC, we only consider the top row (70% of the cars). Of these,
20% have a CD player. 20% of 70% is about 28.57%.
CD
No CD
Total
AC
.2
.5
.7
No AC
.2
.1
.3
Total
.4
.6
1.0
P(CD and AC) .2
P(CD | AC) 
  .2857
P(AC)
.7
Using Decision Trees
Given AC or
no AC:
.2
.7
.5
.7
All
Cars
.2
.3
.1
.3
P(AC and CD) = .2
P(AC and CD’) = .5
P(AC’ and CD) = .2
P(AC’ and CD’) = .1
Using Decision Trees
Given CD or
no CD:
.2
.4
.2
.4
All
Cars
.5
.6
.1
.6
(continued)
P(CD and AC) = .2
P(CD and AC’) = .2
P(CD’ and AC) = .5
P(CD’ and AC’) = .1
Statistical Independence

Two events are independent if and only
if:
P(A | B)  P(A)

Events A and B are independent when the probability
of one event is not affected by the other event
Multiplication Rules

Multiplication rule for two events A and B:
P(A and B)  P(A | B) P(B)
Note: If A and B are independent, then
and the multiplication rule simplifies to
P(A | B)  P(A)
P(A and B)  P(A)P(B)
Total Probability Rules
Partitioning an event into
two mutually exclusive
subsets.
Partitioning an event into
several mutually exclusive
subsets.
Total (marginal) Probability Rules
Total Probability Rules
Example 4
Total Probability Rules
multiple events
Independence
Definition
Independence
Definition
Example 5
Bayes’ Theorem
P(A | Bi )P(Bi )
P(B i | A) 
P(A | B1 )P(B1 )  P(A | B2 )P(B2 )    P(A | Bk )P(Bk )

where:
Bi = ith event of k mutually exclusive and collectively
exhaustive events
A = new event that might impact P(Bi)
การจัดลาดับ (Permutations)

การจัดลาดับหมายถึง การจัดเรี ยงรายการสมาชิกโดยสนใจลาดับก่อนหลังใน
แซมเปิ ลสเปซของการทดลองสุม่ ใด ๆ มีจานวนวิธีการจัดเรี ยงได้ nPr (อ่านว่า
n-P-r)
nP
r

=
n!
n - r !
เมื่อ r ≤ n
การจัดเรี ยง ของ n สิ่ง ซึง่ มีของไม่แตกต่างกัน n1, n2,…, nk สิง่ มีจานวน
วิธีการจัดเรี ยงได้ ซึง่ คานวณได้ ดงั นี ้
n
Pn1 , n 2 ,...,n k
n!

n1!n 2!...nk !
เมือ
่ ni < n และ n1 + n2 + … + nk = n
การจัดหมวดหมู่ (Combinations)

การจัดหมวดหมู่ หมายถึง การจัดกลุม่ ของสมาชิกในแซมเปิ ลสเปซของการ
ทดลองสุม่ ใด ๆ โดยไม่สนใจถึงลาดับของสมาชิก ดังนันการจั
้
ดหมวดหมู่จะมี
ความแตกต่างเฉพาะสมาชิ
กในแต่ละหมวดหมูเ่ ท่านัน้ มีจานวนวิธีการจัด
C =
หมวดหมู่ nCr (อ่านว่า n-C-r) ซึง่ คานวณได้ ดงั นี ้
n
nC
r
=
r
n!
r!n - r !
เมื่อ r ≤ n