Professional Documents
Culture Documents
$ available
n =
$ per sample
Power
Test H0 : µA = µB vs Ha : µA ̸= µB at α = 0.05.
X −Y
Test statistic: T = .
! (X − Y )
SD
−C 0 ∆ C
• Sample size
• True difference, µA − µB
X −Y
Test statistic: Z̃ = "
σA2 σB2
n + m
⎛ ⎞ ⎛ ⎞ ⎛ ⎞
Pr ⎝ %|X −
2
Y|
2
> 1.96⎠ = Pr ⎝ %X −Y > 1.96⎠+ Pr ⎝ %X −Y < –1.96⎠
2 2 2 2
σA σB σA σB σA σB
n +m n +m n +m
⎛ ⎞ ⎛ ⎞
⎛ ⎞ ⎛ ⎞
= Pr ⎝Z > 1.96 − % ∆
2 σ 2
⎠ + Pr ⎝Z < –1.96 − % ∆
2 σ2
⎠
σA B
σA B
n +m n +m
Calculations in R
⎛ ⎞ ⎛ ⎞
C <- qnorm(0.975)
se <- sqrt( sigmaAˆ2/n + sigmaBˆ2/m )
power <- 1-pnorm(C-delta/se) + pnorm(-C-delta/se)
Power curves
100
80
Power
60
n=20
40 n=10
20 n=5
0
− 2σ −σ 0 σ 2σ
∆
Power depends on . . .
⎛ ⎞ ⎛ ⎞
σA2 2
−→ n + σmB is minimized when n = σA
σA+σB × N and m = σB
σA+σB ×N
For example:
( √ )
∆√ n
−→ Find n such that Pr Z > 1.96 − σ 2 = 80%.
√
Thus 1.96 − ∆σ√2n = qnorm(0.2) = – 0.842.
√ √
−→ n = ∆σ {1.96 − (−0.842)} 2 −→ n = 15.7 × ( ∆σ )2
Equal but unknown population SDs
Test H0 : µA = µB vs Ha : µA ̸= µB at α = 0.05.
"2 "
sA(n−1)+s2B(m−1) !
σ̂p = n+m−2 SD(X − Y ) = σ̂p 1n + m1
X −Y
Test statistic: T = .
! (X − Y )
SD
X
√−1Y 1
−→ In the case µA − µB = ∆, the statistic follows a non-
σ̂p n + m
central t distribution.
C <- qt(0.975, n + m - 2)
se <- sigma * sqrt( 1/n + 1/m )
power <- 1 - pt(C, n+m-2, ncp=delta/se) +
pt(-C, n+m-2, ncp=delta/se)
Power: equal population SDs
Power curves
100
80
60
Power
40
n = 20
n = 10
n=5
known SDs
20
unknown SDs
0
− 2σ −σ 0 σ 2σ
Calculate power (or determine the sample size) for the t-test when:
• Sample sizes equal
• Population SDs equal
Arguments:
• n = sample size
• delta = ∆ = µ2 − µ1
• sd = σ = population SD
• sig.level = α = significance level
• power = the power
• type = type of data (two-sample, one-sample, paired)
• alternative = two-sided or one-sided test
Examples
Test H0 : µA = µB vs Ha : µA ̸= µB at α = 0.05.
Test statistic: T = %X −Y
s2
A
s2
B
n +m
To calculate the critical value for the test, we need the null distri-
bution of T (that is, the distribution of T if µA = µB).
−→ Example:
n = 5, m = 10, σA = 1, σB = 2,
∆ = 0.0, 0.5, 1.0, 1.5, 2.0 or 2.5.
Example
∆=0 ∆ = 0.5
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
P−value P−value
∆ = 1.0 ∆ = 1.5
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
P−value P−value
∆ = 2.0 ∆ = 2.5
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
P−value P−value
Example
100
80
60
Power
40
20