112 年 國立中央大學工業管理研究所碩士班《統計學》

📄 試題原卷 免費註冊後即可對照原始考卷 PDF免費註冊

第 1 題15 分

Let X1,X2X_1, X_2 be independent and identically distributed random variables from N(0,1)N(0,1). Set Y1=X1/X2Y_1 = X_1/X_2.
(a) Find the probability density function (pdf) of Y1Y_1.
(b) Let Xi,i=1,…,nX_i, i = 1, \dots, n be independent random variables such that XiX_i has a continuous and strictly increasing cumulative distribution function (CDF) FiF_i. Let Yi=Fi(Xi)Y_i = F_i(X_i). Show that YiY_i are independent U(0,1)U(0,1).
(c) Show that Z=−2∑i=1nln⁡(1−Yi)Z = -2 \sum_{i=1}^{n} \ln(1-Y_i) is distributed as χ2n2\chi^2_{2n}.
Hint: χk2∼Exp(1/2)\chi^2_k \sim \text{Exp}(1/2).

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題綜合考查:

  1. 隨機變數變換與聯合密度函數。
  2. Probability Integral Transform:若 XX 的 CDF 為連續且嚴格遞增的 FF,則 F(X)∼U(0,1)F(X)\sim U(0,1)。
  3. 獨立隨機變數經各自函數變換後仍保持獨立。
  4. 指數分布與卡方分布的關係:
    χ22∼Exp⁡(12),\chi^2_2\sim \operatorname{Exp}\left(\frac12\right),
    其中 Exp⁡(λ)\operatorname{Exp}(\lambda) 採用 rate 參數化,λ=12\lambda=\frac12。
  5. 獨立卡方隨機變數之和仍為卡方分布,自由度相加。

(a) 求 Y1=X1/X2Y_1=X_1/X_2 的 pdf

解題方法

直接處理比值的變換。令

Y1=X1X2,V=X2.Y_1=\frac{X_1}{X_2},\qquad V=X_2.

則反變換為

X1=Y1V,X2=V.X_1=Y_1V,\qquad X_2=V.

由於 X1,X2X_1,X_2 為獨立的 N(0,1)N(0,1) 隨機變數,其聯合密度函數為

fX1,X2(x1,x2)=12πexp⁡{−x12+x222}.f_{X_1,X_2}(x_1,x_2) = \frac{1}{2\pi} \exp\left\{-\frac{x_1^2+x_2^2}{2}\right\}.

計算 Jacobian:

∂(x1,x2)∂(y,v)=∣vy01∣=v.\frac{\partial(x_1,x_2)}{\partial(y,v)} = \begin{vmatrix} v & y\\ 0 & 1 \end{vmatrix} =v.

因此 Jacobian 的絕對值為 ∣v∣|v|。所以 (Y1,V)(Y_1,V) 的聯合密度為

fY1,V(y,v)=12πexp⁡{−y2v2+v22}∣v∣.f_{Y_1,V}(y,v) = \frac{1}{2\pi} \exp\left\{-\frac{y^2v^2+v^2}{2}\right\}|v|.

整理得

fY1,V(y,v)=12πexp⁡{−(1+y2)v22}∣v∣.f_{Y_1,V}(y,v) = \frac{1}{2\pi} \exp\left\{-\frac{(1+y^2)v^2}{2}\right\}|v|.

對 vv 積分即可得到 Y1Y_1 的邊際密度:

fY1(y)=∫−∞∞12πexp⁡{−(1+y2)v22}∣v∣ dv.f_{Y_1}(y) = \int_{-\infty}^{\infty} \frac{1}{2\pi} \exp\left\{-\frac{(1+y^2)v^2}{2}\right\}|v|\,dv.

因為被積函數為偶函數,

fY1(y)=1π∫0∞vexp⁡{−(1+y2)v22} dv.f_{Y_1}(y) = \frac{1}{\pi} \int_0^\infty v\exp\left\{-\frac{(1+y^2)v^2}{2}\right\}\,dv.

利用

∫0∞ve−av2/2 dv=1a,a>0,\int_0^\infty ve^{-av^2/2}\,dv=\frac1a,\qquad a>0,

取 a=1+y2a=1+y^2,得到

fY1(y)=1π(1+y2),−∞<y<∞.\boxed{ f_{Y_1}(y)=\frac{1}{\pi(1+y^2)},\qquad -\infty<y<\infty }.

這正是標準 Cauchy 分布的密度,因此

