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: McNemar's test with clustering

From   Roger Newson <>
To   "" <>
Subject   Re: st: McNemar's test with clustering
Date   Mon, 26 Apr 2010 11:22:31 +0100

This looks like a job for the -somersd- package, downloadable from SSC. The -somersd- package calculates confidence intervals for a number of parameters behind so-called "nonparametric" statistics, including a paired difference between proportions, which is the paameter behind the McNemar test, and is a special case of Somers' D.

I will assume that you have a dataset with 1 observation per body side per twin, keyed by the variables -twinpair- (an ID number for twin pairs), -twinseq- (indicating whether the twin is the first or second twin and with values 1 or 2), and -side- (with values 1 for left and 2 for right). The outcome variable will be called -feature-, equal to 1 if a feature is present on that side of that twin in that pair, and equal to 0 if the feature is absent in that side of that twin of that pair. You could then type

somersd side feature, transf(z) tdist cluster(twinpair) funtype(vonmises)

and -somersd- will give you a difference between the proportion of right sides with the feature and the proportion of left sides with the feature, with confidence intervals adjusted for the fact that we are sampling twin pairs from a population of twin pairs (instead of sampling twins from a population of twins or even sides from a population of sides).

I hope this helps. Let me know if you have any further queries.

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 26/04/2010 02:39, Laura Gibbons wrote:
I'd like to do something like McNemar's test, -mcc-, where I'm comparing
presence of two dichotomous traits in each person.  [In this case, is a
finding more common on the left side of the spine, compared to the right.]

The problem is that the subjects are twins, in this analysis a nuisance
parameter, but svyset or cluster(pair) are not options for mcc.

For continuous outcomes I can get the equivalent of a paired t-test by
computing the difference and then getting the p-values from the intercept

reg difference, cluster(pair)

but I've not come up with anything along these lines either.

Any guidance would be appreciated, thanks!


Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
phone: 206-744-1842, fax: 206-744-9917, Office address: 401 Broadway, Suite 5122
*   For searches and help try:
*   For searches and help try:

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