Hypothesis testing 假設檢定

Slides:



Advertisements
Similar presentations
20-Opening 統計學 授課教師:楊維寧 10Simple-R-Commands.
Advertisements

單元九:單因子變異數分析.
人群健康研究的统计方法 预防医学系 指导教师:方亚 电话:
如何定义和确定参考区间 郭健 卫生部北京医院.
應用統計理論 編著:劉正夫教授 Reference:1) Wonnacott and Wonnacott. Introductory
假設檢定之基本概念 單一母體平均數之假設檢定 假設檢定與信賴區間之相關性 兩母體平均數之假設檢定  
第 10 章 單組樣本的假設檢定.
第 9 章 假設檢定 Part A ( ).
17 類別資料的分析  學習目的.
第六章 假设检验的基本概念.
第四章 數列與級數 4-1 等差數列與級數 4-2 等比數列與級數 4-3 無窮等比級數 下一頁 總目錄.
估計.
Chapter 8 Liner Regression and Correlation 第八章 直线回归和相关
假設檢定.
Population proportion and sample proportion
型II誤差機率的計算 Calculating Type II Error Probabilities
Sampling Theory and Some Important Sampling Distributions
模式识别 Pattern Recognition
一元线性回归(二).
What are samples?. Chapter 6 Introduction to Inferential Statistics Sampling and Sampling Designs.
第十章 兩母體之假設檢定 Inferences Based on Two-Samples:
One-Sample Tests of Hypothesis
本章大綱 9.1 Sequence數列 9.2 Infinite Series無窮級數
Continuous Probability Distributions
Properties of Continuous probability distributions
Sampling Theory and Some Important Sampling Distributions
十一、簡單相關與簡單直線回歸分析(Simple Correlations and Simple Linear Regression )
4B冊 認識公倍數和最小公倍數 公倍數和最小公倍數的關係.
教材 P.264 Point Estimation To estimate the value of a population parameter, we compute a corresponding characteristic of the sample, referred to as a sample.
11.1單一母體變異數的推論 前幾章中,我們以樣本變異數
Inferences Based on a Single Sample: Tests of Hypothesis Chapter 9
估計(estimation) 莊文忠 副教授 世新大學行政管理學系 計量分析一(莊文忠副教授) 2018/12/27.
Interval Estimation區間估計
第一章.
统 计 学 (第三版) 2008 作者 贾俊平 统计学.
七. 假說檢定Ⅰ (Hypothesis Testing Ⅰ) (Chapter 7)
第 9 章 假設檢定 Part B ( ).
Workshop on Statistical Analysis
Chapter 2 Basic Concepts in Graph Theory
Chap 9 Testing Hypotheses and Assessing Goodness of Fit
統計學 指導老師: 郭燿禎 Date: 2/14/12.
Introduction to Basic Statistics
抽樣分配 Sampling Distributions
相關統計觀念復習 Review II.
第 7 章 推論方法.
估計與假設檢定.
第八章 假設之檢定與信賴區間 陳順宇 教授 成功大學統計系.
Introduction to Basic Statistics
第七章 假設檢定.
第五章 估計與信賴區間 5.1 估計概論 估計量的分配 信賴度、信賴區間與最大容忍誤差16
The Bernoulli Distribution
Some Important Probability Distributions
Review of Statistics.
Introduction to Basic Statistics
Review of Statistics.
Parameter Estimation and Statistical Inference
楊志強 博士 國立台北教育大學系 教育統計學 楊志強 博士 國立台北教育大學系
名词从句(2).
二項分配-Binomial 伯努利試驗(Bernoulli Trial) 每一次試驗皆僅有兩種可能結果,不是成功(S),就是失敗(F)。
Introduction to Basic Statistics
品質管理與實習 : MIL-STD-105E 何正斌 國立屏東科技大學工業管理學系.
參考書籍:林惠玲與陳正倉(2002),《應用統計學第二版》。台北:雙葉書廊有限公司。
第七章 计量资料的统计分析.
假說檢定程序 3.1 定義 3.2 假說檢定程序 3.3 檢定的種類與方法 3.4 統計檢定精神 個案:假說建立
簡單迴歸分析與相關分析 莊文忠 副教授 世新大學行政管理學系 計量分析一(莊文忠副教授) 2019/8/3.
抽樣分配.
17.1 相關係數 判定係數:迴歸平方和除以總平方和 相關係數 判定係數:迴歸平方和除以總平方和.
Gaussian Process Ruohua Shi Meeting
Presentation transcript:

Hypothesis testing 假設檢定 觀念 對於母體參數(parameter)的推估可以透過以下兩種方式: 先估計參數的估計值,然後建構出信賴區間。 假設檢定: 先給予母體未知數一個假設值,再利用樣本或實驗結果來推斷此假設的可信度。 社會統計(上) ©蘇國賢2007

