The new ciwidth command performs precision and sample-size analysis for confidence intervals (CIs). The goal is to optimally allocate study resources when CIs are to be used for inference or, said differently, to estimate the sample size required to achieve the desired precision of a CI.
ciwidth also lets you investigate the precision in various scenarios, which is useful at the planning stage. You can investigate the tradeoffs among sample size, required CI width, and the probability that the actual CI width will be less than required. And you can examine how each varies with other parameters.
Results can be presented in a table or graph.
We are planning a study that will compare the average weight loss caused by a new drug with that of an older one. We want the CI for the difference in means. We know from experience that the average weight loss associated with the older drug has a standard deviation of 5 pounds. The new drug is expected to produce greater weight loss. How many subjects do we need for a 95% CI with width of no more than 6 pounds?
. ciwidth twomeans, width(6) sd(5) probwidth(.96) Performing iteration ... Estimated sample sizes for a two-means-difference CI Student's t two-sided CI assuming sd1 = sd2 = sd Study parameters: level = 95.00 Pr_width = 0.9600 width = 6.0000 sd = 5.0000 Estimated sample sizes: N = 60 N per group = 30
We need 60 subjects, 30 for each drug. We specified probwidth(.96), which means that we want the CI's width to be 6 or less 96% of the time when we repeat the experiment.
It is often desirable to explore various solutions when planning an experiment. Let's see how much our assumption that the standard deviation is 5 pounds matters.
. ciwidth twomeans, width(6) sd(4.5 5 5.5 6) probwidth(.96) Performing iteration ... Estimated sample sizes for a two-means-difference CI Student's t two-sided CI assuming sd1 = sd2 = sd
|level N N1 N2 Pr_width width sd|
|95 52 26 26 .96 6 4.5|
|95 60 30 30 .96 6 5|
|95 72 36 36 .96 6 5.5|
|95 82 41 41 .96 6 6|
Required sample sizes vary from 52 to 82.
ciwidth can graph results. Here it is over a slightly wider range of standard deviations:
. ciwidth twomeans, width(6) sd(4(.25)6) probwidth(.96) graph
And here it is also for a range of CI widths:
. ciwidth twomeans, width(5 6 7 8) sd(4(.25)6) probwidth(.96) graph(xdimension(sd))
Read more about the new ciwidth command in the Stata Power, Precision, and Sample-Size Reference Manual; see [PSS-3] ciwidth.