You are on page 1of 16

生物統計學及實習(一)

---- 機率原理

陳怡樺 教授
臺北醫學大學公共衛生學系
聯絡方式:yichen@tmu.edu.tw

隨機實驗
是一種不能確定預知會發
生何種結果的實驗方式
隨機實驗 出象 樣本空間
在實驗前已知所有可能出 產品品質檢驗 良品,不良品 S={良品,不良品}
現的結果,而實驗後的結 一場足球賽 贏,輸,和 S={贏,輸,和}
果為所有可能的結果之一 丟一個骰子 1 次 1,2,3,4,5,6 S={1,2,3,4,5,6}
但實驗前並未能正確肯定 新生小孩的性別 男性,女性 S={男性,女性}
參加研究所考試 錄取,未錄取 S={錄取,未錄取}
的預知它是何種結果
隨機實驗可重複進行,經
過長期重複實驗,出現的
結果會遵循某些統計規則
2

1
實驗、事件與樣本空間

實驗 (experiment) 指一組含有各種不同的結果
(outcomes) 的過程
在一次實驗中所(可能)出現的全部結果稱為樣本空間
(Sample Space) ,以符號 S 來代表,其中每一個結果稱
為事件 (Event),以符號 Ei 或 Xi 代表
簡單事件 (Simple Event,只包含一個基本出象者)
複合事件 (compound Event,包含二個或二個以上出象者)
一個樣本空間所包含事件個數可以是有限或無限的
3

Venn Diagram范氏圖

Experiment: 擲骰子的試驗

event事件
3
1 {1, 6}
樣品點 2
6 4
5
S
集合的呈列
S: {1, 2, 3, 4, 5, 6} Sample space樣品空間
4

2
Random Experiments

Sample Space
• For a single roll of a die, the sample space
is: S = {1, 2, 3, 4, 5, 6}
• When two dice are rolled, the sample
space is the following pairs:
S = {(1,1), (1,2), (1,3), (1,4), (1,5), (1,6),
(2,1), (2,2), (2,3), (2,4), (2,5), (2,6),
(3,1), (3,2), (3,3), (3,4), (3,5), (3,6),
(4,1), (4,2), (4,3), (4,4), (4,5), (4,6),
(5,1), (5,2), (5,3), (5,4), (5,5), (5,6),
(6,1), (6,2), (6,3), (6,4), (6,5), (6,6)} 5
5A-5

排列(permutation)
排列(permutation)
自一含有n個元素的集合中,一次抽取r個元素,則
共有Pnr 個不同排列的樣本點
公式: Pnr=n!/(n-r)!
例:設有三種有效的治療癌症方法,分別為手術治
療(S)、放射治療(R)與化學治療(C),一位病人要接
受兩種治療且順序很重要時,會有多少不同的治療
方式?

3
組合(combination)
組合 (combination)
自一含有n個元素的集合中,一次抽取r個元素,不考慮r
個被抽中元素的順序,共有Cnr 個組合
公式: Cnr=n!/(n-r)!r!
例:假設有三位被蛇咬的病患送給醫師治療,很遺憾只
有兩劑抗蛇毒血清可用。這三位病患分別為孕婦(P),小孩
(C), 和老人(O),在決定對誰作治療前,醫師審視他的選
擇有:

機率
一事件發生機率=相同條件下重複實驗N次時,該事件(A)
可能出現次數之比例
大數法則: 如果一個實驗可以一再重複,從相對次數所得
到事件機率會接近實際的或理論的機率
P(A)=S/N
式中 P(A): 讀作probability of A,即A出現的機率
N:總實驗次數
S:在N次實驗中,出現事件A的次數
均勻機率模式 (Uniform Probability Model)
經驗---稱為經驗機率(Empirical Probability)
理論---稱為事先機率 (Classical (Priority)
Probability)
主觀判定---稱為主觀機率(Subjective Probability)8

4
Probability

What is Probability?
Three approaches to probability:
Approach Example
Empirical There is a 2 percent chance
of twins in a randomly-
chosen birth.

Classical There is a 50 % probability


of heads on a coin flip.

Subjective There is a 75 % chance that England will


adopt the Euro currency by 2010.