Hypothesis testing 假設檢定 觀念 假設檢定 假設:從於一小撮觀察到的樣本中,提出的對於更一個大族群(母體)的某些性質的陳述、臆測、推論。 檢定:這種從觀察到的樣本所得出的推論是否合理。 社會統計(上) ©蘇國賢2007

Hypothesis testing 假設檢定 觀念 檢定的假設: “台灣人民的平均教育年數為12年” “社會系男生的統計成績優於女生” “贊成一國兩制的人不會超過百分之五” 社會統計(上) ©蘇國賢2007

Hypothesis testing 假設檢定的原理 觀念 假設檢定的基本原理: 將”實際”觀察到的(observed)樣本,與假設為真的條件下,”期望觀察到的”(expected)做比較。 所謂”期望”是指如果母體的陳述為真,則我們期望在樣本中觀察到…. 社會統計(上) ©蘇國賢2007

Hypothesis testing 假設檢定的步驟 觀念 (1) 將我們對於母體的臆測寫成假設陳述。 (2) 如果假設為真,則我們期望觀察到世界為… (3) 檢查我們實際觀察到的世界,與在假設為真的情況下,我們期望觀察到的世界是否吻合。 社會統計(上) ©蘇國賢2007

Hypothesis testing 假設檢定 觀念 母體參數(parameter)為一個描述母體性質的數量值。 假設為關於母體參數有可能的數值的陳述(a statement about the value or set of values that a parameter or group of parameters can take.) 社會統計(上) ©蘇國賢2007

The null hypothesis H0 and the alternative hypothesis Ha 觀念 The null hypothesis (虛無假設)is an assumption concerning the value of the population parameter being studied. 對於母體參數值的假定。 The alternative hypothesis (對立假設)specifies an alternative set of possible values of the population parameter that are not specified in the null hypothesis. 不包含在虛無假設中的母體參數的可能值。 The two hypotheses are mutually exclusive.這兩種假設為互斥。 社會統計(上) ©蘇國賢2007

The null hypothesis H0 and the alternative hypothesis H1 觀念 Simple hypothesis簡單假設:在統計假設之中只為一個數值之假設,如: Composite hypothesis複合假設:在統計假設之中,其假設不只包含一個數值,而是一些數值的集合體,如: 社會統計(上) ©蘇國賢2007

Null hypothesis about a population proportion 例題 環保局宣稱20%的汽車的排氣設備被動過手腳。欲檢定這個假設,請寫出虛無假設: 虛無假設為對母體比率的一個描述,除非我們有充分的證據顯示虛無假設為偽,我們暫且假設它所描述的母體性質為真。 請寫出前例的相對假設: One-sided alternative hypothesis 社會統計(上) ©蘇國賢2007

One sided alternative hypothesis 例題 消基會想要知道某廠牌的洗衣粉是否如同其包裝盒上所標示的至少5公斤重,寫出虛無假設及相對假設: One-sided alternative hypothesis 社會統計(上) ©蘇國賢2007

Two-sided alternative hypothesis 例題 某公司購買新型的抽水機,想知道與標準型有沒有差異。舊型抽水機每小時可抽5000加崙的水。虛無假設為: 對立假設為: Two-sided alternative hypothesis 社會統計(上) ©蘇國賢2007

常用的假設 例題 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? (1)In many statistical applications, the null hypothesis should correspond to the assumption that no change occurs when some new process or technique is tried. 新的過程或技術沒有造成任何改變的假設。(如之前的抽水機例子) 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? (2) Some statisticians argue that the null hypothesis should be the hypothesis that the decision maker wants to disprove. 希望被決策者否定的假設稱為虛無假設。 That is, the null hypothesis should specify the values of the population parameter that the researcher thinks does not represent the true value(s) of the parameter; the alternative hypothesis then specifies the values of the parameter that the researcher believes do hold. 虛無假設中所假設的母體參數值為研究者認為不對的母體參數值。 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? (3) another common practice is to assign no special meaning to either the null or the alternative hypothesis, but to let these hypotheses merely represent two different assumptions about the population parameter.不特別去區分虛無假設及對立假設的意義,讓兩者各自代表母體參數的一個可能值。 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? 例題 消基會接獲很多消費者的抱怨,想調查超市中五磅的碎牛肉是否不夠重量。虛無及對立假設為: 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? 例題 市政府所用的紅綠燈平均壽命為2000小時,一家新的製造商宣稱他們的產品比原來的壽命要長,且價格相同。市府想要測試新燈泡的壽命是否超過2000小時,虛無假設為: 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? 例題 一家公司的產品為30%的消費者所採用(p=.30),公司在某些區域測試新推出的廣告是否增加銷售,其虛無假設為: 社會統計(上) ©蘇國賢2007

