Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Testing dependence in a 2x2 table for clustered observations
From
"Joseph Coveney" <[email protected]>
To
<[email protected]>
Subject
Re: st: Testing dependence in a 2x2 table for clustered observations
Date
Thu, 26 Aug 2010 14:19:06 +0900
Joseph McDonnell wrote:
I'm not sure I agrees with Steve here. Maybe I don't understand how he
would stratify, but I can't see that stratification would solve the
lack of independence. Personally, I'd just use the multilevel
approach. Yes, walnut meets sledgehammer...
--------------------------------------------------------------------------------
You can see how you'd stratify in the example do-file below. The illustration
uses Adriaan's variable names and 20 clinics.
Stratification is pretty conventional in this circumstance. The do-file also
shows the multilevel approach. You can compare the two to see whether there's a
difference in the message.
Joseph Coveney
clear *
set more off
set seed `=date("2010-08-26", "YMD")'
set obs 20
generate byte clinic = _n
forvalues treatment = 0/1 {
generate byte count0`treatment' = ceil(50 * runiform())
generate byte count1`treatment' = 50 - count0`treatment'
}
reshape long count0 count1, i(clinic) j(treatment)
reshape long count, i(clinic treatment) j(recovered)
cs recovered treatment [fweight = count], by(clinic) or
mhodds recovered treatment [fweight = count], by(clinic)
expand count
drop if count == 0
xtlogit recovered treatment, i(clinic) fe or nolog
xtlogit recovered treatment, i(clinic) re or nolog
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/