機率分配與常態分配

Download Report

Transcript 機率分配與常態分配

社會統計
第三講
機率、常態分配與抽樣分配
©Ming-chi Chen
社會統計
Page.1
機率與統計推論
• 某民調機構選前電話訪問1000位合格選民,結果顯
示40%的民眾支持A候選人,60%支持B候選人。
這代表什麼?
• 如果A會贏B的話(母體參數未知),那在樣本中
只有40%的人支持A是不是極不尋常?
• 我們要討論的是如果全體合格選民真的比較支持A
的話,那我們得到這個40/60的樣本機率有多大?
• 推論統計是建立在機率上的
©Ming-chi Chen
社會統計
Page.2
Random Variable隨機變數
定
義
• 如果我們在事前無法正確的預測某變數X的
結果,那X是一個隨機變數。
• 擲一枚銅板1000次,頭像出現的次數。
• 擲骰子100次總共的點數
©Ming-chi Chen
社會統計
Page.3
Random Variable隨機變數
定
義
• 取一個三十個人的隨機樣本並詢問其就業狀況
(失業與就業),樣本中的就業人數為一隨機
變數X。X的可能值為?
• X的值可以是0至30的任意整數,每一個數值χi
都代表此實驗(問三十個人)的一特定結果。
• 一個隨機變數所有可能的數值稱為「變量」,
隨機變數中的每一個變量皆代表一種事件。
• 習慣上以大寫字母X, Y, Z表隨機變數,以小寫
字母x, y, z來代表其相對應的變量。
©Ming-chi Chen
社會統計
Page.4
Random Variable隨機變數
例
題
• 丟銅板三次,樣本空間為:
• Ω={HHH, HHT, HTH, THH, HTT, THT,
TTH, TTT}
• 定義X為丟三次銅板出現反面的次數,
隨機變數X為將上面樣本空間對應到實
數的函數,此隨機變數的變量為:
• S={0, 1, 2, 3}
©Ming-chi Chen
社會統計
Page.5
Discrete Random Variable
間斷型(不連續)隨機變數
定
義
• A random variable X is discrete if X can
assume only a finite or countably infinite
number of different values.
• 一隨機變數之變量若為有限個或無限但可數,
稱為discrete r.v.
• 台北十月份下雨的天數。
• 高速公路一天的死亡人數。
©Ming-chi Chen
社會統計
Page.6
Discrete Random Variable
連續隨機變數
定
義
• A random variable X is continuous if it can assume
all the values in some interval.
• 如果隨機變數在某區間的變量為無限個,則稱為連
續隨機變數。
• 身高。
• 飛機往來北高所需的飛行時間。
• 計程車司機每月行駛的里程數。
• Note: 連續隨機變數無法精確的測量,僅能求近似值。
©Ming-chi Chen
社會統計
Page.7
Discrete Random Variable
間斷隨機變數
定
義
• If X is a discrete random variable, the
probability function (p.f.)機率函數 of X is
defined as the function f such that for each
real number x,
f ( xi )  P( X  xi )
©Ming-chi Chen
社會統計
Page.8
Discrete Probability Distributions
• P(X = xi)代表隨機變數等於某特定變量的機率,如
P( X = 2)銅板出現兩次反面的機率,有時候會簡化
為P(xi) 或f(xi)。
• 將一個間斷隨機函數的所有可能變量xi所相對應的機
率P(X=xi)列出,稱為間斷機率分配(discrete
probability distribution)。
©Ming-chi Chen
社會統計
Page.9
Properties of Discrete Probability
Distributions
• 所有非連續機率分配必須滿足下列兩個條件:
(1) f(xi )  P( X  xi )  0, i  1,2,I
I
(2)
 f (x )  1
i 1
i
• 假設X為一discrete r.v.,且函數P(X)滿足上述條
件,我們說P(X) 為X的p.m.f (probability mass
function)機率質量函數
©Ming-chi Chen
社會統計
Page.10
例題
• 某汽車經銷商營業員負責賣$10,000,
$15,000, $20,000三種價格的車可得5%的佣
金抽成。
• 消費者購買各種車款的機率分別為:
• $10,000  30%
• $15,000  20%
• $20,000  10%
• 不買車  40%
• 某顧客走入店中,以隨機變數X代表此營業員
可能獲得的佣金,列出X的機率分配
(probability distribution)
©Ming-chi Chen
社會統計
Page.11
例題
• x1=$0, x2=$500, x3=$750, x4=$1000
• 樣本空間S={$0, $500, $750, $1000}
• 與其相對應的機率為.4, .3, .2, .1*
The probability distribution of a
random variable is a theoretical
model for the relative frequency
distribution of a population.
©Ming-chi Chen
社會統計
x
$0
$500
$750
$1,000
f(x)
0.4
0.3
0.2
0.1
Page.12
例題
• 擲一個公正的骰子一次,令x為所得的
點數,則x的分配為何?
函數表達:
1 / 6 x  1, 2, 3, 4, 5, 6
f ( x)  
其他
0
©Ming-chi Chen
社會統計
點數 x 機率f(x)
1
1/6
2
1/6
3
1/6
4
1/6
5
1/6
6
1/6
Page.13
例題
• 隨機變數X,其機率函數為:
c(6  x) x  2, - 1, 0,1, 2
f ( x)  
其他
0
求c=?

 f ( x)  1  8c  7c  6c  5c  4c  1