Which hypothesis is the null hypothesis? 例題 汽車車門的油漆平均五年會開始脫落,某科學家宣稱新的油漆壽命比較長,汽車公司想測試新油漆的壽命: 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and Ha 觀念 The null hypothesis has the status of a maintained hypothesis that will not be rejected because it is assumed to be true unless the sample data provide strong contrary evidence. 由於我們只有在證據很充分的情況下才能推翻虛無假設,因此虛無假設比對立假設佔據更有利的地位,假設的寫法對於結果有很大影響。 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and Ha 觀念 Food and Drug Administration (FDA )在核准新藥上市中,面臨以下兩個可能的結果: 一、新藥對於大眾有益。 二、新藥對於大眾無益處。 兩者都可以被選為null hypothesis 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and H1 觀念 FDA 選擇以下的方式: H0: 新藥對於大眾沒有益處不應該上市。 Ha:新藥對於大眾有益處。 此時藥廠必須舉證推翻H0,否則FDA不會核准新藥上市。 由於這種假設方式,美國的新藥上市過程十分冗長,但好處為有害藥物要上市十分困難。 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and H1 觀念 如果FDA 選擇以下列的方式來核准新藥: H0:新藥對於大眾有益處且應上市。 Ha:新藥對於大眾沒有益處不應該上市。 此時除非有強而有力的證據顯示藥物無效或有害,否則暫且假定此藥為有益處的。 這種方式可以使新藥快速上市,但風險也很高。 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and Ha 觀念 在假設檢定中,我們希望能夠得到下列機率: P(theory is true|observed data)即給定目前觀察到的樣本資料,理論為真的條件機率為何? 但實際上,我們計算的條件機率為: P(observed data|theory is true)即在假設理論為真的前提下,觀察到目前樣本資料的機率為何? 社會統計(上) ©蘇國賢2007

Consequences of choosing H0 and Ha 觀念 假設檢定的邏輯: 如果理論為真,則樣本資料應比較有可能呈現…比較不可能為…。 若觀察到與理論一致的樣本(較有可能發生的樣本),則暫且假定理論為真。 若觀察到樣本在理論為真的假設下不太可能發生,則推翻理論。 社會統計(上) ©蘇國賢2007

Decision rules 根據樣本所提供的資訊,我們面臨兩種可能的決定: 觀念 根據樣本所提供的資訊,我們面臨兩種可能的決定: 一、拒絕接受null hypothesis (rejecting H0) 二、無法推翻null hypothesis (not rejecting H0) 有時候統計學者會說接受accepted null hypothesis,不過較為正確的說法應該是無法拒絕或無法推翻H0。 社會統計(上) ©蘇國賢2007

Decision rules 推翻null hypothesis的決策法則: 觀念 推翻null hypothesis的決策法則: 我們根據檢定統計量(test statistics)來決定是否推翻虛無假設,如樣本平均數、樣本比率、Z 或t值等。 Test statistic: a test statistic is a random variable whose value is used to determine whether we reject the null hypothesis. 社會統計(上) ©蘇國賢2007

Decision rules 觀念 Decision rule: The decision rule specifies the set of values of the test statistic for which the null hypothesis H0 is rejected in favor of Ha and the set of values for which H0 is accepted (i.e., not rejected). 假設檢定中的決策法則為決定推翻或無法推翻假設的檢定統計量的範圍值。 社會統計(上) ©蘇國賢2007

例題 生產猶太鹹餅的工廠想要確認所生產的餅乾平均重量為每包454g。假設每包重量為常態分佈,母體的標準差為7.8g,抽檢25包餅乾得到數據實際數據。 (a) 寫出null and alternative hypotheses H0: u0 = 454g vs. Ha: u0 ≠454g 社會統計(上) ©蘇國賢2007

例題 (b) Discuss the logic behind carrying out the hypothesis test 如果虛擬假設為真,則理論上25包樣本的平均重量應該很接近母體平均竹454g,如果實際上這25包抽檢的樣本平均重量「太偏離」454g,則我們傾向推翻對於母體平均值的假設。我們可以利用對於樣本平均數的抽樣分配知識來決定多大的差異才算是「太偏離」 社會統計(上) ©蘇國賢2007

例題 (c) 找出25包樣本所得到的樣本平均數的抽樣分配 n=25, σ=7.8 σ=1.56 u0 社會統計(上) ©蘇國賢2007

例題 (d) 寫出假設檢定的決策法則 95.44%的所有n=25的樣本中,樣本平均值會介於以μ為中心,向左右延伸正負兩個標準差(1.56×2=3.12)所構成的區間中 社會統計(上) ©蘇國賢2007

