编程代考 Power analysis

Power analysis
Miaoyan Wang
Department of Statistics UW Madison

Copyright By PowCoder代写 加微信 powcoder

Review of one-sample testing
i.i.d.sample: Y1,Y2,…,Yn ∼N(μ,σ2) Parameter of interest: μ or σ.
H0 versus HA Testing H0 : μ = μ0
􏱪 Normal population σ2 known:
Z= √ ∼N(0,1)
􏱪 Normal population σ2 unknown:
􏰟n Y ̄−μ0 􏰞􏰞 1 􏰍
T= σˆ/√n ∼Tn−1, whereσˆ=􏰝n−1 (Yi−Y ̄)2, i=1
Testing for σ2: H0 : σ2 = σ02
2 (n − 1)S2 2
V= σ02 ∼χn−1 p-value and conclusion

Example: H0 :μ=60vs. HA :μ̸=60 Consider testing
H0 :μ=60vs. HA :μ̸=60.
Suppose that an i.i.d. sample of size n = 16 is possible and that the
population distribution is N(μ, 36).
Under H0, what is the distribution of the sample mean Y ̄?
Y ̄ ∼N(μ0 =60,σ2 = 36 =(1.5)2) n 16
Suppose α = 0.05. That is, we reject H0 if the p-value is less than or equal to 0.05.
What values of Y ̄ would lead to a rejection of H0?
Can we answer this question before even having the data?

Rejection Region
Note z0.025 = 1.96 (from R or Z-table). We would reject H0 if the observed y ̄ is more than 1.96 standard deviation (of the sample mean!) away from the hypothesized mean μ = 60.
We would reject H0 if the observed y ̄ is less than 57.06 or more than 62.94. [Why?]
P(Z ≤ −1.96) + P(Z ≥ 1.96)
􏰬Y ̄ − 60 􏰭 􏰬Y ̄ − 60 􏰭
= P 1.5 ≤ −1.96 + P 1.5 ≥ 1.96
= P(Y ̄ ≤60−1.96×1.5)+P(Y ̄ ≥60+1.96×1.5)
= P(Y ̄ ≤ 57.06) + P(Y ̄ ≥ 62.94)

Type I and II Error
For a given rejection region, the rule is to reject H0 if the observed y ̄ falls in the rejection region and do not reject H0 otherwise.
Because Y ̄ is random, it is possible to make two types of errors.
􏱪 A Type I error occurs if we reject H0 when H0 is true.
􏱪 A Type II error occurs if we accept H0 when H0 is false.
In our example, what is the probability of Type I error? P(Reject H0|H0) = P(Y ̄ ≤ 57.06 or Y ̄ ≥ 62.94|μ = 60)

Types of Error and Statistical Power
There are four possible outcomes that could be reached as a result of the null hypothesis being either true or false and the decision being either “fail to reject” or “reject”.
Our Decision
Type I Error
Type II Error

Types of Error and Statistical Power
Our Decision
Ha Type I Error
(Prob = α) √
(Prob = 1 − α) Type II Error (Prob = β)
(Prob = 1 − β)
The significance level α of any fixed level test is the probability of a
Type I error.
The power of a fixed level test against a particular alternative is
1 − β for that alternative.
In practice, we first choose an α and consider only tests with probability of Type I error no greater than α. Then we select one that makes the probability of Type II error as small as possible (i.e. the most powerful possible test).

For a given rejection rule and for any given value of μ, the power is the probability of rejecting H0 given the value of μ.
In the example above, what is the power for μ = 60?
P(Reject H0|μ = 60) = P(Y ̄ ≤ 57.06 or Y ̄ ≥ 62.94|μ = 60)
What is the power for μ = 62?
P(Reject H0|μ = 62) = P(Y ̄ ≤ 57.06 or Y ̄ ≥ 62.94|μ = 62)
= P(Z ≤ −3.29) + P(Z ≥ 0.63) = 0.0005 + 0.2643 = 0.2648 What is the power for μ = 64?
P(Reject H0|μ = 64) = P(Y ̄ ≤ 57.06 or Y ̄ ≥ 62.94|μ = 64) =P(Z ≤−6.94)+P(Z ≥−0.71)=0+(1−0.2389)=0.7611

Correction: earlier lake clarify example / pair t-test
How about testing
H0 :μ1 =μ2+0.5vs. HA :μ1 >μ2+0.5
The test statistic is:
D ̄ − 0 . 5
T = SD/√n ∼ Tn−1
The observed test statistic is: t = d ̄−0.5 = 0.497−0.5 = −0.0294
sd / n 0.435/ 22
P (T21 ≥ −0.0294) = 1 − pt(−0.0294, df = 21) which is more than
0.5 from calculator, R, or T-table.
The conclusion is:
Do not reject H0 at 5% level. There is no evidence against that the H0 that the mean Secchi depths differ by 0.5 m between 1990 and 1980.
The p-value is:

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com