Y1∼Cauchy⁡(0,1).\boxed{Y_1\sim \operatorname{Cauchy}(0,1)}.

(b) 證明 Yi=Fi(Xi)Y_i=F_i(X_i) 彼此獨立且服從 U(0,1)U(0,1)

1. 證明 Yi∼U(0,1)Y_i\sim U(0,1)

固定一個 ii。因為 FiF_i 連續且嚴格遞增,對 0<y<10<y<1,可使用其反函數 Fi−1F_i^{-1}:

P(Yi≤y)=P(Fi(Xi)≤y)=P(Xi≤Fi−1(y))=Fi(Fi−1(y))=y.\begin{aligned} P(Y_i\le y) &=P\bigl(F_i(X_i)\le y\bigr)\\ &=P\bigl(X_i\le F_i^{-1}(y)\bigr)\\ &=F_i\bigl(F_i^{-1}(y)\bigr)\\ &=y. \end{aligned}

因此 YiY_i 的 CDF 為

FYi(y)={0,y≤0,y,0<y<1,1,y≥1.F_{Y_i}(y)= \begin{cases} 0, & y\le 0,\\ y, & 0<y<1,\\ 1, & y\ge 1. \end{cases}

這正是 U(0,1)U(0,1) 的 CDF,所以

Yi∼U(0,1).\boxed{Y_i\sim U(0,1)}.

2. 證明 YiY_i 彼此獨立

對任意 y1,…,yn∈(0,1)y_1,\dots,y_n\in(0,1),

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 2 題10 分

Let Xi,i=1,…,nX_i, i = 1, \dots, n be independent random variables such that XiX_i has a continuous and strictly increasing cumulative distribution function (CDF) FiF_i. Let Yi=Fi(Xi)Y_i = F_i(X_i).
(a) Show that YiY_i are independent U(0,1)U(0,1).
(b) Show that Z=−2∑i=1nln⁡(1−Yi)Z = -2 \sum_{i=1}^{n} \ln(1-Y_i) is distributed as χ2n2\chi^2_{2n}.
Hint: χk2∼Exp(1/2)\chi^2_k \sim \text{Exp}(1/2).

登入後即可作答並保存紀錄。

這一題的完整詳解

本題為題組題,(a) 部分已在第一題 (b) 中證明,(b) 部分已在第一題 (c) 中證明。

(a) 證明 Yi=Fi(Xi)Y_i = F_i(X_i) 獨立且服從 U(0,1)U(0,1)。
令 XX 是一個連續隨機變數,其 CDF 為 F(x)F(x),且 F(x)F(x) 是嚴格遞增的。令 Y=F(X)Y = F(X)。
我們需要計算 YY 的 CDF,即 FY(y)=P(Y≤y)=P(F(X)≤y)F_Y(y) = P(Y \le y) = P(F(X) \le y)。
由於 FF 是嚴格遞增的,存在反函數 F−1F^{-1}。
P(F(X)≤y)=P(X≤F−1(y))P(F(X) \le y) = P(X \le F^{-1}(y))。
由於 FX(x)=P(X≤x)F_X(x) = P(X \le x),所以 P(X≤F−1(y))=FX(F−1(y))P(X \le F^{-1}(y)) = F_X(F^{-1}(y))。
因為 FX(x)=F(x)F_X(x) = F(x),所以 FY(y)=F(F−1(y))=yF_Y(y) = F(F^{-1}(y)) = y。
這個結果對於 yy 在 FF 的值域內成立。由於 XX 是連續隨機變數,其 CDF F(x)F(x) 的值域是 [0,1][0,1]。
因此,Y=F(X)Y = F(X) 的 CDF 是 FY(y)=yF_Y(y) = y 對於 0≤y≤10 \le y \le 1。
這就是 U(0,1)U(0,1) 的 CDF。
所以,Yi=Fi(Xi)Y_i = F_i(X_i) 服從 U(0,1)U(0,1)。

現在證明獨立性。
令 Yi=Fi(Xi)Y_i = F_i(X_i),其中 XiX_i 是獨立的。
我們需要證明 P(Y1≤y1,Y2≤y2,…,Yn≤yn)=P(Y1≤y1)P(Y2≤y2)…P(Yn≤yn)P(Y_1 \le y_1, Y_2 \le y_2, \dots, Y_n \le y_n) = P(Y_1 \le y_1) P(Y_2 \le y_2) \dots P(Y_n \le y_n)。
P(Y1≤y1,…,Yn≤yn)=P(F1(X1)≤y1,…,Fn(Xn)≤yn)P(Y_1 \le y_1, \dots, Y_n \le y_n) = P(F_1(X_1) \le y_1, \dots, F_n(X_n) \le y_n)
由於 FiF_i 是嚴格遞增的,這等同於
P(X1≤F1−1(y1),…,Xn≤Fn−1(yn))P(X_1 \le F_1^{-1}(y_1), \dots, X_n \le F_n^{-1}(y_n))
由於 XiX_i 是獨立的,
=P(X1≤F1−1(y1))…P(Xn≤Fn−1(yn))= P(X_1 \le F_1^{-1}(y_1)) \dots P(X_n \le F_n^{-1}(y_n))
=F1(F1−1(y1))…Fn(Fn−1(yn))= F_1(F_1^{-1}(y_1)) \dots F_n(F_n^{-1}(y_n))
=y1…yn= y_1 \dots y_n
而 P(Yi≤yi)=yiP(Y_i \le y_i) = y_i (對於 0≤yi≤10 \le y_i \le 1)。
所以,P(Y1≤y1)…P(Yn≤yn)=y1…ynP(Y_1 \le y_1) \dots P(Y_n \le y_n) = y_1 \dots y_n。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 3 題10 分

The moment generating function of random variable XX is defined as follows:
MX(t)=E[etX]=∫−∞∞etxf(x)dxM_X(t) = E[e^{tX}] = \int_{-\infty}^{\infty} e^{tx} f(x)dx, where f(x)f(x) is the pdf of XX.
Show that E[X2]=d2MX(t)dt2∣t=0E[X^2] = \frac{d^2 M_X(t)}{dt^2} \bigg|_{t=0}.

登入後即可作答並保存紀錄。

這一題的完整詳解

本題考查動差生成函數 (Moment Generating Function, MGF) 的性質,特別是如何利用 MGF 求取隨機變數的動差 (moments)。

核心觀念:動差生成函數對時間 tt 的微分,在 t=0t=0 時等於該隨機變數的對應動差。

解題過程:
動差生成函數的定義為 MX(t)=E[etX]M_X(t) = E[e^{tX}]。
我們要求 E[X2]E[X^2]。根據動差生成函數的性質,我們需要對 MX(t)M_X(t) 進行微分。

首先,我們計算 MX(t)M_X(t) 對 tt 的一階微分:
dMX(t)dt=ddtE[etX]\frac{dM_X(t)}{dt} = \frac{d}{dt} E[e^{tX}]
假設我們可以交換微分和期望值運算(這在 XX 的 MGF 存在且其微分也存在的條件下是成立的):
dMX(t)dt=E[ddt(etX)]\frac{dM_X(t)}{dt} = E\left[\frac{d}{dt}(e^{tX})\right]
對 etXe^{tX} 對 tt 微分,得到 XetXXe^{tX}:
dMX(t)dt=E[XetX]\frac{dM_X(t)}{dt} = E[Xe^{tX}]
現在,我們將 t=0t=0 代入上式:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 4 題10 分

Suppose a civil engineer wishes to compare the strengths of two different types of beams, one (A) made of steel and the other (B) made of a different and more expensive alloy. A certain deflection (in units of 0.001 inch) was measured for each beam when submitted to a given force; thus a small deflection would indicate a beam of great strength. The order observations for the two samples of size n1=8n_1 = 8, and n2=6n_2 = 6 are the following:

TypesDeflection (in 0.001 inch)
A79, 81, 83, 84, 86, 86, 86, 87
B74, 75, 76, 77, 78, 82

(a) Please conduct a 2-samples t-test to identify whether there is a difference between the two means of deflections of different types of beams? Use α=0.05\alpha = 0.05.

Suppose there are two more different types of beams, (C) and (D), made of different alloys. The resulted sample means and sample variances of deflections from the two corresponding samples of Type C with size n3=6n_3 = 6, and of Type D with size n4=6n_4 = 6, are as following:

TypesSample sizeSample meanSample Variance
C6797.6
D6738.0

(b) Please conduct an ANOVA to identify whether there is a difference between the four means of deflections of different types of beams? Use α=0.05\alpha = 0.05, and summarize the test result in an ANOVA table.

登入後即可作答並保存紀錄。

這一題的完整詳解

本題包含兩部分,(a) 是兩樣本 t 檢定,(b) 是單因子變異數分析 (ANOVA)。

(a) 兩樣本 t 檢定
核心觀念:比較兩個獨立樣本的平均數是否有顯著差異。由於題目未說明變異數是否相等,通常假設變異數不相等,使用 Welch's t-test,但若題目有提供表格,有時也隱含可以計算合併變異數。在此我們計算樣本變異數來判斷。

首先,我們計算兩組樣本的平均數和變異數。
樣本 A:
數據:79, 81, 83, 84, 86, 86, 86, 87
樣本數 n1=8n_1 = 8
樣本平均數 xˉ1=79+81+83+84+86+86+86+878=6828=85.25\bar{x}_1 = \frac{79+81+83+84+86+86+86+87}{8} = \frac{682}{8} = 85.25
樣本變異數 s12s_1^2:
計算離差平方和:
(79−85.25)2+(81−85.25)2+(83−85.25)2+(84−85.25)2+(86−85.25)2+(86−85.25)2+(86−85.25)2+(87−85.25)2(79-85.25)^2 + (81-85.25)^2 + (83-85.25)^2 + (84-85.25)^2 + (86-85.25)^2 + (86-85.25)^2 + (86-85.25)^2 + (87-85.25)^2
=(−6.25)2+(−4.25)2+(−2.25)2+(−1.25)2+(0.75)2+(0.75)2+(0.75)2+(1.75)2= (-6.25)^2 + (-4.25)^2 + (-2.25)^2 + (-1.25)^2 + (0.75)^2 + (0.75)^2 + (0.75)^2 + (1.75)^2
=39.0625+18.0625+5.0625+1.5625+0.5625+0.5625+0.5625+3.0625= 39.0625 + 18.0625 + 5.0625 + 1.5625 + 0.5625 + 0.5625 + 0.5625 + 3.0625
=68.5= 68.5
s12=68.58−1=68.57≈9.7857s_1^2 = \frac{68.5}{8-1} = \frac{68.5}{7} \approx 9.7857

樣本 B:
數據:74, 75, 76, 77, 78, 82
樣本數 n2=6n_2 = 6
樣本平均數 xˉ2=74+75+76+77+78+826=4626=77\bar{x}_2 = \frac{74+75+76+77+78+82}{6} = \frac{462}{6} = 77
樣本變異數 s22s_2^2:
計算離差平方和:
(74−77)2+(75−77)2+(76−77)2+(77−77)2+(78−77)2+(82−77)2(74-77)^2 + (75-77)^2 + (76-77)^2 + (77-77)^2 + (78-77)^2 + (82-77)^2
=(−3)2+(−2)2+(−1)2+(0)2+(1)2+(5)2= (-3)^2 + (-2)^2 + (-1)^2 + (0)^2 + (1)^2 + (5)^2
=9+4+1+0+1+25=40= 9 + 4 + 1 + 0 + 1 + 25 = 40
s22=406−1=405=8s_2^2 = \frac{40}{6-1} = \frac{40}{5} = 8

檢定假設:
虛無假設 H0H_0: μ1=μ2\mu_1 = \mu_2 (兩種 beam 的平均撓度相同)
對立假設 H1H_1: μ1≠μ2\mu_1 \ne \mu_2 (兩種 beam 的平均撓度不同)
顯著水準 α=0.05\alpha = 0.05。

由於 s12≈9.7857s_1^2 \approx 9.7857 且 s22=8s_2^2 = 8,兩者差異不大,且樣本數不大,我們可以用兩種方式處理:

  1. 假設變異數相等,計算合併變異數。
  2. 假設變異數不相等,使用 Welch's t-test,自由度計算較複雜。

在此,我們嘗試計算合併變異數,並假設變異數相等。
合併變異數 sp2=(n1−1)s12+(n2−1)s22n1+n2−2=(8−1)(9.7857)+(6−1)(8)8+6−2=7×9.7857+5×812=68.5+4012=108.512≈9.0417s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2} = \frac{(8-1)(9.7857) + (6-1)(8)}{8+6-2} = \frac{7 \times 9.7857 + 5 \times 8}{12} = \frac{68.5 + 40}{12} = \frac{108.5}{12} \approx 9.0417
檢定統計量 t:
t=xˉ1−xˉ2sp1n1+1n2=85.25−779.041718+16t = \frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}} = \frac{85.25 - 77}{\sqrt{9.0417} \sqrt{\frac{1}{8} + \frac{1}{6}}}
t=8.259.04170.125+0.1667=8.259.04170.2917=8.252.6358=8.251.6235≈5.081t = \frac{8.25}{\sqrt{9.0417} \sqrt{0.125 + 0.1667}} = \frac{8.25}{\sqrt{9.0417} \sqrt{0.2917}} = \frac{8.25}{\sqrt{2.6358}} = \frac{8.25}{1.6235} \approx 5.081
自由度 df=n1+n2−2=8+6−2=12df = n_1+n_2-2 = 8+6-2 = 12。
在 α=0.05\alpha = 0.05 的顯著水準下,雙尾檢定的臨界值為 tα/2,df=t0.025,12t_{\alpha/2, df} = t_{0.025, 12}。
查 t 分布表,當 df=12,α/2=0.025\alpha/2=0.025 時,臨界值約為 2.1792.179。
由於 ∣t∣=5.081>2.179|t| = 5.081 > 2.179,我們拒絕虛無假設 H0H_0。