Rejection Region and Nonrejection Region 觀念 根據決策法則我們可以將檢定統計量分成窮盡及互斥的兩組數值區域: The rejection region (拒絕域)of a test, also called the critical region(棄卻域), consists of all values of the test statistic for which H0 is rejected. The nonrejection region consists of all values of the test statistic for which H0 is not rejected. 社會統計(上) ©蘇國賢2007

Critical Value臨界點 觀念 The critical value of the test statistic is the value that separates the critical region from the norejection region. 區分拒絕域及不拒絕域的界線。 A one-sided alternative hypothesis has one critical value, whereas a two-sided alternative hypothesis has two. 社會統計(上) ©蘇國賢2007

Implications of rejecting or accepting the null hypothesis 觀念 當檢定統計量落在拒絕域(rejection region)內,不代表我們證明(prove)虛無假設為錯誤的。只能說我們對於虛無假設所陳述的內容真實性有很大的懷疑--虛無假設不是不正確,就是極不可能發生。 同理,當檢定統計量落在非拒絕域中,並不是證明(prove)虛無假設為真,僅是表示證據不足以推翻我們目前所提出的假設。或者說目前的證據與我們的理論頗為一致。 社會統計(上) ©蘇國賢2007

Implications of rejecting or accepting the null hypothesis 觀念 虛無假設在檢定前被視為是正確的,除非有充分的證據,不然我們不輕易推翻假設。通常我們選擇極小的拒絕機率如.01 或.05 ,稱為顯著水準,來確保我們不會推翻一個正確的虛無假設。 這個顯著水準,就是在建構信賴區間時,區間無法正確涵蓋母體參數的機率。 社會統計(上) ©蘇國賢2007

例題 社會統計(上) ©蘇國賢2007

例題 σ=1.56 450g 是否太過於偏離? (d) 25個樣本的實際平均重量為450g,檢定虛擬假設 H0: μ=454 社會統計(上) ©蘇國賢2007

例題 超過兩個標準差,如果虛擬假設為真,實際上抽取25包樣本計算出的平均值只有不到2.28% 的機率會等於450g ©蘇國賢2007 社會統計(上) ©蘇國賢2007

例題 社會統計(上) ©蘇國賢2007

例題 另一種想法:如果母體的平均值真的為454g,則觀察到25包樣本的平均重量小於450.88g的機率僅有2.28%,由於我們實際上觀察到的平均重量為450g,我們寧可相信虛擬假設是錯的。 社會統計(上) ©蘇國賢2007

Testing Hypothesis about a Population Mean When Variance is Known 觀念 H0: u = u0, H1: u < u0 我們以樣本的平均數X來推論母體的平均數。假設母體為常態分配,如果H0為真,則樣本平均數X~N(u0, σ2/n)。 只有當我們觀察到一個樣本平均數與u0差異很大時才會推翻H0, Reject H0 if and only if the observed sample mean x-bar is less than the critical value σ2/n Area α u0 社會統計(上) ©蘇國賢2007

Testing Hypothesis about a Population Mean When Variance is Known 觀念 如果H0為真,則樣本平均數落在critical value 之下的機率為: σ2/n Area α u0 我們刻意選擇x*這一點使顯著水準為α,也就是說,我們將檢定犯下誤謬的機率設定於我們事先決定好的α。 社會統計(上) ©蘇國賢2007

The critical value 將樣本平均值轉成z-score σ2/n Area α u0 1 Area α 觀念 ©蘇國賢2007 社會統計(上) ©蘇國賢2007

The critical value 觀念 如果H0為真, 1 Area α 社會統計(上) ©蘇國賢2007

The critical value 欲檢證 H0: u = u0 vs. H1: u < u0 則critical value : 觀念 欲檢證 H0: u = u0 vs. H1: u < u0 則critical value : 1 Area α σ2/n Area α u0 社會統計(上) ©蘇國賢2007

檢定常態分配母體的平均值,且母體變異數已知 觀念 (1) 寫出 H0 和 Ha (2) 決定顯著水準α(一般為5%, 1%, 10%) (3) 查表找出在顯著水準為α下的critical value 單尾 –zα 雙尾 –zα/2 (4) 取得n樣本並計算樣本平均數x 社會統計(上) ©蘇國賢2007

