## EXAMPLE 1 (from Woodward 2014 Example 8.12 p. 312):
## A government initiative has decided to reduce the prevalence of male
## smoking to, at most, 30%. A sample survey is planned to test, at the
## 0.05 level, the hypothesis that the percentage of smokers in the male
## population is 30% against the one-sided alternative that it is greater.
## The survey should be able to find a prevalence of 32%, when it is true,
## with 0.90 power. How many men need to be sampled?
epi.sscompb(N = NA, treat = 0.30, control = 0.32, n = NA, power = 0.90,
r = 1, design = 1, sided.test = 1, nfractional = FALSE, conf.level = 0.95)
## A total of 4568 men should be sampled: 2284 in the treatment group and
## 2284 in the control group. The risk ratio (that is, the prevalence of
## smoking in males post government initiative divided by the prevalence of
## smoking in males pre inititative) is 0.94.
## EXAMPLE 2:
## If we sample only 2000 men (1000 in the treatment group and 1000 in the
## control group) what is the maximum detectable risk ratio that is less
## than 1?
epi.sscompb(N = NA, treat = NA, control = 0.32, n = 2000, power = 0.90,
r = 1, design = 1, sided.test = 1, nfractional = FALSE, conf.level = 0.95)
## If we sample only 2,000 men the maximum detectable risk ratio will be 0.91.
Run the code above in your browser using DataLab