x  
©Ming-chi Chen
社會統計
Page.14
Cumulative Distribution Function
• Let X be a discrete or continuous random
variable and let x be any real number. The
cumulative distribution function (CDF) of X is
the function
F ( xi )  P( X  xi )  P( x1 )  P( x2 )  P( xi )
則稱F(X)為隨機變數X的累加機率
函數
©Ming-chi Chen
社會統計
Page.15
Properties of Cumulative
Distribution Function
• Let X be a discrete r.v. that can assume the
values x1, x2, …xn, where x1<x2<…<xn. Then
F(x) denote the probability that X assumes a
value that is less than or equal to xr, and is
r
given by:
F ( xr )  P( X  xr )   P( X  xi )
i 1
 f ( x1 )  f ( x2 )   f ( xr )
P(a  X  b)  F (b)  F (a )
©Ming-chi Chen
社會統計
Page.16
累加百分比(Cumulative Percentage)
您現在這個工作,每個月月入多少元?
組數
組界
1 1萬元以下
2
1-2萬元
3
2-3萬元
4
3-4萬元
5
4-5萬元
6
5-6萬元
7
6-7萬元
8
7-8萬元
9
8-9萬元
10 9-10萬元
11 10-11萬元
12 19-20萬元
13 20萬元以上
©Ming-chi Chen
Total
組次數 百分比 累積百分比
Frequency Percent Cumulative Percent
88
4.85
4.85
330
18.20
23.06
430
23.72
46.77
341
18.81
65.58
239
13.18
78.76
163
8.99
87.76
71
3.92
91.67
43
2.37
94.04
18
0.99
95.04
25
1.38
96.41
22
1.21
97.63
28
1.54
99.17
15
0.83
100.00
社會統計
1813
100
Page.17
Properties of Cumulative
Distribution Function
For any valuex, 0  F ( x)  1
if x1  x2 thenF ( x1 )  F ( x2 )
lim F ( x )  F ()  1
x 
lim F ( x )  F ( )  0
x 
©Ming-chi Chen
社會統計
Page.18
例題
• 續前例:
• F(500) = .4 + .3 =.7
• F(750) = .4 + .3 +.2 =.9
x
$0
$500
$750
$1,000
©Ming-chi Chen
f(x)
0.4
0.3
0.2
0.1
社會統計
F(x)
0.4
0.7
0.9
1
Page.19
間斷變數的期望值
• The expected value, or mean, of a discrete
random variable is the weighted average of
the possible values of the random variable
where the weight assigned to xi is the
probability P(X=xi)
E ( X )   x   xi P( xi )
Wherethesum is takenoverall possible value of X
©Ming-chi Chen
社會統計
Page.20
例題
• 計算營業人員commission的期望值。
• E(X) =
(0)(.4)+(500)(.3)+(750)(.2)+(1000)(.1) =
$400
x
f(x)
$0
$500
$750
$1,000
©Ming-chi Chen
社會統計
0.4
0.3
0.2
0.1
Page.21
例題
• 一賭徒玩輪盤,輪盤共有38個號碼,其中18個
為「紅」,18個為「黑」,另有兩個號碼為
「綠」,壓$1於「紅」,可贏$1,如果出現
「黑」,則$1全輸,如果出現「綠」,則輸
$.5,求賭徒壓紅的期望值。
x
$1.0
-$0.5
-$1.0
©Ming-chi Chen
社會統計
P(x)
18/38
2/38
18/38
E(X)
xP(x)
0.474
-0.026
-0.474
-0.026
Page.22
Expected value of a function of X
• Let X be a discrete random variable,
and let Y be any function of X such that
Y = g(X). Then the expected value of Y,
or the expected value of g(X), is
E(Y )  E[ g( X )]   g( x)P( x)
©Ming-chi Chen
社會統計
Page.23
例題
• 若上例賭徒壓$100於「紅」,求期望值。
x
$1.0
-$0.5
-$1.0
©Ming-chi Chen
y=g(x)=100x
$100.0
-$50.0
-$100.0
P(x)
18/38
2/38
18/38
E(X)
社會統計
g(x)P(x)
47.37
-2.63
-47.37
-2.63
Page.24
例題
機率函數
隨機函數X的變量
E
{BBB}
{BBG}
{BGB}
{BGG}
{GBB}
{GBG}
{GGB}
{GGG}
P(E)
0.14
0.13
0.13
0.12
0.13
0.12
0.12
0.11
假設生三個小孩各
種情況所相對應的
機率為:
©Ming-chi Chen
x
0
1
2
3
隨機函數X
= 生三個小孩中,
女孩的人數
社會統計
f(x)
0.14
0.39
0.36
0.11
間斷機率分配
Discrete prob.
distribution
Page.25
例題
P(X<2)
P(x)
= F(1)
= P(X ≦ 1)
= .14 +.39 =.53
0.5
0.39
0.4
0.36
0.3
0.2
0.14
0.11
0.1
0
0
©Ming-chi Chen
社會統計
1
2
3
Page.26
例題
E(X)
=  x.f(x)
= (0)(.14) + (1)(.39)
+ (2)(.36) + (3)(.11)
x
0
1
2
3
f(x)
0.14
0.39
0.36
0.11
=1.44
請問1.44代表的意義為?
©Ming-chi Chen
社會統計
Page.27
Properties of Expectations
• Property 1: E(c) = c
•若c為任意常數,求E(c) =?
E(c)  c  P( x)  c P( x)  c 1
©Ming-chi Chen
社會統計
Page.28
Properties of Expectations
• Property 2: if Y=a.X+b, where a and b are
constant, then E(Y) = a.E(X) + b
E (Y )  E (aX  b)
 (ax  b) f ( x)
 E(Y )  E[ g ( X )]   g ( x)P( x)
 (ax  f ( x)  b  f ( x))
 ax  f ( x)  b  f ( x)
 a x  f ( x)  b f ( x)