結論:在 α=0.05\alpha = 0.05 的顯著水準下,有足夠證據顯示兩種 beam 的平均撓度存在顯著差異。

如果我們採用 Welch's t-test (假設變異數不相等):
t=xˉ1−xˉ2s12n1+s22n2=85.25−779.78578+86=8.251.2232+1.3333=8.252.5565=8.251.5989≈5.160t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}} = \frac{85.25 - 77}{\sqrt{\frac{9.7857}{8} + \frac{8}{6}}} = \frac{8.25}{\sqrt{1.2232 + 1.3333}} = \frac{8.25}{\sqrt{2.5565}} = \frac{8.25}{1.5989} \approx 5.160
自由度計算 (Satterthwaite approximation):
df≈(s12n1+s22n2)2(s12/n1)2n1−1+(s22/n2)2n2−1=(1.2232+1.3333)2(1.2232)27+(1.3333)25=(2.5565)21.49627+1.77775=6.53570.2137+0.3555=6.53570.5692≈11.48df \approx \frac{(\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2})^2}{\frac{(s_1^2/n_1)^2}{n_1-1} + \frac{(s_2^2/n_2)^2}{n_2-1}} = \frac{(1.2232 + 1.3333)^2}{\frac{(1.2232)^2}{7} + \frac{(1.3333)^2}{5}} = \frac{(2.5565)^2}{\frac{1.4962}{7} + \frac{1.7777}{5}} = \frac{6.5357}{0.2137 + 0.3555} = \frac{6.5357}{0.5692} \approx 11.48
取 df≈11df \approx 11 或 1212。
在 α=0.05\alpha = 0.05 且 df=11df=11 的雙尾檢定,臨界值約為 2.2012.201。
在 α=0.05\alpha = 0.05 且 df=12df=12 的雙尾檢定,臨界值約為 2.1792.179。
無論如何, ∣t∣≈5.160|t| \approx 5.160 都遠大於臨界值,因此我們仍然拒絕虛無假設 H0H_0。
結論相同。

