重學 Statistics, Cha9 Hypothesis Tests

9.1 Developing Null and Alternative Hypotheses

Null Hypothesis H0: a tentative assumption about a population parameter such as a population mean or a population proportion.
Alternative Hypothesis Ha: the opposite of what is stated in the null hypothesis

我們想測試瓶裝可樂有沒有和標籤所說,至少67.6盎司,因此建立了以下的假設,這個假設應用於 label 是錯的,瓶子裝少了
H0: μ >= 67.6
Ha: μ < 67.6

但是當我們分別站在生產工廠和消費者的角度去思考,消費者如果拿到的真正容量少於67.6,那麼則會不滿足標準;但是多餘67.6,對工廠來說,是虧了。 於是,我們建立以下的假設:
H0: μ = 67.6
Ha: μ != 67.6

因此,這是一個 two-tailed test, 而用大於或小於的符號,是 one tailed test.

9.2 Type I and Type II Errors

這裏寫圖片描述

Level of Significance: The level of significance is the probability of making a Type I error when the null hypothesis is true as an equality.
The Greek symbol α (alpha) is used to denote the level of significance, and common choices for α are .05 and .01.
當 level of significance 大的時候,也就是所 type I error可能性很大的時候,可能是 α使用的比較大。

Because of the uncertainty associated with making a Type II error when conducting significance tests, statisticians usually recommend that we use the statement “do not reject H0”
instead of “accept H0.”

9.3 Population Mean: σ Known

One-Tailed Test

Step 1: Develop null and alternative hypotheses
Step 2: Decide μ(一般用 hypothesis裏的來做) and α
Step 3: Collect sample data and compute test statistic

Lower Tail Test: H0: μ>= μ0 Ha: μ < μ0
Upper Tail Test: H0: μ<= μ0 Ha: μ > μ0

因爲 σ已知,σ=0.18. n=36, 因此 σx = 0.03

所以可以計算 z=x¯μ0σx¯

這裏寫圖片描述

p-value approach

A p-value is a probability that provides a measure of the evidence against the null hypothesis provided by the sample. Smaller p-values indicate more evidence against H0.

For a lower tail test, P-value is the probability of obtaining a value for the test statistic as small as or smaller than that provided by the sample.
這裏寫圖片描述

舉個例子:Hilltop Coffee想要檢測飲料是不是按標準所說,裏面有3磅,所以建立了 hypothesis。
H0: μ>= 3 Ha: μ < 3
於是檢測了36個 sample,得到 樣本平均數是 2.92,問題:x̅=2.92 是不是足夠小來 reject H0? 已知 σ = 0.18, n=36,那麼可以計算 z = -2.67。
所以根據定義:p-value is the probability that the test statistic z is less than or equal to -2.67. 於是可以查表得到,當 z=-2.67時,可能性是0.0038,所以 p-value 是0.0038。This p-value indicates a small probability of obtaining a sample mean of x̅=2.92 or smaller when sampling from a population with μ=3.

第二個問題:0.0038是不是足夠小?
於是我們主要看 α,the selection α=0.01 means that the director is willing to tolerate a probability of 0.01 of rejecting the null hypothesis when it is true as an equality μ=3

所以得到我們的 Rejection Rule Using p-value:
Reject H0 if p-value <= α

當 level of significance 大的時候,也就是所 type I error可能性很大的時候,可能是 α使用的比較大。α大,可以忍受的 error 就大,兩邊的區間都不管,直接 reject.

Critical Value Approach

The critical value approach requires that we first determine a value for the test statistic called the critical value.

例如:用 α=0.01來得到 z= -2.33,於是 reject H0 if z <= -2.33
這裏寫圖片描述
這裏寫圖片描述

Two-Tailed Test

P-value approach

Two Tail Test: H0: μ= μ0 Ha: μ != μ0
這裏寫圖片描述

With a level of significance of α = 0.05, we do not reject H0 because the p-value = 0.126 > 0.05
這裏寫圖片描述

