## EXAMPLE 1 (from Woodward 2014 Example 8.8 p. 308):
## Supposed we wish to test, at the 5% level of significance, the hypothesis
## that cholesterol means in a population are equal in two study years against
## the one-sided alternative that the mean is higher in the second of the
## two years. Suppose that equal sized samples will be taken in each year,
## but that these will not necessarily be from the same individuals (i.e., the
## two samples are drawn independently). Our test is to have a power of 0.95
## at detecting a difference of 0.5 mmol/L. The standard deviation of serum
## cholesterol in humans is assumed to be 1.4 mmol/L.
epi.sscompc(N = NA, treat = 5.0, control = 4.5, sigma = 1.4, n = NA,
power = 0.95, r = 1, design = 1, sided.test = 1, nfractional = FALSE,
conf.level = 0.95)
## To satisfy the study requirements 340 individuals need to be tested: 170 in
## the first year and 170 in the second year.
## EXAMPLE 2 (from Woodward 1999 Example 8.9 pp. 345):
## Women taking oral contraceptives sometimes experience anaemia due to
## impaired iron absorption. A study is planned to compare the use of iron
## tablets against a course of placebos. Oral contraceptive users are
## randomly allocated to one of the two treatment groups and mean serum
## iron concentration compared after 6 months. Data from previous studies
## indicates that the standard deviation of the increase in iron
## concentration will be around 4 micrograms% over a 6-month period.
## The average increase in serum iron concentration without supplements is
## also thought to be 4 micrograms%. The investigators want to be 90% sure
## of detecting when the supplement doubles the serum iron concentration using
## a two-sided 5% significance test. It is decided to allocate 4 times as many
## women to the treatment group so as to obtain a better estimate of its effect.
## How many women should be enrolled in this study?
epi.sscompc(N = NA, treat = 8, control = 4, sigma = 4, n = NA, power = 0.90,
r = 4, design = 1, sided.test = 2, nfractional = FALSE, conf.level = 0.95)
## The estimated sample size is 67. We allocate 70/5 = 14 women to the
## placebo group and four times as many (n = 53) to the iron treatment group.
Run the code above in your browser using DataLab