111 年 國立政治大學統計學系碩士班《統計方法》
第 1 題12 分
A Center of Sleep Disorder conducted a survey to determine whether the hours of sleep per night are independent of age. A random sample of 500 individuals was asked two questions: (i) hours of sleep per night (with four options: fewer than 6, 6 to 6.9, 7 to 7.9, and 8 or more); (ii) age (younger than 30, and 30 or older). The data are given in the following table.
🖼️【此處有附圖,請對照原卷】
Age
| Hours of sleep | Younger than 30 | 30 or older |
|---|---|---|
| fewer than 6 | 60 | 90 |
| 6 to 6.9 | 70 | 70 |
| 7 to 7.9 | 60 | 60 |
| 8 or more | 50 | 40 |
(a) Using a 0.05 significance level, conduct a hypothesis test to determine whether the hours of sleep per night are independent of age. Please complete the hypothesis test. (10%)
(b) What is your interpretation about the result in (a)? (2%)
登入後即可作答並保存紀錄。
核心觀念
本題評量列聯表的卡方獨立性檢定(Chi-Square Test of Independence)。主要觀念與公式如下:
- 虛無假說與對立假說:
- :兩類別變數相互獨立(Independent)。
- :兩類別變數非獨立/具相依關聯(Not independent / Dependent)。
- 期望次數(Expected Frequency):
在 成立的條件下,第 列第 行的期望次數公式為: 其中 為第 列的邊際合計(Row Total), 為第 行的邊際合計(Column Total), 為總樣本數。 - 皮爾森卡方檢定統計量(Pearson's Chi-Square Test Statistic): 在 成立且樣本數足夠大時,該統計量近似服從自由度 的卡方分配,其中 為列數、 為行數。
- 決策法則:
在顯著水準 下,當 時拒絕 ;反之則不拒絕 。
解題方法
從原卷頁圖可讀出關鍵資訊:表格為 的雙向列聯表,列變數為「每晚睡眠時數(Hours of sleep)」,共 4 個組別( 小時、6 至 6.9 小時、7 至 7.9 小時、 小時);行變數為「年齡(Age)」,共 2 個組別( 歲、 歲)。總調查樣本數為 。
(a) 假設檢定完整步驟
步驟一:建立統計假說
- :每晚睡眠時數與年齡相互獨立(Hours of sleep per night are independent of age)。
- :每晚睡眠時數與年齡不獨立(Hours of sleep per night and age are not independent)。
步驟二:計算邊際次數與期望次數
計算各列合計 與各行合計 :
- 行合計(年齡):
- 小於 30 歲:
- 30 歲或以上:
- 總樣本數:
- 列合計(睡眠時數):
- 小時:
- 6 至 6.9 小時:
- 7 至 7.9 小時:
- 小時:
各格期望次數 計算如下:
- ,
- ,
- ,
- ,
所有格子的期望次數皆大於 5(最小期望值為 ),符合卡方檢定的大樣本條件。
步驟三:計算檢定統計量
逐格計算 :
- 第 1 列( 小時):
- 第 2 列(6 至 6.9 小時):
- 第 3 列(7 至 7.9 小時):
- 第 4 列( 小時):
合計檢定統計量為:
步驟四:決定自由度與臨界值
- 自由度:
- 在顯著水準 下,查卡方分配臨界值:
第 2 題20 分
For testing v.s. , a random sample of 256 individuals is selected from the population. The population variance is 400. The power is 0.2005, denoted by , when the actual population mean is 23.4.
(a) What is the significance level adopted in the test? (12%)
(b) In such a hypothesis testing with a sample of 256 individuals, is it possible that the probability of type II error and the significance level decrease simultaneously? Please give your reason. (8%)
登入後即可作答並保存紀錄。
核心觀念
本題考查母體變異數已知時的單一母體平均數右尾 檢定,以及顯著水準與第二類錯誤的關係。
已知:
- ,故
- 標準誤為
右尾檢定的拒絕域可寫為:
其中 為臨界值。
顯著水準為虛無假設邊界 下的拒絕機率:
當實際平均數為 時,檢定力為:
解題方法
(a)求顯著水準
由題意:
因為 ,標準化得:
標準常態分配中:
因此:
得到臨界值:
接著在虛無假設的邊界 下計算顯著水準:
此時 ,所以:
查標準常態分配表:
故:
亦即顯著水準為 。
(b)顯著水準與第二類錯誤能否同時下降?
在樣本數固定為 時,拒絕域為 。
顯著水準為:
當臨界值 增加時,拒絕虛無假設變得更困難,因此 下降。
另一方面,當實際平均數為 時,第二類錯誤機率為:
當臨界值 增加時, 的機率上升,因此 上升。
第 3 題35 分
A realty company sells apartments in the Midwest of the United States. Since their customers are interested in the fee they have to pay for heating in winter, a research group in the company collected data and tried to build regression models to predict the heating cost (abbreviated to Heat.cost; denoted by Y). There were three independent variables: the mean temperature in winter (Temp, ), the centimeters of insulation in the attic (Insu, ), and the age (years) of the heater (Age, ). The research group considered the following regression analyses:
Model 1:
Model 2:
Model 3:
where , , and are error terms. They collected data from 20 of their former customers for data analysis. First of all, the Model 1 is fitted based on the 10 elements given in the following table, and please answer Questions (a) and (b).
| Customer | Y | X₁ |
|---|---|---|
| 1 | 250 | -5 |
| 2 | 360 | -9 |
| 3 | 165 | -5 |
| 4 | 43 | 9 |
| 5 | 92 | 11 |
| 6 | 200 | -8 |
| 7 | 355 | -19 |
| 8 | 290 | -21 |
| 9 | 230 | -13 |
| 10 | 120 | 6 |
(a) Find the least squares estimates of and under Model 1. (12%)
(b) Compute the coefficient of determination, , for Model 1. (12%)
An output from a computer software for fitting Model 3 to the data is displayed in the followings. Using the output to answer Questions (c) and (d).
Coefficients:
| | Estimate | Std. Error | t value | Pr(>|t|) |
|-----------|----------|------------|---------|----------|
| (Intercept)| 228.833 | 40.547 | 5.644 | 3.66e-05 *** |
| Temp | -8.348 | 1.361 | -6.134 | 1.44e-05 *** |
| Insu | -6.098 | 1.872 | -3.258 | 0.00494 ** |
| Age | 5.751 | 3.937 | 1.461 | 0.16349 |
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 '.' 0.1 ' ' 1
Residual standard error: 49.98 on 16 degrees of freedom
Multiple R-squared: 0.8123, Adjusted R-squared: 0.7771
F-statistic: 23.08 on 3 and 16 DF, p-value: 4.695e-06
The output for fitting Model 2 to the data is displayed in the followings.
Coefficients:
| | Estimate | Std. Error | t value | Pr(>|t|) |
|-----------|----------|------------|---------|----------|
| (Intercept)| 86.184 | 48.656 | 1.771 | 0.0934 . |
| Age | 17.009 | 6.303 | 2.699 | 0.0147 * |
(c) What is your interpretation about the result of the F-test for Model 3? (5%)
(d) Based on the fittings, the under Model 2 is significant while the under Model 3 is not, at a 0.05 significance level. Comment on the phenomenon (Is there any contradiction, or ...?). (6%)
登入後即可作答並保存紀錄。
此題考驗簡單線性迴歸、複迴歸的參數估計、判定係數,以及複迴歸的 F 檢定與變數篩選的解讀。
Model 1:簡單線性迴歸
(a) 計算 和 的最小平方法估計值:
對於簡單線性迴歸 ,最小平方法估計量為:
首先,計算所需的總和:
計算 :
計算 :
【答案】, 。
(b) 計算判定係數 :
,其中 。
首先計算 :
或者,也可以使用 。
【答案】。
Model 3:複迴歸
(c) 解釋 Model 3 的 F 檢定結果:
F 檢定的虛無假設是所有迴歸係數(除了截距項)同時為零:。
對立假設是至少有一個迴歸係數不為零: 至少一個 ()。
從輸出結果得知:
- F-statistic: 23.08
- p-value: 4.695e-06
顯著水準通常預設為 (題目中未明確給出,但通常如此)。
由於 F 檢定的 p-value () 非常小,遠小於 0.05,我們強烈拒絕虛無假設 。
解釋:
這表示 Model 3 是一個統計上顯著的迴歸模型。至少有 Temp ()、Insu () 或 Age () 中的一個自變數對預測 Y(Heating Cost)有顯著的貢獻。整體模型能顯著地解釋 Y 的變異。
【答案】F 檢定的 p-value () 小於 0.05,因此在 0.05 的顯著水準下,我們拒絕虛無假設,認為 Model 3 整體上是統計上顯著的,即至少有一個自變數對 Y 有顯著的預測能力。
(d) 評論 在 Model 2 和 Model 3 中的顯著性差異:
- Model 2 ():
- 自變數:Age ()
- 結果:(Intercept) 的 p-value = 0.0934 (不顯著 at ),Age () 的 p-value = 0.0147 (顯著 at )。
- 結論:在 Model 2 中,Age () 對 Y 有顯著的預測能力。
第 4 題10 分
Consider the hypothesis test that v.s. , where is a fixed constant. The population variance is known as . Suppose that the significance level is set at , and suppose further that the probability of type II error is when the population mean is , where is a constant smaller than . Define and as numbers satisfying and . Derive that the sample size should be (and then round up).
登入後即可作答並保存紀錄。
此題考驗假設檢定中,第一型錯誤機率、第二型錯誤機率與樣本數的關係,特別是如何推導樣本數的公式。
題目給定的檢定是左尾檢定:
顯著水準為 ,即 。
第二型錯誤機率為 ,當實際母體平均數為 時,該機率為 。 。
。
樣本數為 ,母體變異數為 。
檢定統計量為 。
根據顯著水準 ,我們拒絕 當 (因為是左尾檢定,臨界值在負方向)。
也就是 ,所以拒絕域為 。
根據第二型錯誤機率 ,當實際母體平均數為 時,我們接受 的機率為 。
接受域為 。
所以,。
將 轉換為標準常態變數 ,其平均值為 ,標準誤為 。
。
題目定義 滿足 。
然而,這裡的檢定是左尾檢定,接受域是 ,拒絕域是 。
在 時,。
標準化後,。
因此,。
我們有兩個關於臨界值 的關係式:
- 從顯著水準 導出: (注意:這裡的 是標準常態分佈右尾機率為 的值,對應左尾檢定的臨界值是 。)
- 從第二型錯誤 導出:
將這兩個式子聯立:
重新整理以求解 :
第 5 題23 分
A research study is conducted to compare the kilometers per liter of unleaded regular, mid-grade, and super premium gasolines. There are differences in the performances of different automobiles. Seven different automobiles (numbered in 1 to 7) are sampled randomly and tested. The experimental results, in kilometers per liter, are given in the following table.
🖼️【此處有附圖,請對照原卷】
| Automobile | Regular | Mid-grade | Super Premium |
|---|---|---|---|
| 1 | 26 | 26 | 29 |
| 2 | 28 | 25 | 28 |
| 3 | 26 | 28 | 30 |
| 4 | 29 | 28 | 30 |
| 5 | 31 | 30 | 35 |
| 6 | 28 | 29 | 33 |
| 7 | 28 | 30 | 32 |
(a) To answer the research question, an ANOVA is performed. What are the null and alternative hypotheses for the ANOVA? (2%)
(b) Set up the ANOVA table. (17%)
(c) Using a 0.05 significance level, what is the conclusion? What is your interpretation about the result? (4%)
登入後即可作答並保存紀錄。
核心觀念
本題屬於實驗設計中的隨機完全區集設計(Randomized Complete Block Design, RCBD)之變異數分析(ANOVA),亦可視為無重複試驗的二因子變異數分析(Two-way ANOVA without replication)。
- 實驗架構:
- 處理因子(Treatments):汽油種類(Gasolines),共 種(Regular、Mid-grade、Super Premium)。
- 區集因子(Blocks):汽車(Automobiles),共 輛(編號 1 至 7)。
- 反應變數(Response Variable):每公升行駛公里數(km/L)。
- 統計模型: 其中 為總平均, 為第 種汽油的處理效應(滿足 ), 為第 輛汽車的區集效應(滿足 ), 為隨機誤差。
- 平方和分解(Sum of Squares Identity):
總變異可正交分解為處理變異、區集變異與隨機誤差變異: 自由度對應分解為: - 檢定統計量:
檢定處理效應使用 統計量:
解題方法
由原卷附圖(第 3 頁題幹表格及第 5 頁 分佈表)可知:實驗共測試 輛汽車與 種汽油,總觀測值個數為 。
(a) 虛無假設與對立假設
本研究主要目的在於比較三種無鉛汽油(Regular、Mid-grade、Super Premium)的每公升行駛公里數是否相同,故檢定假設針對汽油處理平均數:
-
虛無假設(Null Hypothesis):
即三種汽油的平均每公升行駛公里數無顯著差異。
-
對立假設(Alternative Hypothesis):
即至少有兩種汽油的平均每公升行駛公里數存在顯著差異。
(b) 建立 ANOVA 表(計算過程與彙整)
先計算各列(汽車/區集)、各行(汽油/處理)的總和與平均數:
-
各處理(汽油)總和與平均值():
- Regular ():
- Mid-grade ():
- Super Premium ():
-
各區集(汽車)總和與平均值():
- 汽車 1:
- 汽車 2:
- 汽車 3:
- 汽車 4:
- 汽車 5:
- 汽車 6:
- 汽車 7:
-
總計與總平均:
-
平方和(Sum of Squares)計算:
-
總平方和(Total Sum of Squares, ):
逐車計算各觀測值與 29 之離均差平方和:
- 車 1:
- 車 2:
- 車 3:
- 車 4:
- 車 5:
- 車 6:
- 車 7:
-
處理平方和(Treatments Sum of Squares, ):
-
區集平方和(Blocks Sum of Squares, ):
-
誤差平方和(Error Sum of Squares, ):
-
-
自由度(Degrees of Freedom):
- 處理自由度:
- 區集自由度:
- 誤差自由度:
- 總自由度:
-
均方(Mean Square)與 值:
- 處理均方:
- 區集均方:
- 誤差均方:
- 處理檢定統計量:
- 區集檢定統計量:
ANOVA 表彙整如下:
| 變異來源(Source) | 平方和() | 自由度() | 均方() | 值 | |