【答案】在 α=0.05\alpha = 0.05 的顯著水準下,我們拒絕虛無假設,認為兩種 beam 的平均撓度存在顯著差異。

(b) 單因子變異數分析 (ANOVA)
核心觀念:比較三個或更多組別的平均數是否有顯著差異。在此我們比較 C 和 D 兩組的平均數,但題目要求 ANOVA,表示要將 A, B, C, D 四組全部納入分析。然而,題目僅提供了 C 和 D 的樣本均值和變異數,而 A 和 B 則提供了原始數據。為了進行 ANOVA,我們需要所有組別的樣本數、樣本均值和樣本變異數。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 4 題10 分

(c) Following the test result in (b), we need to make comparisons between the four means, noted as pairwise-t tests. Please conduct a pairwise-t test between the two means of deflections of type A and type B with a = 0.05. Show the difference between (a) and (c).

登入後即可作答並保存紀錄。

這一題的完整詳解

本題要求在 ANOVA 結果顯著後,進行事後比較 (post-hoc test),具體是執行 A 和 B 兩組之間的成對 t 檢定,並比較此與 (a) 小題的 t 檢定。

核心觀念:事後比較用於找出 ANOVA 顯著差異是來自於哪些組別的配對。當進行多次比較時,需要調整顯著水準以控制整體第一類錯誤率。然而,此處僅要求對 A 和 B 進行 t 檢定,且顯著水準仍為 α=0.05\alpha = 0.05。