=1
E(X)
©Ming-chi Chen
社會統計
Page.29
Properties of Expectations
• 例題:若E(X)=5, 求 E(3X-5)=?
• E(3X-5) = 3E(X) – 5 = 15-5 =10
©Ming-chi Chen
社會統計
Page.30
Joint Probability Tables
聯合機率表
複
習
如果兩個變數都屬於間斷型的類別變
數,則可以用聯合機率表來表示其發
生的機率
是否錄取
Marginal
性別
錄取
拒絕 Probability
男
0.304
0.376
0.68
女
0.128
0.192
0.32
Marginal 0.432
0.568
1
Probability
©Ming-chi Chen
社會統計
Page.31
聯合機率函數
複
習
• 設X,Y為二元間斷隨機變數,X之值為
x1,x2,x3,…xn,Y之值為y1,y2,y3…ym,若f(xi, yj)
滿足下列兩條件:
0  f ( xi , y j )  1
n
m
 f ( x , y )  1
i 1 j 1
i
j
• 則f(xi, yj)成為聯合機率函數
©Ming-chi Chen
社會統計
Page.32
邊際機率函數
複
習
• 設X,Y為二元間斷隨機變數,其機率函數為
f(xi,yi),則X, Y的邊際機率函數分別為fx(xi)與
fy(yj)
m
f x ( x)   f ( x, y j )  f ( x, y1 )  f ( x, y2 )  ...  f ( x, ym )
n
j 1
f
0  f x ( xi )  1
i 1
n
x
( xi )  1
f y ( y)   f ( xi , y )  f ( x2 , y)  f ( x3 , y )  ...  f ( xi , y )
i 1
n
f
0  fy ( y j )  1
©Ming-chi Chen
j 1
社會統計
y
(yj) 1
Page.33
X,Y的聯合機率分配表
x1
x2
f(xi,ym)
fx(xi)
…
社會統計
fx(xi)
fx(x1)
fx(x2)
…
f(xn,yj)
fy(yj)
ym
f(x1,ym)
f(x2,ym)
…
f(xi,yj)
…
…
…
…
…
…
…
…
…
©Ming-chi Chen
yj
f(x1,yj)
f(x2,yj)
…
…
f(xn,y1) f(xn,y2)
fy(y1) fy(y2)
…
…
…
…
…
…
…
…
…
…
f(xi,y1) f(xi,y2)
…
…
xn
fy(yj)
…
…
xi
y1
y2
f(x1,y1) f(x1,y2)
f(x2,y1) f(x2,y2)
複
習
f(xn,ym)
fy(ym)
fx(xn)
1.00
Page.34
Properties of Expectations
• property 3: if X1, X2, X3…Xn are n random
variable such that each expectation E(Xi) exists
(i = 1,2, …n), then E(X1+X2…+Xn) = E(X1)
+E(X2) +… E(Xn)
E ( X  Y )   ( xi  y j ) P( xi , y j )
 [ xi P( xi , y j )  y j P( xi , y j )]
