• 沒有找到結果。

機率

N/A
N/A
Protected

Academic year: 2022

Share "機率"

Copied!
80
0
0

加載中.... (立即查看全文)

全文

(1)

機率 & 統計

A Comprehensive Tutorial to Probability & Statistics

盧政良 (Arthur)

(2)

預備知識

微積分

線性代數

(3)

關於微積分

• ⾄少掌握微分、積分的概念。

還債的機會

台⼤數學系朱樺老師:

http:!//www.math.ntu.edu.tw/~hchu/Calculus/

⾃⾏閱讀Chapter 1,2,3,5。

變化量 累積量

(4)

關於線性代數

• ⾄少掌握向量、內積、聯立⽅程組、

反矩陣的概念。

還債的機會

3Blue1Brown:

https:!//www.youtube.com/playlist?

list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab

(5)

不確定性

⽤機率的語⾔去描述不確定性

(6)

沒有完整的資訊

原因?成本太⾼,甚⾄根本不可⾏。

(7)

無法預知未來

尤其是⾦融市場!!!

(8)

擲⼀次硬幣

公正的硬幣:正⾯與反⾯出現的機率相同

(9)

均勻分配

Uniform Distribution

https:!//en.wikipedia.org/wiki/Discrete_uniform_distribution

https:!//en.wikipedia.org/wiki/Uniform_distribution_(continuous)

(10)

擲很多次硬幣

(11)

⼆項式分配

Binomial Distribution

https:!//en.wikipedia.org/wiki/Binomial_distribution

(12)

擲了無窮多次硬幣

(13)

常態分配

Normal Distribution

⼜稱⾼斯分配 (Gauss Distribution)

https:!//en.wikipedia.org/wiki/Normal_distribution

(14)

Z ∼ N(0, 1)

Z是⼀個隨機變數,遵守⼀個標準常態分配。

平均數

變異數

(15)

Z′ = 1 + 2 × Z ∼ N(1, 4)

shift

scaling

(16)

敘述統計

中⼼

算術平均值、幾何平均數、調和平均數、中位數、眾數

分散程度

變異數、標準差、四分位差、百分位數、最⼤值、最⼩值

(17)

https://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Standard_deviation_diagram.svg/2880px-Standard_deviation_diagram.svg.png

(18)

機率論

Probability Theory

https:!//en.wikipedia.org/wiki/Probability_axioms

(19)

符號定義

樣本:

樣本空間:

事件:

事件空間:

機率測度:

機率空間:

ω

Ω E

ℱ = 2 Ω

P : ℱ → ℝ (Ω, ℱ, P)

事件空間為樣本空間中所有元素的冪集

ω ∈ Ω

(20)

擲公正硬幣⼀次

考慮⼀個公正硬幣,則

其事件空間 非 且非 , 出現 , 出現 , 出現 或

所對應的機率測度為:

Ω = {

H

,

T

}

ℱ = {

H T H T H T

}

P(A = ϕ) = 0

P(A = H) = P(A = T) = 0.5 P(A = H  or  T) = 1

空集合

(21)

擲公正硬幣兩次

考慮⼀個公正硬幣,則

其事件空間

所對應的機率測度為:

Ω = {

H

,

T

} × {

H

,

T

} ℱ = ?

P(A = (H, H)) = P(A = (T, T)) = 0.25

P(A = (H, ⋅ )) = P(A = (T, ⋅ )) = P(A = ( ⋅ , H)) = P(A = ( ⋅ , T)) = 0.5

樹狀圖?

(22)

來當個賭徒吧

假設出現正⾯獲得⼀元,出現反⾯則損失⼀元。

(23)

隨機變數

Random Variable

(24)

X : ω ∈ Ω → ℝ

(25)

X ∼ 某分配

(26)

每次擲硬幣的報酬是多少?

(27)

每次擲硬幣的期望報酬是多少?

(28)

E[ g(X) ] =

