# st: -sampsi- command and exact tests

 From Miller.DavidJ@epamail.epa.gov To statalist@hsphsun2.harvard.edu Subject st: -sampsi- command and exact tests Date Tue, 01 Feb 2005 20:15:14 -0500

```Dear Statalisters-

I understand from several previous posts that the command  -sampsi- uses
an approximate large sample test on proportion. power, and sample size
calculations.  Specifically, it uses the normal approximation (with
correction) as opposed to an exact test.  The advice in a previous post
was that the following equalities must hold in order for sampsi to work

n1p1>=10
n1(1-p1)>=10
n2p2>=10
n2(1-p2)>=10

(see post from ymarchenko@stata.com entitled st:RE: calculation of
sample size,  dated 8 Oct 2004)

I am trying to use sampsi to estimate the required number of  samples as
follows:

sampsi 0.4 0.46, alpha(0.05) power(0.90) onesample

Stata indicates that 711 samples are required as indicated in the Stata
output below:

sampsi 0.4 0.46, alpha(0.05) power(0.90) onesample

Estimated sample size for one-sample comparison of proportion
to hypothesized value

Test Ho: p = 0.4000, where p is the proportion in the population

Assumptions:

alpha =   0.0500  (two-sided)
power =   0.9000
alternative p =   0.4600

Estimated required sample size:

n =      711

This seems to meet the n1p1>=10 etc. requirements listed above to use
the -sampsi- command.  However,  I am told that the right answer using
NQuery Advisor and its  exact test for single proportions is 610
observations.  S-Plus gives 613 as an answer.  StatXact also gives a

Does anyone know if Stata's use of the normal approximation  (with
continuity correction)  is indeed what is causing the 100+ discrepancy
here?  Is there is an exact test in Stata that can be used instead of
-sampsi-?  And are there additional criteria beyond the n1p1>=10 etc.
criteria listed in the  referenced previous post that should be checked
before using -sampsi- ?

I have used the -findit- command to see if there is an exact test
available and looked at both Roger Newson's -powercal- command described
in the most recent Stata Journal (4th Quarter 2004) as well as Al
Feiveson's article entitled "Power by Simulation" (Stata Journal, 2nd
Quarter 2002) and wasn't able to find the answer to this question.   Is
the  -sampncti- command appropriate here?

thanks for any help.

david.

David Miller, Senior Scientist
Health Effects Division
Office of Pesticide Programs
703-305-5352 (voice)
703 605-1289 (fax)

visit: http://www.epa.gov/pesticides/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.857857,"math_prob":0.5928168,"size":2599,"snap":"2023-14-2023-23","text_gpt3_token_len":721,"char_repetition_ratio":0.097109824,"word_repetition_ratio":0.015625,"special_character_ratio":0.26317814,"punctuation_ratio":0.12475248,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9626061,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-06-01T16:24:40Z\",\"WARC-Record-ID\":\"<urn:uuid:4fc4d47e-0a5d-4b8d-8787-19d9b5d88439>\",\"Content-Length\":\"8054\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f147525a-e1f3-4f43-9603-524fa337413f>\",\"WARC-Concurrent-To\":\"<urn:uuid:60ee8e85-9257-49cc-9eea-0c73369863ea>\",\"WARC-IP-Address\":\"66.76.6.5\",\"WARC-Target-URI\":\"https://www.stata.com/statalist/archive/2005-02/msg00016.html\",\"WARC-Payload-Digest\":\"sha1:RCOPL6L6OBOHPK4YXVLRZOCMYUFSG3OD\",\"WARC-Block-Digest\":\"sha1:WBVXZMVI66DR24FDGT4GGOHRFX2VYXL6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224647895.20_warc_CC-MAIN-20230601143134-20230601173134-00411.warc.gz\"}"}