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]

Re: st: Estimating the (possibly negative) intracluster correlation

From   "Joseph Coveney" <>
To   <>
Subject   Re: st: Estimating the (possibly negative) intracluster correlation
Date   Tue, 7 Sep 2010 02:17:26 +0900

Scott Baldwin wrote:

One option is to use the residuals option with an exchangeable
correlation structure in xtmixed. This allows you to look at the
correlation among observations within a cluster rather than the
variance among the cluster means (as would be the case if you fit a
random intercept model). [remainder omitted]


That is neat.  I'll really have to start getting familiar with what -xtmixed- 
and its new -residuals()- option can do.  The ovary dataset doesn't have a 
negative ICC, but the artificial dataset below does have a negative ICC to 
illustrate Scott's -xtmixed- approach.  

I'd known that you can do it with -xtgee- (so long as it's a linear model),
and with the old method-of-moments technique with -anova- (for a balanced 

For some reason, I'd always thought that an ML (REML) method couldn't deal with
negative ICCs, and that you had to resort to ANOVA and method-of-moments, 
because they admit negative variance components estimates, or to GEE.

Joseph Coveney

version 11.1
clear *
set more off
set seed `=date("2010-09-07", "YMD")'
matrix input C = (1 -0.7 \ -0.7 1)
drawnorm mu0 mu1, corr(C) n(200) clear
generate int pid = _n
quietly reshape long mu, i(pid) j(tim)

xtmixed mu i.tim || pid:, nocons residuals(exchangeable) ///
	nolrtest nolog

xtgee mu i.tim, i(pid)
estat wcor

anova mu pid tim
scalar define sigma2_e = e(rss) / e(df_r)
scalar define sigma2_u = ///
	(e(ss_1) / e(df_1) - sigma2_e) / (e(df_2) + 1)
scalar define ICC = sigma2_u / (sigma2_u + sigma2_e)
display in smcl as text ICC


*   For searches and help try:

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