(a) 小題的 t 檢定:
在 (a) 小題中,我們已經對 A 和 B 兩組進行了獨立樣本 t 檢定。
樣本 A:n1=8n_1=8, xˉ1=85.25\bar{x}_1 = 85.25, s12≈9.7857s_1^2 \approx 9.7857
樣本 B:n2=6n_2=6, xˉ2=77\bar{x}_2 = 77, s22=8s_2^2 = 8
計算得到的 t 統計量約為 5.081 (假設變異數相等,df=12) 或 5.160 (假設變異數不相等,df ≈11.48\approx 11.48)。
在 α=0.05\alpha=0.05 下,臨界值約為 2.179 或 2.201。
由於 ∣t∣|t| 遠大於臨界值,我們拒絕虛無假設,認為 A 和 B 的平均撓度有顯著差異。

(c) 小題的成對 t 檢定 (事後比較):
此處的成對 t 檢定,是基於 ANOVA 的背景下進行的。儘管題目要求使用 α=0.05\alpha = 0.05,這代表是未調整的顯著水準。在實際應用中,為了控制整體第一類錯誤率,常會使用 Bonferroni 校正等方法。但我們僅依題目要求進行計算。
事後比較使用的 t 檢定,其變異數估計是基於所有組別的組內平方和 (SSW) 來計算的。
從 (b) 的 ANOVA 分析中,我們得到:
SSW = 186.5
dfW=22df_W = 22
組內平均平方和 MSW=SSWdfW=186.522≈8.477MSW = \frac{SSW}{df_W} = \frac{186.5}{22} \approx 8.477