j
j
i
i
  xi P( xi , y j )  y j P( xi , y j )
i
j
j
i
  xi P( xi )  y j P( y j )
i
©Ming-chi Chen
 E ( X )  E (Y )
j
社會統計
Page.35
Properties of Expectations
• It follows from property 2 and property3
that for any constant a1, a2, …an and b,
E(a1X1+a2X2…+anXn) = a1E(X1)
+a2E(X2) +… +anE(Xn)
©Ming-chi Chen
社會統計
Page.36
Properties of Expectations
• Property 4:
• If X1, …Xn are n independent variables such
that each expectation E(Xi) exists, then
• E(X1.X2.X3…Xn)=E(X1)E(X2)…E(Xn)
©Ming-chi Chen
社會統計
Page.37
Properties of Expectations
• Proof
• X and Y are independent variables, P(XY)=
P(X)P(Y)
 P( A  B)  P( A) P( B)
E ( XY )   xi y j P( xi , y j )
i
j
  xi P( xi ) y j P( y j )
i
j
 E ( X ) E (Y )
©Ming-chi Chen
社會統計
Page.38
Rules for Means
E(Y )  E[ g( X )]   g( x)P( x)
•Property 1: c is a constant, then E(c) = c
•Property 2: if Y=a.X+b, where a and b are constant, then
E(Y) = a.E(X) + b
•Property 3: if X1, X2, X3…Xn are n random variable such that each expectation
E(Xi) exists (i = 1,2, …n), then
E(X1+X2…+Xn) = E(X1) +E(X2) +… E(Xn)
Property 4: If X1, …Xn are n independent variables such that each
expectation E(Xi) exists, then
E(X1.X2.X3…Xn)=E(X1)E(X2)…E(Xn)
©Ming-chi Chen
社會統計
Page.39
Variance of Discrete Random
Variable
• 非連續隨機變數的變異數
2  ( x1  u)2 P( X  x1 )  ( x2  u)2 P( X  x2 )
   ( xk  u)2 P( X  xk )
E[ g( X )]   g( x)P( x)
k
 2   ( xi  u ) 2 P( xi )
i
let g( x)  ( x  u)
2
E( X )  u
 2  E[(X  u)2 ]  E[(X  E( X ))2 ]  ( x  u)2 P( xi )
©Ming-chi Chen
社會統計
Page.40
Variance of Discrete Random
Variable
  E[( X  u) ]
2
2
E( X  2  X  u  u )
2
2
 E( X )  2u  E( X )  E(u )
2
2
 E( X )  2u  u  u
2
2
 E ( X )  u  E ( X )  [ E ( X )]
2
2
2
  X P( X )  u
