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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Testing dependence in a 2x2 table for clustered observations


From   "Seed, Paul" <paul.seed@kcl.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Testing dependence in a 2x2 table for clustered observations
Date   Thu, 26 Aug 2010 11:43:10 +0100

Dear Statalist, 

Adriaan Hoogendoorn has outcome and treatment data (both binary) from 
20 centres.  As suggested by Joseph and Joseph, -xtlogit, i(clinic) fe- , 
-xtlogit, i(clinic) re- and -cs, by(clinic)- will all give useable estimates 
for the combined odds ratio, given a fairly large numbers of subjects in 
every centre, and a good (50%) recovery rate.

I tried a more realistic simulation with fewer subjects per centre, 
different-sized centres (168 subjects total instead of 2,000), and a 
lower recovery rate (30% instead of 50%). Now, some small centres have 
an empty cell, and the data from that centre is lost if Mantel-Haenszel 
methods are used.  If there is only one outcome (two empty cells), 
there will 
be no estimated odds ratio for that centre, the centre is lost to 
the fixed effects method as well.  

In the example below, 63 of 168 observations are lost to M-H and 
45 to fe.  None are lost to re.
However, more simulations would be needed to get a clearer picture
of the effect on the power and size of the tests.

****************************
clear *
set more off
set seed `=date("2010-08-26", "YMD")'
set obs 20

generate byte clinic = _n

expand 2
bys clinic: gen treatment = _n-1

* Average of 8 observations per centre
gen n = int(runiform()*8+.5)
expand n

* 20% recovery rate
gen recovered = runiform() < .2

cs recovered treatment , by(clinic) or
mhodds recovered treatment , by(clinic)

xtlogit recovered treatment, i(clinic) fe or nolog
xtlogit recovered treatment, i(clinic) re or nolog

* Investigation of data problems
bys clinic : tab  treatment recovered 
recode clinic 1 2 5 12 15 18 19 20 = 0, into(zero_wt)
replace  zero_wt =  zero_wt == 0
bys clinic (recovered) : gen no_recov =  recovered[_N] == 0
tab  zero_wt no_recov



exit




*
*   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