Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: aggregation of Fisher's exact test p-values


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: aggregation of Fisher's exact test p-values
Date   Sat, 14 Jul 2012 20:30:31 -0500

Something like this:

sysuse auto,clear
mark lowprice if price <6000
mark highmpg if mpg >20
tempname memhold
tempfile results
postfile `memhold' pvalue highmpg using `results'
levelsof fore, local(levels)
foreach l of local levels {
	tab low high if fore == `l' ,exact matcell(A)
	local a = A[1,2] + A[2,2]
    post `memhold' (r(p_exact)) (`a')
}
postclose `memhold'
use `results' ,clear

sum high,meanonly
gen weight = high/r(sum)
l
sum pvalu [aw = weight]


Scott

On Fri, Jul 13, 2012 at 5:12 PM, Meredith Anderson
<anderson.meredith.k@gmail.com> wrote:
> I have a dataset containing two independent pools that each consist of
> a different number of males and females. The outcome of interest is
> promotion status by gender, and each pool has a different proportion
> of males and females that were promoted. The number of promotions in
> each of these pools is small. To test whether there is a significant
> difference in the promotion rates by gender, I performed a fisher's
> exact test on each pool:
>
> -tab gender promoted if pool==1, exact-
>
>             |       promoted
> gender  |          0          1 |     Total
> -----------+----------------------+----------
>          0 |        25          3 |        28
>          1 |        63          1 |        64
> -----------+----------------------+----------
>     Total |        88          4 |        92
>
>            Fisher's exact =                 0.082
> 1-sided Fisher's exact =                 0.082
>
> -tab gender promoted if pool==2, exact-
>
>             |       promoted
>  gender |         0          1 |     Total
> -----------+----------------------+----------
>          0 |        33          2 |        35
>          1 |        77          3 |        80
> -----------+----------------------+----------
>     Total |       110         5 |       115
>
>            Fisher's exact =                 0.639
> 1-sided Fisher's exact =                 0.483
>
>
> I would like to be able to generate an aggregated p-value that weights
> each pool separately by the number of promotions (instead of simply
> tabulating gender and promoted without a pool restriction). Is there a
> way to do this in Stata? I would like to be able to do this using at
> least 100 pools. Thanks,
>
> Meredith Anderson
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index