115 年 國立政治大學統計學系碩士班《統計方法》
第 1 題
Consider the following hypothesis test:
vs. .
The population variance is . Using a level of significance.
(a) A sample of provided a sample mean of . What is the -value of the test?
(b) What is the probability of making a Type II error when the actual population mean is ?
Note: You may use some of the following quantities for computing #1(b).
.
登入後即可作答並保存紀錄。
此題主要在考驗假設檢定中的 -value 計算以及 Type II 錯誤的機率計算。
核心觀念:
- -value: 在虛無假設為真的前提下,觀察到目前樣本統計量或比其更極端的統計量出現的機率。對於雙尾檢定,其計算方式為 。
- Type II 錯誤: 當對立假設為真時,卻未能拒絕虛無假設。其機率通常以 表示。
- 常態分配性質: 樣本平均數的抽樣分配近似於常態分配,且其均值為母體平均數 ,標準差為 。
(a) -value 的計算
步驟 1:設定檢定統計量
由於母體變異數已知 (),我們使用 -檢定。樣本大小 ,母體標準差 。
樣本平均數 。
檢定統計量為:
其中 是虛無假設下的母體平均數,即 。
步驟 2:計算檢定統計量的值
步驟 3:計算 -value
此為雙尾檢定 ()。
查標準常態分配表,可得 。
所以,。
【答案】
(b) Type II 錯誤機率 的計算
步驟 1:釐清 Type II 錯誤的定義
Type II 錯誤發生於虛無假設為假,但我們卻未能拒絕虛無假設。在此題中,實際母體平均數 ,而虛無假設為 。檢定水準為 。
第 2 題
Consider the probability density function
A random sample of size is taken from , and the order statistics are denoted by , and . Let the observation of be . Conduct a test v.s. by rejecting if or .
Please find the power function of the test.
登入後即可作答並保存紀錄。
核心觀念
本題考查:
- 由機率密度函數求母體累積分布函數;
- 次序統計量最大值 的分布;
- 以拒絕域計算檢定的 power function。
令
檢定的拒絕域為
因此,給定參數 時,檢定力函數為
其中兩個事件互斥。
解題方法
1. 求母體累積分布函數
由題目給定
因此,當 時,
完整寫成
2. 求最大次序統計量的分布
因為 是 個樣本的最大值,
樣本獨立,因此
當 時,
3. 計算拒絕域機率
事件一:
當 時,所有觀察值均小於 ,所以
當 時,
事件二:
第 3 題
To estimate a population proportion, the sample proportion is usually adopted as the point estimator. What is the probability that the sample proportion will be within of the population proportion? Suppose that the population proportion is , and the sample size is .
登入後即可作答並保存紀錄。
此題主要考驗對樣本比例抽樣分配的理解,以及利用常態近似計算機率。
核心觀念:
- 樣本比例的抽樣分配: 當樣本大小足夠大時,樣本比例 的抽樣分配近似於常態分配,其均值為母體比例 ,標準差為 。
- 常態近似: 當 且 時,二項分配可用常態分配近似。在此題中,, ,則 且 ,滿足常態近似條件。
- 機率計算: 利用標準化將樣本比例轉換為標準常態變數 ,再計算對應的機率。
步驟 1:確認參數與抽樣分配
母體比例 。
樣本大小 。
樣本比例 的抽樣分配近似於常態分配,其:
均值 。
標準差 。
計算標準差:。
步驟 2:設定問題的機率敘述
我們要求的是樣本比例 在母體比例 的 範圍內的機率。
即 。
第 4 題
For each of following statements, answer True or False. For each of false statements, please explain why it is false. (請簡單扼要說明)
If the alternative hypothesis is true, then the -value will always be smaller than the significance level.
登入後即可作答並保存紀錄。
此題考驗對 -value 和顯著水準 的關係的理解。
核心觀念:
- -value: 在虛無假設 () 為真的前提下,觀察到樣本統計量或比觀察到的樣本統計量更極端的結果的機率。
- 顯著水準 (): 預設的拒絕虛無假設的機率上限。如果 ,則拒絕 。
- 對立假設為真時: 當對立假設 () 為真時,意味著虛無假設 () 為假。
判斷:False
解釋:
-value 的定義與虛無假設為真時的機率有關。當對立假設為真時,虛無假設為假。
-value 的值會隨著樣本數據的變動而變動。
- 如果對立假設為真,而且樣本數據「非常」支持對立假設(即非常不支持虛無假設),那麼 -value 很可能會小於顯著水準 ,導致我們拒絕虛無假設。
- 然而,即使對立假設為真,也不保證 -value 就一定會小於 。有可能因為樣本變異度較大,或者樣本觀察值剛好落在虛無假設的接受域內,導致 -value 大於 。
第 5 題
For each of following statements, answer True or False. For each of false statements, please explain why it is false. (請簡單扼要說明)
The power of a test may be less or greater than the significance level.
登入後即可作答並保存紀錄。
此題考驗對檢定 power 和顯著水準 的關係的理解。
核心觀念:
- 顯著水準 (): 虛無假設 () 為真時,拒絕 的機率。它是 Type I 錯誤的機率上限。
- 檢定 Power (): 對立假設 () 為真時,拒絕 的機率。它是正確決策的機率。
- 與 Power 的關係: 是在 為真時的機率,而 Power 是在 為真時的機率。兩者描述的是不同條件下的機率,它們之間沒有固定的大小關係,可以互相獨立。
判斷:True
解釋:
- 顯著水準 是 Type I 錯誤的機率,即當虛無假設為真時,我們錯誤地拒絕它。
- 檢定 Power () 是正確地拒絕虛無假設的機率,即當對立假設為真時,我們正確地拒絕虛無假設。
第 6 題
For each of following statements, answer True or False. For each of false statements, please explain why it is false. (請簡單扼要說明)
The significance level is greater than or equal to the probability of a type I error.
登入後即可作答並保存紀錄。
此題考驗對顯著水準 和 Type I 錯誤機率的理解。
核心觀念:
- 顯著水準 (): 在進行假設檢定前,使用者設定的一個機率值。它代表了在虛無假設為真時,我們願意承擔的最大錯誤決策(拒絕 )的風險。
- Type I 錯誤: 當虛無假設 () 為真時,卻錯誤地拒絕了虛無假設。
- Type I 錯誤的機率: 在虛無假設為真時,實際發生 Type I 錯誤的機率。
判斷:False
第 7 題
Suppose that a random sample from a normal distribution results in the following observations:
.
(a) Construct a confidence interval for if is unknown.
(b) Suppose that is known to be . Construct a confidence interval for , using the information of . What is your interpretation about this interval estimate?
登入後即可作答並保存紀錄。
此題主要考驗如何建構母體變異數 的信賴區間,並區分 未知與已知時的差異。
核心觀念:
- 母體變異數 的信賴區間:
- 當 未知時,使用 分配。樣本變異數 。信賴區間為 。
- 當 已知時,使用 分配。使用修正的樣本變異數 。信賴區間為 。
- 分配的自由度: 當 未知時,自由度為 ;當 已知時,自由度為 。
- 信賴區間的解釋: 95% 的信賴區間表示,如果我們重複多次抽樣並計算信賴區間,平均有 95% 的區間會包含真實的母體參數。
數據準備:
樣本大小 。
樣本數據:。
步驟 1:計算樣本平均數
。
步驟 2:計算樣本變異數 (用於 (a) 未知)
首先計算平方和 :
總和 。
樣本變異數 。
(a) 未知時,建構 95% 信賴區間
步驟 3:確定 分配的臨界值
信賴水準為 ,所以 。
自由度為 。
我們需要 和 。
查 分配表:
步驟 4:計算信賴區間
第 8 題
The Avocado Price dataset from Kaggle and the Hass Avocado Board website comprises 18,249 observations. It includes several key variables: volume (total sales volume; Y), price (X1), date, type, season, year, region (Atlanta, Boston, San Diego, ...), and so on. In the current data analysis, we ignore the time information, limit our dataset to Boston and San Diego (338 observations in total), and conduct the following linear regression analysis.
Model 1:
Model 2:
Model 3:
As the first step, we consider a simple linear regression, Model 1, on the 338 observations, and the results is given in the following tables.
| Source of Variation | Sum of Squares | Degree of Freedom | Mean Square | F |
|---|---|---|---|---|
| Regression | 623,173 | 1 | (A2) | (A5) |
| Error | 3,319,382 | 336 | (A3) | |
| Total | (A1) | 337 | (A4) |
| Predictor | Coef | SE Coef |
|---|---|---|
| Constant | 732.36 | 24.90 |
| price | -163.18 | 20.55 |
(a) (7%) If the model is fitted directly without preliminary exploratory data analysis, such as scatter plots, it yields the unsatisfactory . The investigation of the scatter plot, given below, of Y versus X1 for Boston (marked as circle) and San Diego (marked as cross) suggests us to extend Model 1 to improve the . Please suggest one reasonable extended model, as the extension of Model 1, and clearly define every notation or variable that you use. Also, provide the reason for the extension.
🖼️【此處有附圖,請對照原卷】
(b) (7%) Consider the above Model 2, and suppose that is some other variable in the dataset. Is it possible that the under Model 1 and Model 2 take on identical values? Explain.
(c) (6%) Model 3 includes three additional predictors, , and , which are associated with Y. Conduct a global test of hypothesis to determine whether any of the regression coefficients under Model 3 are not zero. Use a level of significance. The answers should include the followings. Specify your null and alternative hypotheses. What is your conclusion about the test? What is the implication/interpretation about the conclusion of the F test? (The critical value for the global test is 2.39877.)
登入後即可作答並保存紀錄。
此題為一綜合題,涵蓋了迴歸分析中的模型擴充、 的判斷以及複迴歸的聯合檢定。
核心觀念:
- 迴歸分析的基本概念: 包含總變異量 (SST)、迴歸變異量 (SSR)、殘差變異量 (SSE) 及其關係:。
- (判定係數): 。它衡量模型解釋了應變數總變異的比例。
- 模型擴充的理由: 當初步分析顯示模型不佳(如 低、殘差圖顯示模式)時,可以考慮加入其他潛在變數或變數的轉換(如多項式項、交互項、類別變數的虛擬變數)來改善模型。
- 複迴歸的聯合檢定 (Global Test): 用於檢定所有迴歸係數(不含截距項)是否同時為零。使用 F 檢定。
- F 檢定的統計量: ,其中 是自變數的個數。
數據整理與計算 (Model 1)
由 ANOVA 表格:
(總觀測數)
(Model 1 中自變數 的個數)
Regression Sum of Squares (SSR) = 623,173
Error Sum of Squares (SSE) = 3,319,382
Total Sum of Squares (SST) = A1 = SSR + SSE = 623,173 + 3,319,382 = 3,942,555
Degree of Freedom for Regression (dfR) = 1
Degree of Freedom for Error (dfE) = 336
Degree of Freedom for Total (dfT) = 337
Mean Square Regression (MSR) = A2 = SSR / dfR = 623,173 / 1 = 623,173
Mean Square Error (MSE) = A3 = SSE / dfE = 3,319,382 / 336 ≈ 9879.113
F statistic (A5) = MSR / MSE = 623,173 / 9879.113 ≈ 63.077
或者
從 Predictor 表格:
截距 (Constant) 的係數
(price) 的係數
的標準誤 SE() = 20.55
(a) 模型擴充建議
問題分析:
散佈圖顯示 (volume) 對 (price) 的關係,對於 Boston (圓圈) 和 San Diego (叉叉) 兩個地區,似乎並非單純的線性關係。
- 非線性關係: 數據點似乎呈現一種「U」型或「倒U」型的趨勢,尤其是在較低的價格範圍,隨著價格上升,銷量先下降,但到某個點後,銷量又開始上升,或者存在一個價格區間,銷量相對較高。這暗示了平方項 () 可能是一個有用的加入項。
- 地區差異: 散佈圖顯示 Boston 和 San Diego 的數據點有明顯的分佈差異。Boston 的點(圓圈)似乎集中在較低的價格和中等的銷量範圍,而 San Diego 的點(叉叉)則在較高的價格範圍有較多的觀測,並且銷量也有較高的情況。這暗示了地區變數可能對銷量有顯著影響,需要引入地區的虛擬變數 (dummy variables)。
建議的擴充模型:
基於上述觀察,一個合理的擴充模型可以包含價格的平方項以及地區的虛擬變數。
模型建議:
變數定義:
- : 總銷售量 (volume)。
- : 價格 (price)。
- : 價格的平方項,用以捕捉價格與銷量之間可能的非線性關係。
- : 一個地區的虛擬變數 (dummy variable)。由於我們有兩個地區 (Boston 和 San Diego),我們可以設立一個虛擬變數。例如:
- if the region is San Diego
- if the region is Boston
(這裡我們選擇 Boston 作為參考組)。
- : 截距項。
- : 價格 的係數(當 ,即 Boston 時)。
- : 價格平方項 的係數。
- : 地區虛擬變數 的係數。它代表了 San Diego 相對於 Boston 的價格效應變動。
- : 殘差項。
理由:
- 捕捉非線性: 加入 項可以捕捉價格與銷量之間可能存在的曲線關係,例如 U 型或倒 U 型的關係,這比單純的線性關係更符合散佈圖的視覺觀察。
- 考慮地區效應: 加入地區虛擬變數 可以讓模型考慮到不同地區(Boston 與 San Diego)的銷售行為可能存在系統性差異。例如,San Diego 的消費者可能對價格的反應不同,或者有其他未被模型包含但與地區相關的因素影響銷量。 的存在允許模型為 San Diego 的銷售量建立一個與 Boston 不同的基線水平,或者影響價格係數的效應。
其他可能的擴充:
- 交互項: 也可以考慮價格與地區的交互項,例如 。這將允許價格對銷量的影響在不同地區有所不同。
模型會變成:。
這個模型更為完整,因為它允許價格的線性效應 (由 和 控制) 以及價格的平方效應 (由 控制) 都可能因地區而異。
(在此題中,只需建議一個合理的模型,上述包含 和 的模型是足夠的。)
【答案】
建議模型:
變數定義:
: 總銷售量 (volume)。
: 價格 (price)。
: 價格的平方項。
: 地區虛擬變數,若地區為 San Diego,;若地區為 Boston,。
: 殘差項。
理由:散佈圖顯示 Y 對 的關係可能存在非線性(U型或倒U型),故加入 ;同時,Boston 和 San Diego 的數據點分佈有明顯差異,顯示地區效應顯著,故加入地區虛擬變數 來捕捉此差異。
(b) Model 1 與 Model 2 的 值是否可能相同?
問題分析:
Model 1:
Model 2:
Model 2 在 Model 1 的基礎上加入了一個新的自變數 。
的定義是 。
是殘差平方和,代表模型未能解釋的變異量。
是總平方和,代表應變數 的總變異量。
判斷:可能相同,但只有在 對 沒有任何解釋力時。
解釋:
- 當我們加入一個新的自變數到迴歸模型中時,殘差平方和 (SSE) 永遠不會增加,只會保持不變或減少。
- 的公式是 。
第 9 題
Time Series Analysis focuses on the values of a subject over time or certain space. For example, we may be interested in the five-year historical daily stock closing prices (股票收盤價) of a given company. A sequence of random variables is used to denote the values at time points (suppose that we have regular time points).
In order to measure the covariance between different time points, a so-called autocovariance function (ACF) at time point and , for , is defined and considered:
where . Since we simply obtain one realization of time series in real data, some stationary assumption is necessary for real data analysis. The following is the definition of a weakly stationary process:
(i) is constant and does not depend on time ;
(ii) the ACF depends on and only through their difference .
The computation of the sample ACF is a crucial step before fitting some time series models. Sample ACF:
where is the sample mean.
Please answer Questions (a) to (d).
(a) (5%) Consider the time series , where and are known constants and is a sequence of i.i.d. random variables with mean and variance . Determine whether is weakly stationary.
(b) (5%) Derive the ACF for the following process
where and are parameters, and is a sequence of i.i.d. random variables with mean and variance .
(c) (8%) Suppose that we have one observed time series of length , denoted by , and the value of and are missing. That is, what we observed: . In order to compute the sample ACF for this dataset which is with missing data, a student suggested to directly ignore what was missing and join what were observed. In other words, let , and the student computed sample ACF on the series for the sample ACF of . Please comment on the approach for missing data by the student. (Is it appropriate, or are there some drawbacks? Explain.)
(d) (7%) Please suggest an alternative approach to handling the missing data in (c) when computing the sample ACF, and explain its advantages.
登入後即可作答並保存紀錄。
此題為時間序列分析的綜合題,涵蓋了弱定常性判斷、自共變異數函數 (ACF) 推導、以及處理缺失值的方法。
核心觀念:
- 弱定常性 (Weak Stationarity): 一個時間序列若滿足:(i) 平均數不隨時間改變 ( 為常數),(ii) 自共變異數 僅取決於時間差 ,則稱之為弱定常。
- 自共變異數函數 (ACF): 衡量時間序列在不同時間點上的協變異程度,對於定常過程,通常定義為 。
- 樣本 ACF: 用於估計真實 ACF 的統計量。
- 缺失值處理: 在時間序列分析中,缺失值會影響 ACF 的計算,需要妥善處理。常見方法包括刪除觀測值、插補法等。
(a) 判斷 是否為弱定常
步驟 1:檢查平均數是否為常數
由於 和 是常數,且 ,
。
因為 包含時間項 ,它不是一個常數,而是隨時間 變化的。
根據弱定常性的定義 (i),平均數必須是常數。此序列的平均數隨時間改變。
結論: 不是弱定常過程。
【答案】 不是弱定常過程。因為其平均數 隨時間 改變,不滿足弱定常性的第一個條件。
(b) 推導 的 ACF
核心觀念:
- MA(2) 模型 (Moving Average of order 2)。
- 自共變異數 。
- 。
- 由於 是 i.i.d. 且 ,則 if , and 。
步驟 1:計算平均數
由於 對於所有 。
。
平均數為 0,是一個常數。
步驟 2:計算自共變異數
我們需要計算 的情況,因為模型中最多有 。
情況 h=0:計算變異數
由於 是獨立的,
。
所以,。
情況 h=1:計算
展開後,由於 之間互相獨立,只有當索引相同時,協變異數才不為零。
(其他項的 索引不同)
。
所以,。
情況 h=2:計算
。
所以,。
情況 h > 2:計算 for
由於 ,則 。所以 中的 項的索引 ( ) 和 中的 項的索引 ( ) 之間,沒有相同的索引。
因此,所有的協變異數項都是零。
for 。
ACF 的定義:
ACF 結果:
for
【答案】
自共變異數函數 (ACF) 如下:
for 。
(c) 關於學生處理缺失值方法的評論
學生方法: 直接刪除缺失值,並將剩餘的觀測值視為一個連續的序列來計算樣本 ACF。
原始序列長度 。
缺失值:。