EconPapers    
Economics at your fingertips  
 

A more versatile sample size calculator

Richard Hooper
Additional contact information
Richard Hooper: Queen Mary, University of London

United Kingdom Stata Users' Group Meetings 2012 from Stata Users Group

Abstract: I present a new Stata command, simsam, that uses simulation to determine the sample size required to achieve given power for any method of analysis under any probability model that can be programmed in Stata (simsam assumes that code for generating a single dataset and analyzing it can be found in a separate program). Thus simsam extends Stata’s sampsi command. It is straightforward to estimate the power of a statistical analysis for a given sample size by simulation: you simply run the analysis repeatedly on simulated data and see how often the result is statistically significant. Determining the sample size that achieves given power is slightly harder, requiring power to be assessed at different sample sizes in order to find the one at which the target power is attained. simsam uses a novel iterative algorithm that is more efficient than stepping consecutively through every possible sample size. The user specifies the precision of the final estimate of power, but initially the algorithm uses less precision in order to make more rapid progress. The algorithm aims for the smallest sample size (or the smallest multiple of 5, or 10, or other user-specified increment) such that the power, estimated to within the specified precision, exceeds the target power. The power is reported with a 99% confidence interval, and the final sample size obtained is reliable in the sense that if the simsam command is repeated (by the same user or by a reviewer checking the calculation), it will, nearly every time, give a sample size no more than one increment away.

Date: 2012-09-22
References: Add references at CitEc
Citations:

Downloads: (external link)
http://repec.org/usug2012/UK12_hooper.pdf (application/pdf)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:usug12:15

Access Statistics for this paper

More papers in United Kingdom Stata Users' Group Meetings 2012 from Stata Users Group Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum (baum@bc.edu).

 
Page updated 2025-03-19
Handle: RePEc:boc:usug12:15