9
5A-9

Total heads
Number of tosses = 出現人頭的機率
1.00

0.75

0.50

0.25

0.00
0 50 100 150 200

Cumulative coin tosses (累積投擲次數)

The Law of Large Numbers (LLN) says that the long-run relative
frequency of repeated independent events gets closer and closer to
10
a single value.

5
機率的特性

機率=某事件出現次數所佔的比例(即相對
次數)
在N次實驗中,出現第i事件的機率以P(Ei)
表示,P(Ei)有以下特性
(1) 0 ≦ P(Ei)≦ 1,對所有的i
(2) ΣP(Ei)=1,對所有的i
(3) P(A) + P( A )=1
11

機率的定理(1)
加法定理 (addition theorem)
(1) 當A、B兩事件互斥(mutually exclusive,當一事件發
生,另一事件即不可能發生)
P(A ∪ B)[即P(A 或 B)]=P(A) + P(B)
(2) 當A、B兩事件非互斥(表示事件A與事件B有交集)
P(A ∪ B)=P(A) + P(B) - P(A∩B) [即P(A 與 B)]
例題:某班學生50人,其中20歲的學生有35人,女性學生
有30人,而女性學生中20歲的有21人,則某班學生年齡為
20歲或是女性的機率有多少?

12

6
Venn Diagram范氏圖
互斥事件(exclusive events)

Experiment: 擲骰子的試驗

B A
1

S
P ( A) + P ( B ) = 1 / 6 + 1 / 6 = 1 / 3
13

Venn Diagram范氏圖
非互斥事件

A B

S S
P(A∪B)=P(A)+P(B)-P(A∩B)
A∩B A∪B

S S
14

7
機率的定理(2)
乘法定理(multiplication theorem)
(1) 當事件A與事件B獨立時(independent,事
件A發生與事件B無關)
P(A ∩ B)=P(A) * P(B)
(2)當事件A與事件B相依時(dependent,事件A
發生與事件有關)
P(A ∩ B)=P(A) * P(B|A)
例題:設同時擲硬幣及骰子,其出現正面(H)及3
點之機率為多少?

15

條件機率

P(B|A)又稱為條件機率(conditional probability,
表示已知A事件發生,再發生B事件的機率)
(1)P(B|A)=P(A∩B)/P(A) (若P(A)>0)
(2)若P(B|A)=P(B),表示兩事件獨立

16

8
(1)P(B|A)=P(A∩B)/P(A) (若P(A)>0)
Example 1:設今調查產婦年齡與出生嬰兒體重之
現象時,得如右表: 嬰兒重量 和
B(大於 3500 克) B(小於 3500 克)
•求(1)產婦大於30歲, 產
出生嬰兒體重超過3500 婦 A 大於 30 歲 80 20 100:NA

克之機率 齡 A小於30 歲 90 10 100 : N A
•(2)產婦小於30歲,出
生嬰兒體重超過3500克 170 30 200:

之機率

17

Example 2: High School Dropouts

• Of the population aged 16 – 21 and not in


college:
Unemployed 13.5%
High school dropouts 29.05%

Unemployed high school dropouts 5.32%

• What is the conditional probability that a


member of this population is unemployed,
given that the person is a high school
dropout?
18
5A-18

9
(2)若P(B|A)=P(B),表示兩事件獨立

獨立 (Independence) 與條件機率
Independence of two events means that the outcome of
one event does not influence the probability of the other.
With our new notation for conditional probabilities, we
can now formalize this definition:
Events A and B are independent whenever P(B|A) =
P(B). (Equivalently, events A and B are independent
whenever P(A|B) = P(A).)

P(B | A) = P(A  B) = P(A)P(B) = P(B)


P(A) P(A)
19

Example: Television Ads


• Out of a target audience of 2,000,000, ad A
reaches 500,000 viewers, B reaches 300,000
viewers and both ads reach 100,000 viewers.
(1) What is P(A | B)?
(2) Are events A and B independent?

20
5A-20