事後比較的 t 檢定統計量公式為:
t=xˉi−xˉjMSW(1ni+1nj)t = \frac{\bar{x}_i - \bar{x}_j}{\sqrt{MSW (\frac{1}{n_i} + \frac{1}{n_j})}}
我們比較 A 和 B:
t=xˉA−xˉBMSW(1nA+1nB)=85.25−778.477(18+16)t = \frac{\bar{x}_A - \bar{x}_B}{\sqrt{MSW (\frac{1}{n_A} + \frac{1}{n_B})}} = \frac{85.25 - 77}{\sqrt{8.477 (\frac{1}{8} + \frac{1}{6})}}
t=8.258.477(0.125+0.1667)=8.258.477×0.2917=8.252.4739=8.251.5729≈5.245t = \frac{8.25}{\sqrt{8.477 (0.125 + 0.1667)}} = \frac{8.25}{\sqrt{8.477 \times 0.2917}} = \frac{8.25}{\sqrt{2.4739}} = \frac{8.25}{1.5729} \approx 5.245
此 t 檢定的自由度為 dfW=22df_W = 22。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 5 題4 分

Following 10 records are used to train a Naïve Bayesian Classification model to predict tennis-playing or not, based on weather information.

DayOutlookTemperatureHumidityWindPlay Tennis
1SunnyHotHighWeakNo
2SunnyHotHighStrongNo
3OvercastHotHighWeakYes
4RainyMildHighWeakYes
5RainyCoolNormalWeakYes
6RainyCoolNormalStrongNo
7OvercastCoolNormalStrongYes
8SunnyMildHighWeakNo
9SunnyCoolNormalWeakYes
10RainyMildNormalWeakYes

(a) Let's define the event A as "play_tennis = yes", while AcA^c as "play_tennis = no". Please determine the (prior) probabilities of Pr(A)Pr(A) and Pr(Ac)Pr(A^c) by counting the frequencies based on the 10 records.

(b) Let's define the event B1B_1 as "outlook= sunny", B2B_2 as "outlook= overcast", and B3B_3 as "outlook= rainy". Please determine the conditional probabilities of Pr(Bi∣A)Pr(B_i|A) and Pr(Bi∣Ac)Pr(B_i|A^c), i=1,2,3i = 1, 2, 3, by counting the frequencies based on the 10 records. (for example, Pr(B1∣A)=1/6Pr(B_1|A)=1/6 and Pr(B1∣Ac)=3/4Pr(B_1|A^c)=3/4)
Similarly, we can define events
C1C_1 as "temperature = hot", C2C_2 as "temperature = mild", and C3C_3 as "temperature = cool";
D1D_1 as "humidity = high", and D2D_2 as "humidity = normal";
E1E_1 as "wind = weak", and E2E_2 as "wind = strong".
Assume events {Bi}\{B_i\}, {Cj}\{C_j\}, {Dk}\{D_k\}, and {El}\{E_l\} are mutually independent. Hence the Pr(Bi∩Cj∩Dk∩El)Pr(B_i \cap C_j \cap D_k \cap E_l) can be determined as Pr(Bi)⋅Pr(Cj)⋅Pr(Dk)⋅Pr(El)Pr(B_i) \cdot Pr(C_j) \cdot Pr(D_k) \cdot Pr(E_l). For example,
Pr("outlook = sunny", "temperature = cool", "humidity = normal", "wind = weak")=Pr("outlook = sunny")⋅Pr("temperature = cool")⋅Pr("humidity = normal")⋅Pr("wind = weak")=410⋅410⋅510⋅710=0.056Pr(\text{"outlook = sunny", "temperature = cool", "humidity = normal", "wind = weak"}) = Pr(\text{"outlook = sunny"}) \cdot Pr(\text{"temperature = cool"}) \cdot Pr(\text{"humidity = normal"}) \cdot Pr(\text{"wind = weak"}) = \frac{4}{10} \cdot \frac{4}{10} \cdot \frac{5}{10} \cdot \frac{7}{10} = 0.056