檢定常態分配母體的平均值,且母體變異數已知 觀念 (5) 將觀察到的樣本平均數轉成observed z-score 如果z<-zα Reject H0 或找出-zα所對應的臨界點 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 某公司生產鑽油井用的鑽頭,宣稱其平均壽命為32呎,變異數為16呎。有客戶認為該公司誇大,抽取25支樣本來做檢證,得樣本平均數為29.5 (方法一)(1) H0: u = 32 vs. H1: u < 32 (2) α=.05 (3) -zα = -z.05 = -1.645 1 reject 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 某公司生產鑽油井用的鑽頭,宣稱其平均壽命為32呎,變異數為16呎。有客戶認為該公司誇大,抽取25支樣本來做檢證,得樣本平均數為29.5 (方法二)(1) H0: u = 32 vs. H1: u < 32 (2) α=.05 4 32 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 前例中我們拒絕H0: u = 32 並不是證明真正的母體平均數一定小於32,如果H0為真,則我們抽取25個樣本計算樣本平均數得到29.5這個平均值的機率小於0.05。換句話說,如果u=32,則在所有可能的樣本平均數中,僅有不到5%的樣本會得到小於-1.645的z-score。 社會統計(上) ©蘇國賢2007

Testing a Composite Null Hypothesis 觀念 教師工會罷工,宣稱老師的平均薪資$25000,但議會認為高於$25000。議員不想在證據不夠充分之下駁斥工會的看法,因此將顯著水準設於1%: H0: u$25,000 vs. H1:u>$25,000 假設薪資為常態分配,且母體標準差為=$4,000。取得100個老師薪資的隨機樣本,得樣本平均數為$27,000。檢定上述的假設。 社會統計(上) ©蘇國賢2007

Testing a Composite Null Hypothesis 觀念 在顯著水準為=.01,critical value Z=Z.01=2.33. 2.33 Reject the null hypothesis 社會統計(上) ©蘇國賢2007

雙尾檢定A two-tailed test of the population mean 觀念 H0: u = u0 vs. H1: u  u0 如果觀察到的樣本平均數遠高於或遠低於u0則皆可拒絕H0 Reject H0 if z<-z/2 or if z>z/2 1- Reject H0 if /2 /2 Acceptance region 社會統計(上) ©蘇國賢2007

A two-tailed test of the population mean 觀念 雙尾檢定最常用的顯著水準為10%, 5%, 1%,其相對應的critical z-score為: 1- /2 /2 Acceptance region 社會統計(上) ©蘇國賢2007

A two-tailed test of a mean of a normal population with known variance 例題 國會議員經常出國考察,某報紙媒體宣稱這類的考察平均每日花費$300,標準差=$50。抽取25名國會議員得到樣本平均數為$260,在5%的顯著水準,報紙媒體的宣稱合不合理? H0: u=300 H1: u300 1- /2=.25 /2 Acceptance region 1.96 -1.96 社會統計(上) ©蘇國賢2007

A two-tailed test of a mean of a normal population with known variance 例題 求上例中的樣本平均數的critical value? 1- /2=.025 由於實際觀察到的樣本平均數260遠低於280.4的臨界點,我們可以推翻虛擬假設 300 /2 Acceptance region 319.6 280.4 社會統計(上) ©蘇國賢2007

Statistical significance vs. practical significance 觀念 欲檢證城鄉婦女的語言能力是否真的有差異?某語言能力測驗共測驗200個單字,答對一題2分,部分答對給1分,假設從過去的資料得知城市婦女的平均分數為u=148,=10,今取6400個鄉村婦女做為樣本,得平均分數為147,請問城鄉婦女的語言能力是否有別? H0: u=148, H1: u<148 社會統計(上) ©蘇國賢2007

Statistical significance vs. practical significance 觀念 雖然證據顯示城鄉婦女的語言能力的確有的差異,但假設其差異僅有1分,在實際上這個差距並不大。 假設檢定的z值公式中,樣本數愈大,z值會愈大,即愈有可能拒絕H0。即使樣本平均數與母體平均數的差異很小,也有可能因為n過大而拒絕H0 Statistical significance does not necessarily imply practical significance! 社會統計(上) ©蘇國賢2007

Decision rules 觀念 統計檢定有點像法院中的陪審團在審理案件(虛無假設受到審判),在樣本資料還沒有充分證據顯示「有罪」之前,我們暫且假定虛無假設為真。 在法院的審判中有兩種可能的錯誤:無罪的人被誤判為有罪,有罪的人被無罪釋放。 正如同法院的審判,檢定有兩種犯錯的可能:null hypothesis在正確的情況下被推翻(type I error)及null hypothesis不正確但沒有被拒絕(type II error)。 社會統計(上) ©蘇國賢2007

Type I and Type II Errors 觀念 用樣本資料去推論母體未知參數時,由於抽樣的偏差,可能產生推論的誤謬。 社會統計(上) ©蘇國賢2007

Type I and Type II Errors 觀念 型I誤差:當H0為真,但檢定結果拒絕H0。 型II誤差:當H0不真,但檢定結果不拒絕H0。 社會統計(上) ©蘇國賢2007

Level of Significance (α risk) 觀念 顯著水準:type I error發生的最大機率值。 The level of significance of a test is the probability that the test statistic falls in the critical region given that H0 is true. The level of significance is denoted by the symbol α 社會統計(上) ©蘇國賢2007

