古典機率概念 - The classical probability concept
如果存在 n個同樣可能的可能性, 其中一個必須發生並且 s被認為是有利的 (favorable), 或者被視為 "成功", 那麼這個 "成功" 的機率是(s / n) .
此定義是由 Laplace (法國人, 1749~1827) 所提出的, 也稱為古典機率定義法.
Example: What is the probability of drawing an ace from a well-shuffled deck of 52 playing cards?
Solution:
s 4 1 ___ = ____ = ____ n 52 13
機率的頻率解釋 - The frequency interpretation of probability
The probability of an event (happening or outcome) is the proportion of the time that events of the same kind will occur in the long run.
Example: If records show that 504 of 813 automatic dishwashers sold by a large retailer required repairs within the warranty year, what is the probability that an automatic dishwasher sold by the retailer will not require repairs within the warranty year?
Solution:
Since 813 - 504 = 309 of the dishwashers did not require repairs, we estimate the probability as (309 / 813) = 0.38.
大數法則 - The law of large numbers
如果一個情況, 試驗或實驗一再地重複, 成功的比例將趨近於這個個情況, 試驗或實驗的期望值 (任何一次成功的機率) .
根據這個經驗法則 (大數法則) , 我們知道, 樣本數量越多, 則其算術平均值就有越高的機率接近於其數學期望值.
我們來實驗擲 100 次正面與反面機率各為 0.5 的硬幣, 正面標記為 1, 反面標記為 0; 結果如下:
1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 1 0
我們有興趣的是正面, 這實驗擲 100 次正面的次數占全部實驗的次數之比率為 0.48 (上圖, 藍色折線). 假如實驗的次數夠大最後實驗的結果, 這比率會趨近於 0.5.
樣本空間和事件 - Sample spaces and events
樣本空間: 隨機試驗中所有可能發生的結果所組成之集合稱為樣本空間, 通常以 S 表示. 樣本點: 樣本空間中的每一個相異元素稱為樣本點, 樣本點的個數以 n(S) 表示. 事件: 樣本空間之每一個子集合均稱為事件, 事件的元素個數以 n(A) 表示. 若樣本空間 S的樣本點個數 n(S) = n, 則 S 中所有的事件數為 2n 個.
Example: Venn diagrams are often used to verify relationships among sets, subsets, or events, without requiring formal proofs base upon the algebra of sets. We simply check whether the expressions which are supposed to be equal are represented by the same region of a Veen diagram. Use Veen diagrams to show that
Solution:
(a). A ∩ (B U C) = (A ∩ B) U (A ∩ C)
(b). A U B = (A ∩ B) U (A ∩ B') U (A' ∩ B)
(c). (A ∩ B)' = A' U B'
機率之公設 - The postulates of probability
1. 機率是正實數或是零. P(A)> = 0. 對於任意事件 A.
2. 樣本空間的機率是 1. P(S) = 1. 對於任意樣本空間 S.
3. 如果 A和 B是樣本空間 S中的任何意個事件, 那麼 P(A U B) = P(A) + P(B) - P(A ∩ B)
4. 如果 A, B和 C是樣本空間 S中的任意三個事件, 那麼 P(A U B U C) = P(A) + P(B) + P(C) - P(A ∩ B) - P(B ∩ C) - P(C ∩ A) + P(A ∩ B ∩ C)
5. 如果兩個事件是互斥事件, 那麼其中一個事件或另一個事件發生的機率等於這兩個事件 發生機率概率的總和. P(A U B) = P(A) + P(B)
6. P(Ø) = 0
7. P(A) ≦ 1 對於任意事件 A.
8. P(A) + P(A') = 1 對於任意事件 A.
9. 假如 A 與 B 是一個樣本空間 S中的兩個事件, 且 A ⊂ B, 那麼 P(A) ≦ P(B)
Example: 設 A, B, C 表三事件, 且 P(A)=P(B)=P(C)=1/4, P(A ∩ B) = P(C ∩ A)=0, P(B ∩ C)=1/8, 求三事件至少發生一件的機率?
Solution:
三事件至少發生一件的機率 = 1 - P(A U B U C) = 1 - P(A) - P(B) - P(C) + P(A ∩ B) + P(B ∩ C) + P(C ∩ A) - P(A ∩ B ∩ C) = 1 - 1/4 - 1/4 - 1/4 + 0 + 1/8 + 0 - 0 = 3/8
Example: 從 8個奇數與 5個偶數中任取兩數相加, 請問恰為偶數的機率是多少?
Solution:
E: 奇數 E1~8 O: 偶數 O1~5 樣本空間 = {(E,O), (E,E), (O, O)} 8 5 = 8 * 5 + C + C 2 2 = 40 + 28 + 10 = 78 {(E,O)} 為奇數, {(E,O)} 為偶數, {(E,O)} 為偶數 28 + 10 19 恰為偶數的機率 P = _________ = ____ 78 39
Example: 擲 3 粒公正骰子,
(1). 問恰有兩個點數相同的機率為何?
(2). 問至少兩個點數相同的機率為何?
Solution:
(1). 3 6 5 C * C * C 2 1 1 5 機率 = _______________ = _____ 6 * 6 * 6 12
(2). 3 6 6 C * C * C 2 1 1 1 機率 = _______________ = ___ 6 * 6 * 6 2
機率與優勝率 - Probabilities and odds
已知機率求優勝率
已知一個事件發生的機率是 p, 該事件成功與失敗的比率是 a 比 b, a 與 b 都是正數, 則 優勝率 (a / b) 是 a p ___ = _______ b 1 - p
已知優勝率求機率
已知一個事件會發生的優勝率是 a 比 b, 則這個事件會發生的機率是 a p = _______ a + b
加法法則 - Addition rules
假如有 k 個互斥 (mutually exclusive) 事件, 在它們之中發生的機率等於它們個別發生 的機率之和 P(A1 U A2 U ... U Ak) = P(A1) + P(A2) + ... P(Ak) 對於任意互斥事件 Ak, A2, ... , Ak.
Example: A person is looking for a new car. If the probabilities that he will buy a Toyota, a Ford, or a Honda are 0.17, 0.22, and 0.08, what is the probability that he will buy one of the three?
Solution:
0.17 + 0.22 + 0.08 = 0.47
Example: The probabilities that a consumer testing service will rate a new washing machine very poor, poor, fair, good, very good, or excellent are 0.06, 0.13, 0.17, 0.32, 0.22, and 0.10. What are the probabilities that it will rate the new washing machine
(a). very poor, poor, fair or good;
(b). good, very good, or excellent?
Solution:
(a). 0.06 + 0.13 + 0.17 + 0.32 = 0.68; (b). 0.32 + 0.22 + 0.10 = 0.64.
假如 A 是一個離散樣本空間 S中的一個事件, 則 P(A) 將等於該樣本空間中所有符合 A 條件 之個別機率的總和. If A is an event in a discrete sample space S, then P(A) equals the sum of the probabilities of the individual outcoms comprising A.
Example: If we twice flip a balanced coin, what is the probability of getting at least one head?
Solution:
The sample space is S = {HH, HT, TH, TT}, whether H and t denote head and tail. Since we assume that the coin is balanced, these outcoms are equally likely and we assign to each sample point the probability (1/4) . Letting A denote the event that we will get at least one head, we get A={HH,HT,TH} and 1 1 1 3 P(A) = P(HH) + P(HT) + P(TH) = ___ + ___ + ___ = ___ 4 4 4 4
條件機率 - Conditional probability
定義:
假設 P(B) 不為 0, 則 A 相對於 B的條件機率是 P(A ∩ B) P(A | B) = __________ P(B)
我們用 P(A | B) 這個符號來表示在 B條件下 A的機率,
簡稱 P of A given B
"在 某特定的條件下" 為何是使用 "given" 這個單字呢? 原來 given 含有 "特定的", "已知的" 這樣的涵義. 千萬不要用 specific, particular 這些單字, 因為老外不會那樣講. 這個單字口語使用機率其實是蠻高的, 由其是在數學這個領域. 有些英文單字 native speaker 天天在講, 但是非 native speaker 卻不常使用, "given" 這個單字恰恰是屬於這一類. 它可以是分詞也可以是形容詞, 有興趣不妨以分詞和形容詞各造一個句子.
我們來看一下什麼是條件機率? 它的意義為何? 條件機率它描述在已知 A 條件下, 某事件 B 的發生概率, 符號是 P(B | A) . 對照一下上圖, 我們來看一下 P(A) 是什麼? P(B) 是什麼?
P(A) = A / S
P(B) = B / S
那 P(B | A) 又是什麼? 因為是 已知 A 條件下, 所以樣本空間變了, 樣本空間由原來的 S 變為 A. 事件 B 由原來的 B 變為 (A ∩ B) . 因此
(A ∩ B) P(A ∩ B) P(B | A) = __________ = __________ A P(A) A 不為空集合; 即 P(A) ≠ 0 . 假如 P(A) = 0, P(B | A) 是無意義的 (undefined) .
同理
P(A ∩ B) P(A | B) = __________ P(B) B 不為空集合; 即 P(B) ≠ 0 . 假如 P(B) = 0, P(A | B) 是無意義的.
Example: Suppose that a consumer research organization has studied the service under warranty provided by 200 tire dealers in a large city, and that their findings are summarized in the following table:
What is the probability that a dealer will provide good service under warranty given that he is not a name-brand dealer?
Solution:
N: name-brand G: good service P(N) = 80 / 200 = 0.40 P(G) = 106 / 200 = 0.53 and P(N ∩ G) = 64 / 200 = 0.32 P(G ∩ N') = 42 / 200 = 0.21 and P(N') = 120 / 200 = 0.60 P(G ∩ N') thus P(G | N') = ___________ = 0.35 P(N')
Example:
某高中高一新生健康檢查的結果, 體重超重者佔 40%, 有心臟疾病者佔 10%, 兩者都有的佔 8%, 今任選一人檢驗,
(1). 若已知此人的體重超重, 則他有心臟疾病的機率為多少?
(2). 若已知此人有心臟疾病, 則他的體重超重的機率為多少?
Solution:
W: 體重超重者 H: 有心臟疾病者 1 (1). P(H | W) = P(H ∩ W) / P(W) = 8% / 40% = ___ 5 4 (2). P(W | H) = P(H ∩ W) / P(H) = 8% / 10% = ___ 5
Example:
假設根據統計,汽車駕駛人中有 0.005 是酒醉駕車, 又酒醉駕車且肇事者占駕駛人的 0.003,求駕駛人在酒醉的情況下肇事的機率為何?
D: 酒醉駕車 A: 肇事 3 P(A | D) = P(A ∩ D) / P(D) = 0.003 / 0.005 = ___ 5
通常, 事件A在事件B已發生的條件下發生的概率, 與事件B在事件A已發生的條件下發生的概率是不一樣的. 然而, 這兩者是有確定的關系的, 後面我們要討論的貝氏定理就是這種關系的描述.
乘法法則 - Multiplication rules
關於條件機率, 我們經常喜歡以乘法的形式表示:
P(A ∩ B) P(A | B) = __________ ...... (0) P(B) => P(A ∩ B) = P(B) * P(A | B) ...... (1)
同理
P(A ∩ B) = P(A) * P(B | A) ...... (2)
引申
設A1, A2, ..., Ak為 k個事件, 若P(A1 ∩ A2 ∩ ... ∩ Ak-1) > 0, 則 P(A1 ∩ A2 ∩ ... ∩ Ak) = P(A1) * P(A2 | A1) * P(A3 | (A1 ∩ A2)) * ... * P(Ak | (A1 ∩ A2 ∩ ... ∩ Ak-1))
這 (0), (1), (2) 式一定要非常非常熟.
Example: A jury consists of nine persons who are native born and three persons who are foreign born. If two of the jurors are randomly picked for an interview, what is the probability that thay will both be foreign born?
Solution:
The probability of event A that the first juror picked will be foreign born 3 is P(A) = ____ . 12 If B is the event that the second juror picked is foreign born, the probability that the second juror picked will be foreign born given that the first one 2 picked is foreign born is P(B | A) = ____ . 11 The probability of getting two jurors who are both foreign born is 3 2 1 P(A ∩ B) = P(A) * P(B | A) = ____ * ____ = ____ 12 11 22
Example: 一袋中有 5個白球, 8個黑球. 從袋中連續取出 3個, 取出不放回, 求
(1). 依序取出白球, 黑球, 白球的機率.
(2). 第一次取出為黑球的機率.
(3). 第二次取出黑球的機率.
Solution:
(1). P(W,B,W) 5 8 4 40 = ____ * ____ * ____ = _____ 13 12 11 429
(2). P(B,X,X) = 8/13
(3). B1': 第一次取出為白球 B1 : 第一次取出為黑球 B2 : 第二次取出為黑球 X : don't care P(B,B,X) = P(B1 ∩ B2) = P(B1) * P(B2 | B1) = 8/13 * 7/12 P(W,B,X) = P(B1' ∩ B2) = P(B1') * P(B2 | B1') = 5/13 * 8/12 P(B2) = P(B,B,X) + P(W,B,X) = P(B1 ∩ B2) + P(B1' ∩ B2) = P(B1) * P(B2 | B1) + P(B1') * P(B2 | B1') = 8/13 * 7/12 + 5/13 * 8/12 = 8/13
獨立事件 - Independent events
在一隨機試驗,A事件發生與否往往影響 B事件發生的機率, 這就是前面討論到的條件機率. 但是也有可能 A事件的發生並不影響 B事件發生的機率; 像這種情況我們把它稱為獨立事件. 換句話說, 就是下面的數學式:
P(B | A) = P(B) A事件的發生並不影響 B事件發生的機率
由條件機率的定義得到
P(B | A) = P(A ∩ B) / P(A) = P(B) => P(A ∩ B) = P(A) * P(B)
因此
已知 A, B 互為獨立事件, 則 P(A ∩ B) = P(A) * P(B)
已知 P(A ∩ B) = P(A) * P(B) , 則 A, B 互為獨立事件
Example: What is the probability of getting two heads in two flips of a balanced coin?
Solution:
Since the probability of head is (1/2) for each flip of the coin and the two flips are independent, 1 1 1 the probability is ___ * ___ = ___ 2 2 4
貝氏定理 - Bayes' theorem
由上述乘法法則 (1) , (2) 式, 我們得到
P(A) * P(B | A) = P(B) * P(A | B)
因此
P(B) * P(A | B) P(B | A) = _________________ P(A) 等式兩邊同時除以 P(A)
上式的意義是什麼呢?
已知 P(A | B) , 求 P(B | A) ?
換句話說, 已知 B 條件下 A 的機率, 求 A 條件下 B 的機率.
Example: In a state where cars have to be tested for emission of pollutions, 25 percent of all cars emit excessive amounts of pollutants. When tested, 99 percent of all cars that emit excessive amounts of pollutants will fail, but 17 percent of the cars that do not emit excessive amounts of pollutants will also fail. What is the probability that a car which fails the test actually emit excessive amounts of pollutants?
Solution:
Letting A denote the event that a car fails the test and B the event that it emits excessive amounts of pollutants, we can translate the given percentages into probabilities write P(B) = 0.25, P(A | B) = 0.99, and P(A | B') = 0.17. Before we can calculate P(B | A) by means of the formula given above, we will first have to determine P(A), and to this end let us look at the tree diagram shown above. Here A is reached either along the branch which passes through B or along the branch which passes through B', and the probabilities of this happening are 0.25 * 0.99 = 0.2475 and 0.75 * 0.17 = 0.1275 Since the alternatives represented by the two branches are mutually exclusive, we find that P(A) = 0.2475 + 0.1275 = 0.3750, and substitution into the formula for P(B | A) yields P(B) * P(A | B) 0.25 * 0.99 P(B | A) = ________________ = ______________ = 0.66 P(A) 0.3750 This is the probability that a car which fails the test actually emits excessive amounts of pollutants.
從搭公車問題來理解貝氏定理
去學校上課, 有 B1, B2, B3 可以搭, 如上圖, P(B1) = 0.5, P(B2) = 0.3, P(B3) = 0.2 A 代表遲到的事件. 圓形面積分為 3塊, 分別代表 搭上 B1公車遲到, 搭上 B2公車遲到, 以及搭上 B3公車遲到. P(A) 表遲到的機率 3 P(A) = P(A ∩ B1) + P(A ∩ B2) + P(A ∩ B3) = ∑ P(A ∩ Bi) i=1 = P(A | B1) * P(B1) + P(A | B2) * P(B2) + P(A | B3) * P(B3) 3 = ∑ ( P(A | Bi) * P(Bi) ) i=1
已知搭 B1公車遲到的機率 求 在已經遲到的狀況下搭乘 B1公車的機率? 已知 P(A | B1) 求 P(B1 | A) P(B1 ∩ A) P(B1 | A) = ____________ P(A) P(A | B1) * P(B1) = ___________________________ k ∑ ( P(A | Bi) * P(Bi) ) i=1
Bayes' theorem
貝氏定理的內容是這樣的:
假如 B1, B2, ..., Bk 是互斥事件, 這些互斥事件組成樣本空間 S, 並且對於 i=1,2,...,k 來說, P(Bk) ≠ 0, 則 對於任意事件 A ⊂ S 並且 P(A) ≠ 0, Bi相對於 A的機率 P(Bi | A) 有下列的關係: P(Bi) * P(A | Bi) P(Bi | A) = ___________________________ k ∑ ( P(Bi) * P(A | Bi) ) i=1
k k P(A) = ∑ P(A ∩ Bi) = ∑ ( P(Bi) * P(A | Bi) ) i=1 i=1
Example: In a cannery, assembly lines I, II, III account for 50, 30, and 20 percent of the total output. If 0.4 percent of the cans from assembly line I are improperly sealed, and the corresponding percentages for assembly lines II and III are 0.6 and 1.2 percent, what is the probably that
(a). a can produced by this cannery will be improperly sealed;
(b) an improperly sealed can (discovered at the final inspection of outgoing products) will have come from assembly line I?
Solution:
(a). Letting A denote the event that a can is improperly sealed, and B1, B2, and B3 denote the events that a can comes from assembly lines I, II, or III, we can translate the given percentages into probablities and write P(B1) = 0.50, P(B2) = 0.30, P(B3) = 0.20, P(A|B1) = 0.004, P(A|B2) = 0.006 , and P(A|B3) = 0.012. Thus, the probabilities associated with the three branches of the tree diagram above are 0.50*0.004 = 0.0020, 0.30 * 0.006 = 0.0018, and 0.20 * 0.012 = 0.0024, and the rule of elimination yields P(A) = 0.0020 + 0.0018 + 0.0024 = 0.0062
(b). Substituting this result together with the probability associated with the first branch of the tree diagram into formula for Bayes's theorem, we get 0.0020 P(B1 | A) = ________ = 0.32 0.0062 rounded to two decimals.
Example: 某零件可由 3 條不同的生產線甲, 乙, 丙生產,每條生產線所生產的零件各佔產品比例: 20%, 50% 與 30%,而根據經驗,每條生產線所生產的零件是瑕疵品的比例分別為 4%, 2% 與 3%, 那麼我們可以計算已知由甲生產, 而產品為瑕疵品的比例; 也可以反問若抽樣的零件為瑕疵品, 則由甲生產線生產的機率多大?
Solution:
B1: 生產線甲 B2: 生產線乙 B3: 生產線丙 A: 瑕疵品 P(B1) = 0.2 P(B2) = 0.5 P(B3) = 1 - 0.2 - 0.5 = 0.3 P(A | B1) = 0.04 P(A | B2) = 0.02 P(A | B3) = 0.03 P(A) = 0.2 * 0.04 + 0.5 * 0.02 + 0.3 * 0.03 = 0.027 0.2 * 0.04 P(B1 | A) = ______________________________________ 0.2 * 0.04 + 0.5 * 0.02 + 0.3 * 0.03 = 8/27
利用貝氏定理, 當我們碰到的現象, 背後變因有很多時, 經由分析各項變因的事前機率 (Prior probability) 和蒐集的新資訊, 可以幫助我們反推測哪個才最可能是主要的原因, 釐清前後關聯, 進而做出正確的判斷和決策. 今日,它被廣泛應用在許多領域中, 例如: 流行病學, 藥品檢驗, 品質管理等.
離散型隨機變數之期望值 - Mathematical expetation for a discrete random variable
在現實生活中, 我們免不了要遇到一些有關機率的問題, 例如: 丟一骰子大約會出現多少點? 買一張彩券大約會中多少錢? 首先來看下面的 Example.
Example: 擲一枚公平的六面骰子, 求每次擲這枚骰子 "點數" 的期望值?
Solution:
期望值我們以 E 來表示.
不過如上所說明的, 3.5雖是這個試驗 "點數" 的期望值, 但卻不屬於可能結果中的任一個, 沒有可能擲出此點數.
一個離散性隨機變數的期望值 (或數學期望) 是這個隨機變數試驗中每次可能的結果乘以其結果機率 的總和.
以數學符號表示如下:
If the probabilities of obtaining the amounts A1 , A2 ,..., or Ak are P1, P2, ..., and Pk, where P1 + p2 + ... + Pk = 1, then the mathematical expectation is E = A1 * P1 + A2 * P2 + ... + Ak * Pk k = ∑ (Ai * Pi) i=1
Example: The probabilities are 0.22, 0.36, 0.28, and 0.14 that an investor will be able to sell a piece of property at a profit of $2500, at a profit of $1500, at a profit of $500, or at a loss of $500. What is the investot's expected profit?
Solution:
a1 = 2500, a2 = 1500, a3 = 500, and a4 = -500 p1 = 0.22, p2 = 0.36, p3 = 0.28, and p4 = 0.14 E = 2500 * 0.22 + 1500 * 0.36 + 500 * 0.28 - 500 * 0.14 = $1160
Example: To define a client in a liability suit resulting from a car accident, a lawyer must decide whether to charge a straight fee of $1500 or a contingent fee which she will get only if her client wins. How does she feel about her client's chances if
(a). she prefers the straight fee of $1500 to a contingent fee of $5000;
(b). she prefers a contingent fee of $12000 to the straight fee of $1500?
Solution:
(a). If she feels that the probability is p that her client will win, the laywer associates a mathematical expectation pf (5000 * p) with the contingent fee of $5000. Since she feels that $1500 is preferable to this expection, we can write 1500 > 5000 * p 1500 and, hence, p < ______ = 0.30. 5000
(b). Now the mathematical expectation associated with the contingent fee is (12000 * p) , and since she feels that this is preferable to $1500, we can write 12000 * p > 1500 1500 and, hence, p > _______ = 0.125. 12000
Example: A furniture manufacturer must decide whether to expand his plant capacity now or wait at least another year. His advisors tell him that if he expands now and economic conditions remain good, there will be a profit of $328000 during the next fiscal year; if he expands now and there is a recession, there will be a loss of $80000; if he waits at least another year and economic remain good, there will be a profit of $160000; and if he waits at least another year and there is a recession, there will be a small profit of $16000. If the furniture manufacturer feels that the probabilities for economic conditions remaining good or there being a recession are (1/3) and (2/3), will expanding his plant capacity now maximize his expected profit?
Solution:
As can be seen from this table, it will be advantageous to expand the plant capacity right away only if economic contitions remain good, and the furniture manufacturer's decision will, therefore, have to depend on the chances that this will be the case. Using the manufacturer's probabilities of 1/3 and 2/3 for economic conditions remain good or there being a recession, we find that the expected profit is 328000*(1/3) + (-80000) * (2/3) = $56000 if he expands his plant capacity right away, and 160000*(1/3) + (160000) * (2/3) = $64000 if the expansion is delayed. Since the second of these figures exceeds the first, it follows that delaying the expansion maximizes the furniture manufacturer's expected profit.
Email: jasonc@mail2000.com.tw . 請尊重原創, 使用圖文時載明出處. 謝謝.
-
(Finished)
留言列表