{

Ω g(x)P(x)

Ω g(x) dF(x)

連續版本 隨機變數的函數

離散版本

(29)

E[ X ] = X( H ) × P(X( H )) + X( T ) × P(X( T ))

= 1 × 0.5 + (−1) × 0.5

= 0

(30)

動差

第⼀動差:

第⼆動差:

標準差:

標準化:

第三動差:

第四動差:

μ X = E[ X ]

Var(X) = E [ (X − μ X ) 2 ] σ X = Var(X)

Z = X − μ X σ X

skewness

= E[ Z 3 ]

kurtosis

= E[ Z 4 ]

Moment

https:!//en.wikipedia.org/wiki/Skewness

https:!//en.wikipedia.org/wiki/Kurtosis

https:!//en.wikipedia.org/wiki/Central_moment

https://en.wikipedia.org/wiki/Skewness#/media/

File:Relationship_between_mean_and_median_under_different_skewness.png

z score

偏態 峰態

(31)

抽樣

Sampling

(32)

從⺟體隨機抽取樣本

Population Sample

(33)

https://zh.wikipedia.org/wiki/%E6%8A%BD%E6%A8%A3#/media/File:Simple_random_sampling.PNG

(34)

台灣加權指數歷史收盤價 (未還原)

(35)
(36)

https:!//en.wikipedia.org/wiki/Sortino_ratio https:!//en.wikipedia.org/wiki/Sharpe_ratio

https:!//en.wikipedia.org/wiki/

Compound_annual_growth_rate

https:!//breakingdownfinance.com/

finance-topics/performance- measurement/calmar-ratio/

(37)

是否為常態分佈?

(38)

Hypothesis Testing

檢定

(39)

Normality Test

Shapiro-Wilk test

Anderson-Darling test

Kolmogorov-Smirnov test

Jarque-Bera test

Pearson’s test

χ 2

https:!//en.wikipedia.org/wiki/Shapiro-Wilk_test

https:!//en.wikipedia.org/wiki/Anderson-Darling_test

https:!//en.wikipedia.org/wiki/Kolmogorov-Smirnov_test

https:!//en.wikipedia.org/wiki/Jarque-Bera_test

https:!//en.wikipedia.org/wiki/Pearson-_chi-squared_test

(40)

(´༎yД༎y`)

(41)

虛無假設

Null Hypothesis

(42)

: 是常態分佈

H 0

(43)

對立假設

Alternative Hypothesis

(44)

: 不是常態分佈

H 1

(45)

統計量

Statistic

(46)

顯著性

Statistical Significance

(47)

α

常⾒的設定是 α = 0.05 或者是 α = 0.01

(48)
(49)

型⼀誤差

Type I Error

(50)

p-value

(51)

當p-value < 時,

此統計量有顯著差異,拒絕 !

α H 0

(52)

當p-value >= 時,

此統計量無顯著差異, 無法 α 拒絕 H 0

(53)

也就是說,我找不到⾜夠的證據來 證明 不成立! H 0

⼀開始可能會誤以為,既然沒有拒絕,代表 是對的。

但是這是錯誤的解讀。 H 0

(54)

– Ronald Fisher (1890–1962)

“... is never proved or established, but is possibly disproved, in the course of experimentation. Every

experiment may be said to exist only in order to give the facts a chance of disproving the null

hypothesis.”

(55)

型⼆誤差

Type II Error

https:!//en.wikipedia.org/wiki/Type_III_error

(56)

β

(57)
(58)

Confusion Matrix

(59)

ROC 曲線

https:!//en.wikipedia.org/wiki/Receiver_operating_characteristic

Receiver Operating Characteristic

(60)

https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/ROC_curves.svg/1920px-ROC_curves.svg.png

(61)

型三誤差

Type III Error

https:!//en.wikipedia.org/wiki/Type_III_error

“correctly rejecting the null hypothesis for the wrong reason”

(62)
(63)

Bayes

https:!//en.wikipedia.org/wiki/Bayes'_theorem

(64)

先驗機率

Prior Probability, Belief

(65)

條件機率

Conditional Probability

(66)

P(A | B) = P(A ∩ B) P(B)

在事件B的條件下,發⽣事件A的機率

交集

(67)

⽂⽒圖

https:!//en.wikipedia.org/wiki/Venn_diagram

(68)

https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Venn_diagram_gr_la_ru.svg/1920px-Venn_diagram_gr_la_ru.svg.png

(69)

P(A ∩ B) = P(A | B) P(B)

= P(B | A) P(A)

(70)

https://en.wikipedia.org/wiki/Bayes%27_theorem#A_more_complicated_example

(71)

獨立事件 Independence

(72)

P(A ∩ B) = P(A) P(B)

(73)

很重要,但是很難辦到!

(74)

案例:投籃命中率

(75)

案例:上漲下跌

(76)
(77)

題外話們

(78)

凱利賭徒

https:!//en.wikipedia.org/wiki/Kelly_criterion

(79)

平賭

https:!//en.wikipedia.org/wiki/Martingale_(probability_theory)

Martingale

https:!//rich01.com/blog-pos-22/

(80)

反平賭

參考文獻

相關文件

• Since successive samples are correlated, the Markov chain may have to be run for a considerable time in order to generate samples that are effectively independent samples from p(x).

Only the fractional exponent of a positive definite operator can be defined, so we need to take a minus sign in front of the ordinary Laplacian ∆.. One way to define (− ∆ ) − α 2

In Section 3, the shift and scale argument from [2] is applied to show how each quantitative Landis theorem follows from the corresponding order-of-vanishing estimate.. A number

(6) (a) In addition to the powers of the Permanent Secretary under subsection (1) the Chief Executive in Council may order the Permanent Secretary to refuse to

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

• Actually what Hawking said was, Event Horizon may not exist, the only thing real is the Apparent Horizon. • Apparent horizon can trap matter and lights, but as the BH

This kind of algorithm has also been a powerful tool for solving many other optimization problems, including symmetric cone complementarity problems [15, 16, 20–22], symmetric