30
Random variable

Random variables

Embed Size (px)

DESCRIPTION

intro to Random variables

Citation preview

Page 1: Random variables

Random variable

Page 2: Random variables

Random Variable( 隨機變數 )• 以樣本空間為定義域的實數值函數,也就是隨

機實驗中對應樣本點的實數值函數。

X :擲一枚銅板二次,出現正面的次數

正正正反反正反反

2

1

0

1/4

2/4

1/4

樣本空間 S 隨機變數X

機率 f(x)

nixf

nixfn

ii

i

,2,1,1)(.2

,2,1,1)(0.1

1

b

adxxfbXaP

dxxf

)()(.2

1)(.1

Page 3: Random variables

Two types of random variables

• Discrete (Countable)• Binomial• Poisson• Geometric• Hypergeometric

• Continuous (Uncountable)• Normal• Uniform• Exponential

Page 4: Random variables

Discrete variables

Page 5: Random variables

隨機實驗 隨機變數 隨機變數X可能的值詢問陳先生的月薪 薪資收入 0x觀察醫院病人候診時間 等候時間 0x抽取1家電腦廠的年生產量 產量 0x

抽取1,250ml瓶裝汽水 汽水容量ml 250,10 x

Continuous variables

Page 6: Random variables

Binomial distribution ( 二項分布 )• The experiment consists of n identical trials• There are only two possible outcomes (S,F) on each trial.• The trials are independent.• The binomial random variable x is the number of S in n trials

Page 7: Random variables
Page 8: Random variables

二項分配的機率質量函數

Page 9: Random variables

二項分配的屬性

期望值 npXE )(

變異數 npqXV )(

標準差

npq

Page 10: Random variables

Try it!

• 假設產品的不良率為 0.1, 今檢驗 10 的產品,請問• (1) 恰好有 3 個不良品的機率• (2) 不良品的個數不超過 5 的機率 • (3) 不良品個數介於 2 到 6 的機率。

Page 11: Random variables

Poisson distribution 卜瓦松分配

• The experiment consists of counting the number of times a certain event occurs during a given unit of time or in a given area or volume.• The probability that event occurs in a given unit of time, area, or

volume is the same for all the units.• The number of events that occur in one unit of time,area or volume is

independent of the number that occur in any other unit.• The mean number of events in each unit is denoted by the Greek

letter lambda “ λ”

Page 12: Random variables

Example

• (1) 一片 12 吋晶圓片上的雜點數目。 • (2) 桃園縣一天中發生的車禍次數。 • (3) 中午 12:00 到 13:00 到便利商店買餐的人數。

Page 13: Random variables

卜瓦松分配機率質量函數

Page 14: Random variables

Example •假定成大學生每年發生機車事故人數平均是 2.4人,請問一年內成大學生有人發生機車事故的機率是多少 ?

091.01

!0

4.21)0(1

)4.2(~04.2

e

XP

PoiX

Page 15: Random variables

把 x = 4 與= 6 代入卜瓦松分配的公式,得到

Page 16: Random variables

Try it!

• 一公司之電話通數大約每小時 18 通 , 求• 在 5 分鐘內一通電話也沒有的機率? • 10 分鐘內接到 2 通以上的機率 ?

Page 17: Random variables

Geometric distribution 幾何分配 • 重複執行相同白努利試驗直到成功的事件發生才停止試驗,此試驗稱

為幾何隨機實驗。 http://sites.stat.psu.edu/~babu/418dist/binom.html

• 例如擲一個銅板直到出現正面為止。我們令隨機變數 X 代表實驗的次數,為幾何隨機變數,其機率質量函數為

Page 18: Random variables

Hypergeometric Distribution ( 超幾何分配 )

• 超幾何實驗:• 從一含有 N 物的有限母體中,採不放回抽樣,抽取 n 個隨

機樣本。• N 物中有 S 個屬成功類,另 N-S 個屬失敗類。

• 隨機變數 X 為 n 個中,成功的次數, X 的機率分配稱為超幾何機率分配。

成功類 S 個

失敗類 N-S 個

x n-x

Page 19: Random variables

超幾何機率質量函數

Nn

SNxn

Sx

C

CCxf

)(

npN

SnXE )( npq

N

nNXV

1)(

Page 20: Random variables

20

二項分配與超幾何分配比較

二項分配 超幾何分配

抽出後 放回 不放回

每次實驗成功的機率

相同 不相同

每次實驗 獨立 不獨立

Page 21: Random variables

Normal Distribution ( 常態分配 )

• 又稱高斯分配( Gauss Distribution )。• 重要性:• 1. 許多自然現象,工業生產、商業問題及社會現象均可用常態分配加

以描述。• 2. 許多統計量的的抽樣分配在大樣本下呈常態分配。• 3. 常態分配可進行許多統計推論,許多統計量的的抽樣分配如 t 分配、

卡方分配、 F 分配都必須假設母體為常態分配才可獲得。• 4. 間斷機率分配在某些條件下可利用常態分配求其近似值。

Page 22: Random variables

常態分配機率密度函數

xexf

x

,2

1)(

2

2)(

2

1

)(XE2)( XV

),( 11 N ),( 22 N

2121 ,

),( 11 N

),( 22 N

2121 ,

Page 23: Random variables

常態分配特性

2.1 %13.6 %13.6 %2.1 %

34.1 %

平均值

34.1 %

- 3 - 2 - 1 + 1 + 2 + 3

9974.0)33(

9544.0)22(

6826.0)(

XP

XP

XP

Page 24: Random variables

Uniform Distribution( 均等分配 )

• 隨機變數在某區間( a,b )內發生機率皆相同時,其機率分配為Uniform Distribution 。• 機率密度函數:

bxaab

xf

,1

)( 2)(

baXE

12

)()(

2abXV

a b

ab 1

f(x)

Page 25: Random variables

Exponential distribution( 指數分配 )

• The length of time between emergency arrivals at a hospital, the length of time between catastrophic events.• The length of time between occurrences of random events like these

can often be described by the exponential distribution.• For this reason, the exponential distribution is sometimes called the waiting-time distribution.

Page 26: Random variables

Exponential Distribution( 指數分配 )

• 與波瓦松分配相反,指數隨機變數在說明接連兩件事發生的間隔期間。

Poisson隨機變數 指數隨機變數

1. 20分鐘內,平均 5部車子開進停λ車場( =5輛/20分鐘)。

2. 高速公路上每 10公里平均有 5個λ窪洞( =5個/10公里)。

3. 某一機器 30分鐘內平均故障 3次λ( =3輛/30分鐘)。

1. 平均每隔 4分鐘有一部車子開進μ停車場( =4分鐘/輛)。

2. 高速公路上,平均每隔 2公里有 1

μ個窪洞( =2公里/個)。

3. 某一機器平均每隔 10分鐘故障 1

μ次( =10分鐘/次)。

Page 27: Random variables

指數分配機率密度函數0,)( xexf

1

)(XE

λ

x

xexf )(

Page 28: Random variables

Example某一型彩色電視機其壽命時間成指數分配,且平均壽命為 10 年。求該電視機的壽命時間之下列機率:

1. 壽命長達 15 年以上。2. 兩年內即發生故障而報廢。

0,10

1)(),10(~ 10

xexfExpXx

X 表示該電視機之壽命時間,

15

0

10 22.010

11)15(1)15()1( dxeXPXP x

18.010

1)2()2(

2

0

10 dxeXP x

0,,)( xexf x

1

)(XE

Page 29: Random variables

Try it!

• 假設在念書時,每小時平均會被智慧型手機影響而有 5 次分心,假設受到干擾的次數是按卜瓦松分布。• 1. 請說明兩次分心間隔時間的機率分配• 2. 請問 15 分鐘內都沒有因為手機分心的機率• 3. 下一次分心會在 10 分鐘內的機率

Page 30: Random variables

The End