2
©Ming-chi Chen
2
2
社會統計
Page.41
Variance of Discrete Random
Variable
x
0
1
2
3
f(x)
0.14
0.39
0.36
0.11
x f(x)
0.00
0.39
0.72
0.33
2
2.07
0.19
0.31
2.43
2
f(x)
0.29
0.08
0.11
0.27
2
=.75
2
x f(x)
0.00
0.39
1.44
0.99
2.82
= 2.82 – (1.44)2
=
©Ming-chi Chen
ΣX2f(x) – u2
社會統計
Page.42
Properties of the variance
• Var(c)=0, c 為常數項
• 更正式的陳述:Var(X)=0 if and only if there
exists a constant c such that P(X=c)=1.
©Ming-chi Chen
社會統計
Page.43
Properties of the variance
•
•
•
•
•
•
•
Property 5:
Var(aX+b)=a2Var(X)
Proof.
因為E(aX+b)=aE(X)+b=au+b
Var(aX+b)=E[((aX+b) – E(aX+b))2]
=E[(aX+b – au –b)2]=E[(aX-au)2]
=a2E[(X-u)2]
©Ming-chi Chen
社會統計
Page.44
Properties of the variance
• Property 6:
• If X1, …Xn are independent random variables,
then Var(X1+…+Xn) = Var(X1)+ …+Var(Xn)
©Ming-chi Chen
社會統計
Page.45
Properties of the variance
•
•
•
•
•
•
•
•
Proof.
以n=2為例,If E(X1) = u1 and E(X2) = u2
E(X1+X2)=u1+u2
Var(X1+X2)=E[(X1+X2-u1-u2)2]
=E[(X1-u1)2+(X2-u2)2+2(X1-u1)(X2-u2)]
=Var(X1) + Var(X2) +2E[(X1-u1)(X2-u2)]
X1, X2 are independent, 根據property 4
E[(X1-u1)(X2-u2)]=E(X1-u1)E(X2-u2)=0
©Ming-chi Chen
社會統計
Page.46
例題
•
•
•
•
•
•
•
•
•
X,Y,Z are independent and
E(X)=1, E(Y)=4, E(Z)=3
Var(X)=3, Var(Y)=7, Var(Z)=2
What is the mean and variance of
U=3X+4Y
E(U)=E(3X+4Y)=3E(X) + 4E(Y)
=3·1+4·4 = 19
Var(U) = Var(3X+4Y) = 9Var(X) + 16Var(Y)
=9*3+16*7 = 139
©Ming-chi Chen
社會統計
Page.47
例題
• 成功機械公司之生產經理欲推計該公司某一長期客戶,訂購
其產品之生產成本。若經由多年之銷售記錄,訂立了該客戶
每月訂購量X之機率分配如下:
• X =1 f(X) = .5
• X =2 f(X) = .3
• X=3 f(X) = .2
• (1) 求隨機變數(訂購量)X的期望值及變異數。
(2)若生產經理認為該產品的生產成本為:固定成本每月
20,000元,每單位之變動成本為40,000。試求該項交易每月
期望總生產成本為?(成大企研)
©Ming-chi Chen
社會統計
Page.48
例題
•
•
•
•
•
E(X)=(x)f(x)=1(.5)+2(.3)+3(.2)=1.7
E(X2)=(x2)f(x)=1(.5)+4(.3)+9(.2)=3.5
Var(X)=E(X2)-[E(X)]2 =3.5-(1.7)2=0.61
令Y= 20000+40000X
E(Y)=20000+40000E(X)=88000
©Ming-chi Chen
社會統計
Page.49
第3.1講
連續變數的機率分配
©Ming-chi Chen
社會統計
Page.50
Properties of Continuous probability
觀
distributions
念
• 嚴格來說,因為測量的侷限,所有的變數皆
為「非連續」discrete。
• 但當某一個變數的變量的數目很多,每一個
變量出現的機率很低時,我們通常把它當作
「連續」變數來處理。
• 例如:收入、所得、學校成績等。
©Ming-chi Chen
社會統計
Page.51
Approximating a continuous
distribution
觀
念
• 取100人的樣本並紀錄其完成工作的時間如下:
時間(秒)
16-20
20-24
24-28
28-32
32-36
36-40
40-44
©Ming-chi Chen
社會統計
次數
5
10
16
21
23
16
10
100
相對次數
0.05
0.1
0.16
0.21
0.23
0.16
0.1
1
Page.52
Approximating a continuous
distribution
觀
念
• 以直方圖來表達:
time
16-20
20-24
24-28
28-32
32-36
36-40
40-44
f
5
10
16
21
23
16
10
f/n
0.05
0.10
0.16
0.21
0.23
0.16
0.10
0.25
0.21
0.20
0.16
0.15
0.10
0.1
0.23
0.16
0.1
0.05
0.05
0.00
16-20 20-24 24-28 28-32 32-36 36-40 40-44
©Ming-chi Chen
社會統計
Page.53
Approximating a continuous
distribution
觀
念
• 將樣本擴大至1,000
time f/n
16
.02
18
.03
20
.04
22
.06
24
.07
26
.09
28
.10
30
.11
32
.12
34
.11
36
.08
38
.07
40
.05
42
.03
44
.02
©Ming-chi
Chen
0.14
0.12
0.10
0.08
0.06
0.04
0.02
0.00
16
18
20
22
社會統計
24
26
28
30
32
34
36
38
40
42
44
Page.54
Approximating a continuous
distribution
觀
念
• 將樣本擴大至10,000
.07
.06
.05
.04
.03
.02
.01
.00
1
2
©Ming-chi Chen
3
4
5
6
7
8
9
10
11
12
13
14
社會統計
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Page.55
Approximating a continuous
distribution
觀
念
• 將樣本擴大至100,000,隨著樣本數的增加,每一個
變量之間的間隔愈小,曲線愈趨於平滑。
• 這個曲線可以被視為是根據母體(試驗重複很多次)
的相對次數分配所畫出來的直方圖。
©Ming-chi Chen
社會統計
Page.56
Density Function
觀
念
• 若某一連續隨機變數X的機率分配可以用數學
函數f(x)及其所對應的平滑的曲線表達,則f(x)
為X的機率密度函數(density function)。
©Ming-chi Chen
社會統計
Page.57
Density Function
定
義
• 設X為一連續r.v.,若函數f(x)滿足下列條件:
(1) f ( x)  0, x  R

(2)  f ( x )dx  1