(c) Let's use event X as "outlook = sunny, temperature = cool, humidity = normal, wind = weak". Please determine the conditional probabilities of Pr(X∣A)Pr(X|A) and Pr(X∣Ac)Pr(X|A^c) by counting the frequencies based on the 10 records with assuming independence.

(d) Try to use Bayes' Theorem to calculate the (posterior) probabilities, Pr(A∣X)Pr(A|X) and Pr(Ac∣X)Pr(A^c|X).

(e) With the posterior probabilities in (d), would the unknown sample X be classified/predicted as "play_tennis = yes" or "play_tennis = no"?

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查機率論與機器學習的核心基礎:單純貝氏分類器(Naïve Bayes Classifier)與貝氏定理(Bayes' Theorem)。

  1. 事前機率(Prior Probability):在未觀測特徵前,目標類別發生的邊際機率 Pr(A)Pr(A) 與 Pr(Ac)Pr(A^c)。
  2. 條件機率與條件獨立假設(Conditional Independence Assumption):
    單純貝氏分類器的核心假設為「在給定類別的條件下,各屬性特徵彼此相互獨立」: Pr(X∣A)=Pr(B∩C∩D∩E∣A)=Pr(B∣A)⋅Pr(C∣A)⋅Pr(D∣A)⋅Pr(E∣A)Pr(X|A) = Pr(B \cap C \cap D \cap E \mid A) = Pr(B|A) \cdot Pr(C|A) \cdot Pr(D|A) \cdot Pr(E|A)
  3. 事後機率(Posterior Probability)與貝氏定理(Bayes' Theorem):
    根據全機率定理與貝氏定理,觀測到特徵向量 XX 後,屬於類別 AA 的事後機率為: Pr(A∣X)=Pr(X∣A)Pr(A)Pr(X)=Pr(X∣A)Pr(A)Pr(X∣A)Pr(A)+Pr(X∣Ac)Pr(Ac)Pr(A|X) = \frac{Pr(X|A)Pr(A)}{Pr(X)} = \frac{Pr(X|A)Pr(A)}{Pr(X|A)Pr(A) + Pr(X|A^c)Pr(A^c)}
  4. 最大事後機率準則(MAP, Maximum A Posteriori):
    比較 Pr(A∣X)Pr(A|X) 與 Pr(Ac∣X)Pr(A^c|X),將樣本分類至事後機率較大之類別。

解題方法與推導

全體樣本數為 N=10N = 10。
將 10 筆資料依照目標變數「Play Tennis」進行分類統計:

  • 類別 AA(Play Tennis = Yes):共 6 筆(Day 3, 4, 5, 7, 9, 10)。
  • 類別 AcA^c(Play Tennis = No):共 4 筆(Day 1, 2, 6, 8)。

(a) 計算事前機率 Pr(A)Pr(A) 與 Pr(Ac)Pr(A^c)

直接計算類別出現的相對頻率:

Pr(A)=n(A)N=610=0.6Pr(A) = \frac{n(A)}{N} = \frac{6}{10} = 0.6 Pr(Ac)=n(Ac)N=410=0.4Pr(A^c) = \frac{n(A^c)}{N} = \frac{4}{10} = 0.4

(b) 計算各項條件機率

計算給定 AA(共 6 筆)與給定 AcA^c(共 4 筆)之條件下,各特徵的條件機率:

  1. Outlook (BB):

    • 在 AA 中:Sunny (B1B_1) 有 1 次 (Day 9);Overcast (B2B_2) 有 2 次 (Day 3, 7);Rainy (B3B_3) 有 3 次 (Day 4, 5, 10)。 Pr(B1∣A)=16,Pr(B2∣A)=26=13,Pr(B3∣A)=36=12Pr(B_1|A) = \frac{1}{6}, \quad Pr(B_2|A) = \frac{2}{6} = \frac{1}{3}, \quad Pr(B_3|A) = \frac{3}{6} = \frac{1}{2}
    • 在 AcA^c 中:Sunny (B1B_1) 有 3 次 (Day 1, 2, 8);Overcast (B2B_2) 有 0 次;Rainy (B3B_3) 有 1 次 (Day 6)。 Pr(B1∣Ac)=34,Pr(B2∣Ac)=04=0,Pr(B3∣Ac)=14Pr(B_1|A^c) = \frac{3}{4}, \quad Pr(B_2|A^c) = \frac{0}{4} = 0, \quad Pr(B_3|A^c) = \frac{1}{4}
  2. Temperature (CC):

    • 在 AA 中:Hot (C1C_1) 有 1 次 (Day 3);Mild (C2C_2) 有 2 次 (Day 4, 10);Cool (C3C_3) 有 3 次 (Day 5, 7, 9)。 Pr(C1∣A)=16,Pr(C2∣A)=26=13,Pr(C3∣A)=36=12Pr(C_1|A) = \frac{1}{6}, \quad Pr(C_2|A) = \frac{2}{6} = \frac{1}{3}, \quad Pr(C_3|A) = \frac{3}{6} = \frac{1}{2}
    • 在 AcA^c 中:Hot (C1C_1) 有 2 次 (Day 1, 2);Mild (C2C_2) 有 1 次 (Day 8);Cool (C3C_3) 有 1 次 (Day 6)。 Pr(C1∣Ac)=24=12,Pr(C2∣Ac)=14,Pr(C3∣Ac)=14Pr(C_1|A^c) = \frac{2}{4} = \frac{1}{2}, \quad Pr(C_2|A^c) = \frac{1}{4}, \quad Pr(C_3|A^c) = \frac{1}{4}
  3. Humidity (DD):

    • 在 AA 中:High (D1D_1) 有 2 次 (Day 3, 4);Normal (D2D_2) 有 4 次 (Day 5, 7, 9, 10)。 Pr(D1∣A)=26=13,Pr(D2∣A)=46=23Pr(D_1|A) = \frac{2}{6} = \frac{1}{3}, \quad Pr(D_2|A) = \frac{4}{6} = \frac{2}{3}
    • 在 AcA^c 中:High (D1D_1) 有 3 次 (Day 1, 2, 8);Normal (D2D_2) 有 1 次 (Day 6)。 Pr(D1∣Ac)=34,Pr(D2∣Ac)=14Pr(D_1|A^c) = \frac{3}{4}, \quad Pr(D_2|A^c) = \frac{1}{4}
  4. Wind (EE):

    • 在 AA 中:Weak (E1E_1) 有 5 次 (Day 3, 4, 5, 9, 10);Strong (E2E_2) 有 1 次 (Day 7)。 Pr(E1∣A)=56,Pr(E2∣A)=16Pr(E_1|A) = \frac{5}{6}, \quad Pr(E_2|A) = \frac{1}{6}
    • 在 AcA^c 中:Weak (E1E_1) 有 2 次 (Day 1, 8);Strong (E2E_2) 有 2 次 (Day 2, 6)。 Pr(E1∣Ac)=24=12,Pr(E2∣Ac)=24=12Pr(E_1|A^c) = \frac{2}{4} = \frac{1}{2}, \quad Pr(E_2|A^c) = \frac{2}{4} = \frac{1}{2}

(c) 計算特徵事件 XX 的條件機率 Pr(X∣A)Pr(X|A) 與 Pr(X∣Ac)Pr(X|A^c)

給定事件 X=(B1∩C3∩D2∩E1)X = (B_1 \cap C_3 \cap D_2 \cap E_1),即:
「Outlook = Sunny, Temperature = Cool, Humidity = Normal, Wind = Weak」。

根據單純貝氏之類別條件獨立性:

Pr(X∣A)=Pr(B1∣A)⋅Pr(C3∣A)⋅Pr(D2∣A)⋅Pr(E1∣A)Pr(X|A) = Pr(B_1|A) \cdot Pr(C_3|A) \cdot Pr(D_2|A) \cdot Pr(E_1|A)

代入數值計算:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

其他考古題