Level of Significance (α risk) 觀念 1-α就是建構信賴區間時的信賴水準C 社會統計(上) ©蘇國賢2007

Probability of a Type II Error (βrisk) 觀念 β 風險:type II error發生的最大機率值。 The probability of making a Type II error is the probability that the test statistic falls in the acceptance region when the null hypothesis is false, denoted by β 社會統計(上) ©蘇國賢2007

Probability of a Type II Error (βrisk) 觀念 1-β代表「H0為假」的條件下,採取正確「拒絕H0」之正確決策的機率。即從事假設檢定時,能夠正確的辨識「H0虛無假設為假」的能力(Power)。統計上我們稱1-β為檢定能力(power of the test)。 社會統計(上) ©蘇國賢2007

Example of a Type I Error 例題 USA Today報導在美國非法賭博的金額至少平均每人每年$200,妳覺得這個數字太過於誇張,因此找了n個人的樣本來估計每年非法賭博的平均金額。妳想要檢定的虛無假設為: H0:μ≧$200 對立假設為 H1:μ<$200 假設真正的母體平均數為$200,如果妳估計的樣本平均遠低於$200,導致妳會推翻正確的假設,則犯下型I誤謬。 社會統計(上) ©蘇國賢2007

Example of a Type II Error 例題 如果實際非法賭博的金額遠低於$200,即H0並不正確,但妳運氣欠佳,找到的樣本中估計的平均值十分接近200,則妳應該推翻H0但資料卻不足以推翻錯誤的假設,此時妳犯了型II的誤謬。 這兩種錯誤都與抽樣時運氣不佳有關係。 社會統計(上) ©蘇國賢2007

例題 在母體為常態分配N(u, 2)的假設下,回答下列問題: 單邊檢定 H0: uu0 H1: u>u0 若u=24,根據上述的決策規則,犯下type I error 的機率為何? 若u=25,根據上述的決策規則,犯下type I error 的機率為何? 若u=29,根據上述的決策規則,犯下type II error 的機率為何? 社會統計(上) ©蘇國賢2007

例題 若u=24,根據上述的決策規則,犯下type I error 的機率為何? 若u=29,根據上述的決策規則,犯下type II error 的機率為何? 社會統計(上) ©蘇國賢2007

例題 例題 u0 u=29 不真 社會統計(上) ©蘇國賢2007

例題 如果u=30, Type II error 的機率會…? u0 u=30 不真 犯type II error的機率與真正的參數值距離虛擬假設的u0多遠有關,差異越大,type II error 的機率越小 社會統計(上) ©蘇國賢2007

例題 如果將α設在0.01 而非0.05,type II error 的機率會…? u0 u=29 Type I error 與Type II error有替代關係,α值越小,越容易犯 type II error 不真 Critical value 向右移動 社會統計(上) ©蘇國賢2007

例題 A sample size of n=100 has been drawn from a population whose variance is 2250 in order to test the following: H0: u=1000, H1: u1000 It is decided to reject H0 if Find the probability of type I error Find the probability of a type II error if u=1005 社會統計(上) ©蘇國賢2007

例題 Find the probability of a type II error if u=1005 社會統計(上) ©蘇國賢2007

例題 某甲懷疑特定銅板兩側不對稱,以計算丟擲銅板出現人頭面朝上次數的方式進行實驗。假設某甲能忍受有5%的機會該銅板兩側對稱卻被誤判為不對稱,請問某甲至少要丟幾次才能宣稱該銅板兩側不對稱? 社會統計(上) ©蘇國賢2007

至少要丟五次銅板,才有可能出現小於0.05的機率 令S = 成功的次數, X = 丟銅板次數 假設銅板為對稱,最小機率會出現在 S=0 或 S = X,若銅板為對稱,但不小心拒絕H0的機率為:P(S=0) = P(S=X) < 0.05 至少要丟五次銅板,才有可能出現小於0.05的機率 社會統計(上) ©蘇國賢2007

當實驗次數 < 5時,最小的機率都超過0.05,因此無法在α=0.05的水準之下推翻虛擬假設(看下表) 二項分配的機率分配 實驗次數 S X=2 X=3 X=4 X=5 成功次數 0.2500 0.1250 0.0625 0.0313 1 0.5000 0.3750 0.1563 2 0.3125 3 4 5 社會統計(上) ©蘇國賢2007

例題 呈上題,假設該銅板由於磨損的原因被丟擲時有80%的機會人頭會朝上,而某甲一共丟擲該銅板8次,請問某甲有多少機會拒絕該銅板兩側對稱的假設? 社會統計(上) ©蘇國賢2007