• 則稱f(x)為機率密度函數。
©Ming-chi Chen
社會統計
Page.58
Density Function
觀
念
• 任何機率分配所有的“相對次數”的和
為?
.07
也就是說,
.06
曲線底下
.05
的面積和
.04
為1
.03
.02
.01
.00
1
2
3
4
5
6
©Ming-chi Chen
7
8
9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
社會統計
Page.59
Density Function
y  f (x)
a
x1 x2
©Ming-chi Chen
x x x b
社會統計
觀
念
界於a與b之間曲
線下的面積如何
計算?
步驟一,先將a至b的
區間切割成n等分:
ba
x 
n
Page.60
Density Function
y  f (x)
f(x1)
觀
念
第一塊長方形區域的
面積為:
f ( x1 )  x
f(x2)
第二塊長方形區域的
面積為:
x1 x2
f ( x2 )  x
x b
x x
長方圖的總面積 f ( x1 )x  f ( x2 )x   f ( x5 )x
a
5
長方圖的總面積  f ( xi )  x
i 1
©Ming-chi Chen
社會統計
Page.61
Density Function
y  f (x)
f(x1)
a
x
x1 x2
b
觀
念
若將a至b之間的區間
做更細的切割,則長
方形的面積和將為愈
來愈趨近於曲線下的
面積。如將上圖的五
等分再細分成十等分。
10
長方圖的總面積  f ( xi )  x
i 1
©Ming-chi Chen
社會統計
Page.62
Density Function
y  f (x)
觀
念
若再進一步細分成n
份,則
n
f(x1)
a x
長方圖的總面積  f ( xi )  x
i 1
b
n個x
當n趨近於無限大時,則
n
長方圖的總面積 lim  f ( xi )  x
n
©Ming-chi Chen
社會統計
i 1
Page.63
Density Function
y  f (x)
x
a
c
定
義
如 果 f 在 [a,b] 的 區
間中為連續,且
c,d介於a與b之間,
則x介於c與d之間
的機率為:
b
d
d
P(c  X  d )   f ( x )d ( x )  lim  f ( xi )  x
d
n
c
©Ming-chi Chen
社會統計
i c
Page.64
Density Function
定
義
在連續隨機函數
y  f (x)
中,任意單獨變
量所相對應的機
率為 0。
P( X  a)  P( X  b)  0
a x
b
因為連續函數的變量x有無
限個不同的值,任一特定變
量a出現的機率等於1/∞
©Ming-chi Chen
社會統計
Page.65
Expected value
y  f (x)
f(x1)=p1
a
x
x1 x2
b
x x
觀
念
一非連續隨機變數
(discrete r.v.)的變量為
x1,x2,…xn , 且 每 個 變
量的相對應的機率為
p1,p2,…pn ,則此隨機
變數的期望值為:
n
  E ( X )  x1 p1  x2 p2   xn pn   xi pi
i 1
©Ming-chi Chen
社會統計
Page.66
Expected value
y  f (x)
f(x1)
a
x
x1 x2
b
x x
觀
念
將非連續隨機函數的
期望值算法推演至連
續隨機變數:
先將a與b之間的區間
分成n等分:
ba
x 
n
n個區間的範圍分別為:
[ x0 , x1 ],[ x1, x2 ],[ x2 , x3 ],[ xn1 , xn ],
©Ming-chi Chen
社會統計
Page.67
Expected value
y  f (x)
P2=f(x2)
P1
x0
x
x1 x2
b
x x
©Ming-chi Chen
p1 為x落在[x0,x1]之間
的 機 率 , p2 為 x 落 在
[x1,x2]區間的機率…
p2 為函數f曲線介於x1
與x2之下的面積
p2  x  f ( x2 )
p1 為函數f曲線介於xo
與x1之下的面積
p1  x  f ( x1 )
觀
念
社會統計
Page.68
Expected value
觀
念
y  f (x)
n
E ( X )   xi pi
P1
i 1
 x1 p1  x2 p2   xn pn
x0 x1 x2
x
P2=f(x2)
 x1  f ( x1 )  x  x2  f ( x2 )x   xn  f ( xn )x
x x
b
n
  xi f ( xi )x
i 1
©Ming-chi Chen
社會統計
Page.69
Expected value
y  f (x)
當n趨於無限大,
x趨近於0時:
n
E ( X )  lim  xi f ( xi )x
x 0
b
©Ming-chi Chen
P1
P2=f(x2)
i 1
  xf ( x)dx
a
定
義
x0 x1 x2
x
a
社會統計
x x
b
Page.70
Variance
非連續變數的變異數:
定
義
y  f (x)
n
Var( X )   ( xi  u ) p1
2
i 1
連續變數的變異數:
P1
n
Var ( x)  lim  ( xi  u ) 2 f ( xi )x
x 0
b
i 1
  ( x  u ) f ( x)dx
