Bookmark and Share

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

[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" <>
To   "" <>
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


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index