例題 若虛擬假設H0 : p0 = 0.5 則假設虛擬假設為真之下,實驗8次的二項機率分配為: Reject H0 if P(S<2) or P(S>7) 當成功次數小於2次或成功次數超過6次時,我們會拒絕虛擬假設H0 當真的成功機率ptrue=0.8時,觀察到P(S<2) or P(S>7)的機率為何? P(S <2 or S> 7 | ptrue = 0.8) = P(S=0) + P(S=1) +P(S=7) + P(S=8) 成功次數 機率 0.00390625 1 0.03125000 2 0.10937500 3 0.21875000 4 0.27343750 5 6 7 8 社會統計(上) ©蘇國賢2007

P-Value: Interpretation and Use 在假設檢定中,我們通常會事先決定顯著水準α,然後根據決定之後的α值找出拒絕域及接受域。但在很多的情況下,我們無法預估type I 誤謬及type II誤謬的成本,因此可以選擇任意的α值。所以有時候我們直接指出得到觀察統計量的機率。 複習:顯著水準α=型I誤差發生最大的機率值。 社會統計(上) ©蘇國賢2007

P-Value: Interpretation and Use The P-value of a test is the probability of obtaining a value of the test statistics as extreme as or more extreme than the observed sample value when the null hypothesis is true. P-value 告訴我們:「如果虛擬假設為真,我們觀察到目前資料顯示的檢定統計量的機率有多高?」如果這個機率很小,則我們可以拒絕虛擬假設,因為如果假設為真,則僅有很小的機率抽取任意的隨機樣本會得到目前的觀察值。 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 某公司生產鑽油井用的鑽頭,宣稱其平均壽命為32呎,變異數為16呎。有客戶認為該公司誇大,抽取25支樣本來做檢證,得樣本平均數為29.5 H0: u = 32 vs. H1: u < 32 α=.05 -zα = -z.05 = -1.645 1 reject 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 1 求p-value=? P-value = P(z < -3.125) = .0009 Z=-3.125 如果H0為真,則觀察到平均值=29.5的機率僅有.0009,表示H0不太可能為真rejected H0 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 1 Z=-3.125 將α訂在5%,則critical value = -1.645 如果將α定在1%的水準,則critical value = -2.33,我們依舊reject H0 只要是顯著水準高於.0009,我們都可以拒絕H0,也就是說,P-value是H0會被拒絕的最小值。 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 因此P-value是不僅止於告訴我們在某一顯著水準下是否拒絕H0,如果我們知道P-value = .002則我們知道H0不但在.05的顯著水準下會被拒絕,在.005的水準下也會被拒絕。 如果僅知道P-value =.04,則是否拒絕H0可以由讀者來決定,如果某一研究人員決得.01才算顯著,則H0不會被拒絕,如果將顯著水準置於.05,則拒絕。 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 It is especially useful to report a p-value when we do not have any specific reason for choosing a particular level of significance or when we have little or no information concerning the costs and consequences of committing a Type I or Type II error. 社會統計(上) ©蘇國賢2007

Testing the mean of a normal population with population variance known 例題 一般在研究報告中,研究者經常直接寫出p-value而讓讀者自己去決定是否要拒絕H0。p-value 經常被稱為是觀察到的顯著水準(the observed significant level)。可以將它看成是「在假設H0為真的情況下,觀察到目前樣本,或比此樣本更極端樣本的機率」。 A statistically significant p-value means that the observed result is difficult to explain by random chance. 社會統計(上) ©蘇國賢2007

P值的強弱 社會統計(上) ©蘇國賢2007

樣本數n愈大,p-value 值愈…? P-value 與樣本數的大小有很大的關係。當樣本數很大時,些微的差距也會讓Z變的很大,也就是說,p-value 會變得很小。 社會統計(上) ©蘇國賢2007

Testing Hypotheses About a Population Mean with Large Sample Sizes 在前面的假設檢定討論中,我們學到如何判定有關於一常態分配(normal),且變異數已知的母體平均數之虛擬假設。 這是因為我們知道如果母體為常態分配,且母體變異數為2,則樣本平均數的分佈(抽樣分配)為 ~N(u0, 2/n) 如果我們無法確切知道母體是否為常態分配,也不知道母體的變異數,則我們的假設檢定還能成立嗎? 社會統計(上) ©蘇國賢2007

Testing Hypotheses About a Population Mean with Large Sample Sizes 根據中央極限定律Central Limit Theorem,如果樣本數夠大(n>30),即使母體不是常態分配,樣本平均數X的抽樣分配也會趨近於常態分佈。 而且如果樣本數夠大,我們可以用樣本的變異數s來取代母體變異數。 社會統計(上) ©蘇國賢2007