2
a
x0 x1 x2
x
a
P2=f(x2)
x x
b
標準差  Var(x)
©Ming-chi Chen
社會統計
Page.71
第3.2講
常態分配/標準常態分配/標準化
©Ming-chi Chen
社會統計
Page.72
Normal Distribution常態分配
• 常態分配的機率密度函數PDF為:
f ( x) 
1
22
e
( x u ) 2 /( 2 2 )
• We say that X is normally
distributed with parameter μ
and σ, denote X~N(μ, σ2)
 x  
  3.14159...
e  2.71828
x  X之特定變量 值
u  mean
 2  variance
©Ming-chi Chen
社會統計
Page.73
定
義
常態分配之重要性質
f ( x) 
1
2
2
e
觀
念
( x u ) 2 /( 2 2 )
X=μ
• The curve is bell shaped and symmetric
about the value X=μ
• The curve extends from -∞ to +∞
©Ming-chi Chen
社會統計
Page.74
常態分配之重要性質
f ( x) 
1
2
2
e
觀
念
( x u ) 2 /( 2 2 )
X=μ
• The total area under the curve is 1. (this is
required for all density function)
• The curve is always above X-axis (f(x) ≧0, for
all x)
• μ=.Md=Mo
©Ming-chi Chen
社會統計
Page.75
常態分配之重要性質
觀
念
不同μ,相同σ
μ1
μ2
μ3
相同μ,不同σ
μ
• μ為位置參數,σ為形狀參數
©Ming-chi Chen
社會統計
Page.76
常態分配之重要性質
觀
念
• μ為位置參數,σ為形狀參數
• 若X~N(μ, σ2),令Y=aX + b,則
Y~ N(aμ+b, a2σ2)
• 若X~N(μ1, σ12) ,Y~N(μ2, σ22),且X與Y
獨立,則Z=X+Y之分配為
Z~N(μ1+μ2, σ12+ σ22)
©Ming-chi Chen
社會統計
Page.77
標準常態分配
Standard normal distribution
觀
念
• A random variable is said to have the standard
normal distribution if it has the normal
distribution with mean μ=0 and σ2=1.
Z~N(0, 1)
0 .3 9 9
f ( x) 
1
2
2
e
( x u ) 2 /( 2 2 )
1  x2 / 2
f ( z) 
e
2
©Ming-chi Chen
0 .4
f( x)
 0
1 .3 3 81
σ=1
0 .2
4
0
4
4
社會統計
3
2
1
0
x
μ=0
1
2
3
4
4
Page.78
標準常態分配曲線下的面積
觀
念
34.1%
34.1%
0.399
0.4
13.6%
f( x)
 4
1.33810
0.2
2.1%
0
4
4
©Ming-chi Chen
3
2
1
0
x
社會統計
1
2
3
4
4
Page.79
標準常態分配曲線下的面積
P(Z<0) =
0.5
0.399
f( x)
 4
1.33810
觀
念
P(Z>0) = 0.5
0.4
0.2
P(Z< -z) =
1-P(Z  z)
0
4
4
3
2
1
0
x
1
2
3
4
4
P(Z< -z) = P(Z > z)
©Ming-chi Chen
社會統計
Page.80
Z介於零與一正數之間
例
題
• 例題:Find P(0≦Z≦0.62)=?
0.399
f( x)
 4
1.33810
0.4
0.2
0
4
4
3
2
1
0
x
1
2
3
4
4
z =0.62
©Ming-chi Chen
社會統計
Page.81
標準常態分配曲線下的面積
z
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0
0.01
0.02
0.5000
0.496
0.492
0.4602
0.4562
0.4522
0.4207
0.4168
0.4129
0.3821
0.3783
0.3745
0.3446
0.3409
0.3372
0.3085
0.305
0.3015
0.2743
0.2709
0.2676
0.242
0.2389
0.2358
0.2119
0.209
0.2061
0.03
例
題
查表Table A Area under
the standard normal
distribution from 0 to z
小數點第二位
小數點第一位
P(Z>0.62)
=0.5-P(0≦Z≦0.62)
©Ming-chi Chen
社會統計
Page.82
Z介於零與一負數之間
例
題
Z~N(0,1), find P(-1.67Z 0)? 查表可知,
0.399
f( x)
 4
1.33810
P(0<Z<1.67)
=.4525
0.4
0.2
0
4
4
3
2
1
0
x
1
2
3
4
4
Z=-1.67
©Ming-chi Chen
社會統計
Page.83
Z介於一負數與正數之間
Z~N(0,1), find P(-1.21Z 2.15)?
0.399
f( x)
 4
1.33810
例
題
P(-1.21Z 2.15)
=P(-1.21<Z<0)+
P(0<Z<2.15) =
.4842+.3869=.8
711
0.4
0.2
0
4
4
3
2
Z=-1.21
©Ming-chi Chen
1
0
x
1
2
3
4
4
Z=2.15
社會統計
Page.84
Z介於兩正數之間
Z~N(0,1), find P(1.21Z 2.15)?
0.399
f( x)
 4