Critical value approach

這裏寫圖片描述
這裏寫圖片描述

STEPS of HYPOTHESIS TESTING
Step1: Develop the null and alternative hypotheses
Step2: Specify the level of significance
Step3: Collect the sample data and compute the value of the test statistic
p-Value Approach
Step4: Use the value of the test statistic to compute the p-value
Step5: Reject H0 is the p-value <= α
Critical Value Approach
Step4: Use the level of significance to determine the critical value and the rejection rule.
Step5: Use the value of the test statistic and the rejcetion rule to determine whether to reject H0

有問題:如果我增大 n,那麼 z 會變大?是的,但是 n 變大,取得的 sample mean 就會越靠近 μ,相應的,取得原來那個離μ有點遠的 sample mean 的可能性就會減少

Relationship between interval estimation and Hypothesis Testing

這裏寫圖片描述

9.4 Population Mean : σ Unknown

The test statistic has a t distribution with n-1 degrees of freedom:
t=x¯μ0s/n

案例: H0: μ <=7 Ha: μ>7
通過計算可以得到 t = 1.84,t 有 n-1=59 degrees of freedom
於是通過找表,需要得到 p-value,發現 p-value 在0.05和0.25之間,又因爲 α=0.05,所以要 reject the null hypothesis.

這裏寫圖片描述

9.5 Population Proportion

The methods used to conduct the hypothesis test are similar to those used for hypothesis tests about a population mean.
這裏寫圖片描述

9.7 Calculating the Probability of Type II Error

案例: H0: μ >=120 Ha: μ<120
If Ho is not rejected, the decision will be to accept the shipment.

如何計算 the Probability of Type II Error?
1. 什麼情況下會犯 Type II error?
When true population mean is less than 120 and we make the decision to accept Ho.
So we must select a value of μ less than 120. For example μ=112, if μ=112, what is the probability of accept H0 and committing a Type II error?
當 x̅ >116.71, 我們會 accept the decision. 所以通過計算得到 z= (116.71-112)/ (12/6) = 2.36. 查表得到 the probability of making a Type II error as β, we see that when μ= 112, β = .0091
這裏寫圖片描述
這裏寫圖片描述

這裏的 power 是什麼? That is the probability of correctly reject the null hypothesis is 1- the probability of makeing a Type II error.

The procedure is:
1. Formulate the null and alternative hypotheses.
2. Use the level of significance α and the critical value approach to determine the critical value and the rejection rule for the test
3. Use the rejection rule to solve for the value of the sample mean corresponding to the critical value of the test statistic.
4. Use the results from step 3 state the values of the sample mean that lead to the acceptance of H0. These values define the acceptance region for the test
5. Use the sampling distribution of x ̄ for a value of μ satisfying the alternative hypothesis, and the acceptance region from step 4, to compute the probability that the sample mean will be in the acceptance region. This probability is the probability of making a Type II error at the chosen value of μ.

9.8 Determining the Sample Size for a Hypothesis Test About a Population Mean

In the upper panel of the figure the vertical line, labeled c, is the corresponding value of x̅.
這裏寫圖片描述

這裏寫圖片描述

當我們還是用之前的案例: Shipments were rejected if H0: μ >= 120 was rejected.

Type I error statement: If the mean life of the batteries in the shipment is μ=120, I am willing to risk an α=.05 probability of rejecting the shipment.
Type II error statement: If the mean life of the batteries in the shipment is five hours under the specification (i.e., μ=115), I am willing to risk a β=.10 probability of accepting the shipment.
這裏寫圖片描述
Rounding up, we commend a sample size of 50.

We can make three observations about the relationship among α, β , and the sample size n.
1. Once two of the three values are known, the other can be computed.
2. For a given level of significance α, increasing the sample size will reduce β.
3. For a given sample size, decreasing α will increase β , whereas increasing α will decrease β.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章