Two-tailed test of a population mean using a large sample 某公司生產冷暖氣用的導管,導管上必須鑽許多小孔以便鎖入螺絲丁,如果鑽孔機正常運作,則鑽出的小孔平均直徑為10公釐,但變異數不知道。但如果鑽孔機運作不正常,則小孔不是過大就是太小。這家冷氣公司的老闆想要驗證某台鑽孔機是否正常運作,即H0: u=10 v.s. H1: u10 這個老闆檢視了由這台鑽孔機鑽出的100個小孔,得到平均直徑為9.6公釐,樣本變異數為s=1公釐。以5%的顯著水準來檢驗此機器是否正常? 社會統計(上) ©蘇國賢2007

Two-tailed test of a population mean using a large sample Solution:由於樣本數夠大(n=100)我們可以用一般檢定母體平均值假設的方法來進行檢證: =5%, two tailed test,  the two critical value z1= -1.96, z2=1.96 /2=.25 /2 Acceptance region Reject H0 1.96 -1.96 社會統計(上) ©蘇國賢2007

Finding the critical values of X-bar when variance is unknown 找出前例中x的critical value /2=.25 /2 Acceptance region 9.804 10.196 社會統計(上) ©蘇國賢2007

如果母體為常態分配,但母體的變異數為未知,且樣本數少於30? 改用student t分配而非用常態分配來做假設檢證。 Testing Hypothesis about the mean of a normal population with unknown variance 如果母體為常態分配,但母體的變異數為未知,且樣本數少於30? 改用student t分配而非用常態分配來做假設檢證。 社會統計(上) ©蘇國賢2007

Student’s t distribution 若母體 2未知,則以S來取代,我們得到t-score: 隨著樣本數愈大,S愈接近,t分配愈接近標準常態分配Z: 社會統計(上) ©蘇國賢2007

Characteristics of t distribution The t distribution is actually a family of distribution with a different density function corresponding to each different value of the parameter . Standard normal (d.f.=) d.f. =4 d.f. =2 d.f. =1 社會統計(上) ©蘇國賢2007

Value of t, The symbol t,denotes the value of t such that the area to its right is  and t has  degree of freedom. The value t, satisfies the equation: P(t > t, )= Where the random variable t has the t distribution with  degrees of freedom. 社會統計(上) ©蘇國賢2007

Testing Hypothesis about the mean of a normal population with unknown variance 欲檢證下列假設: H0: u = u0 or H0: u  u0 H1: u > u0 在顯著水準之下,找出critical value t, P(t > t, )= 計算t-score: 決策法則:reject H0 in favor of H1 if t > t,n-1 社會統計(上) ©蘇國賢2007

Testing Hypothesis about the mean of a normal population with unknown variance 欲檢證下列假設: H0: u = u0 or H0: u  u0 H1: u < u0 在顯著水準之下,找出critical value t, P(t > t, )= 計算t-score: 決策法則:reject H0 in favor of H1 if t < -t,n-1 社會統計(上) ©蘇國賢2007

Testing Hypothesis about the mean of a normal population with unknown variance 欲檢證下列假設: H0: u = u0 H1: u  u0 在顯著水準之下,找出critical value t/2, 計算t-score: 決策法則:reject H0 in favor of H1 if t < -t/2,n-1 or t > t/2,n-1 社會統計(上) ©蘇國賢2007

例:small-sample test of the mean of a normal population with unknown variance 某汽車製造商宣稱該公司一款低價車肇事平均修車費低於等於$200。消費者基金會認為修車費高於此數值,欲檢證下列假設: H0: u  u0 H1: u > u0 消費者基金會不願在證據不充分的條件下,隨意駁斥製造商的宣稱,因此將假設檢定的顯著水準嚴格地定在1%。因為檢證肇事修車的成本甚高,因此消基會僅找了9個樣本,發現:x1=245, x2=305, x3=175, x4=250, x5=280, x6=160, x7=250, x8=195, x9=210 社會統計(上) ©蘇國賢2007

例:small-sample test of the mean of a normal population with unknown variance 解)x1=245, x2=305, x3=175, x4=250, x5=280, x6=160, x7=250, x8=195, x9=210 計算樣本平均值: d.f. = 9-1 = 8, Critical value = t.01,8 =2.896 社會統計(上) ©蘇國賢2007

或者我們可以用t = 1.86找出其相對應的p-value 查表t分配表可知, d.f.=8 P(t > 1.86) = .05 例:small-sample test of the mean of a normal population with unknown variance 或者我們可以用t = 1.86找出其相對應的p-value 查表t分配表可知, d.f.=8 P(t > 1.86) = .05 若d.f. = 8 , t = 1.49, P(t > 1.49) = ? 若d.f. = 8 , t = 1.16, P(t > 1.16) = ? 社會統計(上) ©蘇國賢2007