1.33810
0.4
0.2
0
4
4
3
2
1
0
x
1
2
3
Z=2.15
4
4
例
題
P(0<Z<2.15)
=.4842
P(0<Z<1.21)
=.3869
P(1.21Z 2.15)
=P(0<z<2.15) –
P(0<Z<1.21)
=.4842-.3869
Z=1.21
©Ming-chi Chen
社會統計
Page.85
Z介於兩負數之間
例
題
Z~N(0,1), find P(-2.15  Z  -1.21)?
0.399
f( x)
 4
1.33810
0.4
P(-2.15<Z<-1.21)
=P(1.21Z 2.15)
=.4842-.3869
0.2
0
4
4
3
2
1
0
x
1
2
3
4
4
Z=-2.15
Z=-1.21
©Ming-chi Chen
社會統計
Page.86
Z大於一正數
Z~N(0,1), find P(Z >1.64)?
0.399
f( x)
 4
1.33810
例
題
P(0Z 1.64)
=.4495
P(Z>1.64) =
0.5-.4495
=.0505
0.4
0.2
0
4
4
3
2
1
0
x
1
2
3
4
4
Z=1.64
©Ming-chi Chen
社會統計
Page.87
Z小於一負數
Z~N(0,1), find P(Z -2.02)?
0.399
f( x)
 4
1.33810
例
題
P(-2.02<Z<0)
=P(0<Z<2.02)
= 0.4783
P(Z<-2.02) =
0.5-0.4783
0.4
0.2
0
4
4
3
2
1
0
x
1
2
3
4
4
Z=-2.02
©Ming-chi Chen
社會統計
Page.88
Z大於或小於4
Z~N(0,1), find P(Z >4.63)?
0.399
f( x)
 4
1.33810
例
題
P(Z<4.63)
=1
P(Z>4.63) =0
0.4
0.2
0
4
4
3
©Ming-chi Chen
2
1
0
x
1
2
社會統計
3
4
4
Page.89
給定面積,求Z?
例
題
Z~N(0,1), find value z1 and z2 such that the area to the
right of z2 is 0.025 and the area to the left of z1 is
0.025?
0.399
f( x)
 4
1.33810
0.4
P(Z>z2)=0.025
P(0<Z<z2)=.4750
查表得知z2=1.96
0.2
0
4
4
3
©Ming-chi Chen
2
z1
1
0
x
1
2
z2
社會統計
3
4
4
Page.90
標準常態分配中常用的累積機率 例
題
右表為常用的數據,可以
熟記
©Ming-chi Chen
社會統計
z
-2.58
-2.33
-1.96
-1.65
-1.28
-0.67
0.00
0.67
1.28
1.65
1.96
2.33
2.58
P(Z<z)
0.005
0.010
0.025
0.050
0.100
0.250
0.500
0.750
0.900
0.950
0.975
0.990
0.995
Page.91
求一般常態分配的面積
觀
念
已知標準常態分配N(0,1)的面積,可以
設法將任意常態分配N(μ, σ2)轉換成
N(0,1),利用查表即可求面積
©Ming-chi Chen
社會統計
Page.92
標準化standardizing
transformation
觀
念
X ~N(μ, σ2),then standardized score or Z
score =
X u
Z
σ
Z ~N(0, 1)
Z score或是標準化分數的意義就是某數
離均數有幾個標準差
©Ming-chi Chen
社會統計
Page.93
給定常態分配,求介於兩數的機率?例
題
Suppose X~N(10,25), find the area under the
curve between x1=12 and x2=16?
z1 
z2 
10
u=0
12
16

x1  

12  10

 0. 4
5
16  10

 1. 2
5
P(.4<Z<1.2)=.3849 .1554 =.2295
z1=0.4
z2=1.2
©Ming-chi Chen
x1  
社會統計
Page.94
給定常態分配,求介於兩數的機率?例
題
一隧道工程每週的進度X~N(100,400), 求下
週進度介於80 至120的機率 ?
400
z1 
x1  
z2 
80
100 120

x1  

80  100

 1
20
120  100

1
20
P(80<X<120) =P(-1<Z<1) = .3413 +.3413
©Ming-chi Chen
社會統計
Page.95
給定面積,求原始分數?
例
題
高普考的成績為常態分配,平均分數為250,
標準差為11.5,如果只錄取求2.5%,求最
低錄取分數為何?
x0  250
z0 
11.5
11.5
P(Z<z0) = 0.975
x0  250
1.96 
11 .5
250
©Ming-chi Chen
社會統計
Page.96