Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Using Stata to Calculate Sample Size and Power

A. Required Sample Size (for a given alpha and power)

1. For a single measurement (a proportion) in one sample

Command syntax:
sampsi proportion-H0 proportion-H1 , alpha(a) power(p) onesample

Example:

. sampsi .50 .60, alpha(.05) power(.90) onesample

Result:

Estimated sample size for one-sample comparison of proportion


to hypothesized value

Test Ho: p = 0.5000, where p is the proportion in the population

Assumptions:

alpha = 0.0500 (two-sided)


power = 0.9000
alternative p = 0.6000

Estimated required sample size:

n = 259

1
2. For a single measurement (a mean) in one sample

Command syntax:
sampsi mean-H0 mean-H1 , sd(x) alpha(a) power(p) onesample

Example:

. sampsi 40 45, sd(15) alpha(.05) power(.90) onesample

Result:

Estimated sample size for one-sample comparison of mean


to hypothesized value

Test Ho: m = 40, where m is the mean in the population

Assumptions:

alpha = 0.0500 (two-sided)


power = 0.9000
alternative m = 45
sd = 15

Estimated required sample size:

n = 95

2
B. Power of a Comparison For Given Sample Sizes and Alpha

1. For two proportions:

Command:
sampsi proportion-1 proportion-2, n1(x) n2(y) alpha(a)

Example:

. sampsi .25 .40, n1(300) n2(200) alpha(.05)

Result:

Estimated power for two-sample comparison of proportions

Test Ho: p1 = p2, where p1 is the proportion in population 1


and p2 is the proportion in population 2
Assumptions:

alpha = 0.0500 (two-sided)


p1 = 0.2500
p2 = 0.4000
sample size n1 = 300
n2 = 200
n2/n1 = 0.67

Estimated power:

power = 0.9301

3
2. For two means:

Command:
sampsi mean-1 mean-2, sd1(s) sd2(t) n1(x) n2(y) alpha(a)

Example:

sampsi 20 17, sd1(10) sd2(12) n1(200) n2(100) alpha(.05)

Result:

Estimated power for two-sample comparison of means

Test Ho: m1 = m2, where m1 is the mean in population 1


and m2 is the mean in population 2
Assumptions:

alpha = 0.0500 (two-sided)


m1 = 20
m2 = 17
sd1 = 10
sd2 = 12
sample size n1 = 200
n2 = 100
n2/n1 = 0.50

Estimated power:

power = 0.5769

You might also like