10
Marginal Probability
A probability in which the numerator of the probability is a
marginal total from a table
Define more generally
Given some variable that can be broken down into m
categories designated by A1, A2,…, Ai,… Am and another
jointly occurring variable that is broken down into n
categories designated by B1, B2,…, Bj,… Bn
the marginal probability of Ai, P(Ai), is equal to the sum of
the joint probability of Ai with all the categories of B.
P(Ai)=ΣP( Ai ∩ Bj), for all values of j
Example: P(A)=P(A∩B1)+ P(A∩B2)+ P(A∩B3)+ P(A∩B4)
21
if four categories in B

貝氏定理
貝氏定理 (Bayes Theorem)
When we reverse the probability from the
conditional probability that you’re originally given,
you are actually using Bayes’s Rule
已知 P(A|B)=P(A∩B)/P(B)
即P(A∩B)= P(A|B)*P(B)
P(B|A)=P(A∩B)/P(A)= P(A|B)*P(B)/P(A)
P (A | B )P (B )
P (B | A ) =
( )( )
P (A | B )P (B ) + P A | BC P BC
22

11
貝氏定理的應用 I
篩檢工具的效度
敏感度 (sensitivity)
定義:可以正確判斷罹患疾病人的能力,也就是
在真正罹患疾病的人當中,有多少人可以被此測
驗或工具正確的診斷出罹患該疾病

特異度 (specificity)
定義:可以正確判斷未罹患疾病人的能力,也就
是在真正未罹患疾病的人當中,有多少人可以被
此測驗或工具正確的診斷出的確未罹患該疾病
23

貝氏定理的應用 II
陽性預測值 (positive predictive value)
定義:在檢驗結果為陽性情形下,正確的判斷罹患
疾病的能力,也就是在陽性檢驗結果下,有多少比
例的人真的罹患該疾病

(四) 陰性預測值 (negative predictive value)


定義:在檢驗結果為陰性情形下,正確的判斷未罹
患疾病的能力,也就是在陰性檢驗結果下,有多少
比例的人真的未罹患該疾病

24

12
Sample of n subjects cross-classified according to disease
status and screening test results

Disease
Test Result Present (D) Absent (D) Total
Positive (T) a (真陽性) b (僞陽性) a+b
Negative (T) c (僞陰性) d (真陰性) c+d
Total a+c b+d n

25

Example

請應用貝氏定理求得陽性預測值 (P(D|T)?

13
期望值(expected value)

某實驗可能發生n種結果: x1, x2, ….,xn, 而發生的機率


分別為p1, p2, …,pn, 則此實驗的期望值 E(X)為:
E(X)=Σpixi
此期望值相當於不確定情況下平均數的意思
將獲得定義為「+」,失去定義為「-」 則期望值計算結
果不外乎以下三種:
E>0 --> 表示平均的結果為獲得(贏)
E=0 --> 表示平均的結果無得無失(公平)
E<0 --> 表示平均的結果為損失(輸)
27

Example
男性10人其身高155公分者2人、165公分5
人、175公分3人,若任抽1人,其身高的期
望值為多少?

28

14
Odds I

Odds of an Event
• The odds in favor of event A occurring is

P( A) P( A)
Odds = =
P( A ') 1 − P( A)

• The odds against event A occurring is

P( A) 1 − P( A)
Odds = =
P( A) P( A)
29
5A-29

Odds II

Odds of an Event
• Odds are used in sports and games of
chance.
• For a pair of fair dice, P(7) = 6/36 (or 1/6).
What are the odds in favor of rolling a 7?

P(rolling seven) 1/ 6 1/ 6 1
Odds = = = =
1 − P(rolling seven) 1 − 1/ 6 5/ 6 5

30
5A-30

15
Odds III

Odds of an Event
• On the average, for every time a 7 is rolled,
there will be 5 times that it is not rolled.
• In other words, the odds are 1 to 5 in favor of
rolling a 7.
• The odds are 5 to 1 against rolling a 7.
• In horse racing and other sports, odds are
usually quoted against winning.

31
5A-31

Odds IV

Odds of an Event
• If the odds against event A are quoted as b
to a, then the implied probability of event A
is: a
P(A) =
a+b
• For example, if a race horse has a 4 to 1
odds against winning, the P(win) is
a 1 1
P(win) = = = = 0.20 or 20%
a + b 4 +1 5
32
5A-32

16

You might also like