Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Sample size calculation with uneven sample sizes

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Sample size calculation with uneven sample sizes Date Sat, 26 Jan 2013 00:14:50 -0500

```Mathew:

You are mistaken in thinking that to use -sampsi-, you must write out a
separate statement for each set of parameters. Here is code which loops
over ranges of four different parameters for a two- sample comparison of
proportions: the odds ratio; the ratio of sample sizes, the power to be
detected; and the smaller proportion.

******************************
foreach oratio of numlist 1.25 1.5 2 {
foreach nratio of numlist 1.5 2{
foreach pow of numlist 0.8 0.9{
foreach f1 of numlist 0.2 0.3{
local odds2 = `oratio'*`f1'/(1-`f1')
local f2 = `odds2'/(1+`odds2')
sampsi `f1' `f2', power(`pow') ratio(`nratio')
}
}
}
}
********************************

Steve Samuels
Consultant in Statistics
18 Cantine's Island
Saugerties NY 12477 USA
Voice: 845-246-0774

-powercal- by Roger Newson (available at SSC), already recommended by David, has the capability of generating reports for a range of the input parameters.

You are incorrect in stating that Optimal Design can handle"uneven sample sizes".  It assumes equal sample sizes (page 17, Manual version Oct 16, 2011). If you need uneven sample sizes than you must compute them yourself,  by treating's OD's N as twice the harmonic mean group size.  The only way to do the calculation is to specify the ratio, so you can't avoid it.  But, there are other questions if you have a complex design (the word "survey" is ambiguous).

Steve

On Jan 23, 2013, at 4:25 AM, Matthew Bombyk wrote:

Dear Statalist,

I have a question about power calculations. I currently have a
baseline survey dataset, and we are planning the followup. I would
like to do sample size calculations using various
assumptions/requirements, and on several variables. However, the
-sampsi- command in Stata only allows for power calculations with
uneven sample sizes, not sample size calculations, unless you have a
fixed ratio. Other programs such as Optimal Design appear to have this
feature, but it is unwieldy to perform many power calculations using
different variables and parameters. Does anyone have a solution to
this problem in Stata?

Thanks,

--
Matthew Bombyk

Project Coordinator
Innovations for Poverty Action (IPA)
Ulaanbaatar, Mongolia
Tel: +976 9990 1542

www.poverty-action.org
Fighting poverty with innovation, evidence, and action
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```