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

# Re: st: RE: McNemar's test with clustering (Somers D comparisons)

 From Roger Newson To "statalist@hsphsun2.harvard.edu" Subject Re: st: RE: McNemar's test with clustering (Somers D comparisons) Date Mon, 26 Apr 2010 19:49:03 +0100

I personally would probably use Von Mises comparisons (as in -funtype(vonmises)-). In the case of a binary outcome, this should produce the same result as -funtype(wcluster)- as long as there are no missing outcomes for any side of any twin in any pair, because, then, the difference between the proportions with the feature in the 2 sides of the body (estimated using -funtype(vonmises)-) is the same statistic as the mean pairwise difference between the proportion of left sides with the feature in a twin pair and the proportion of right sides with the feature in the same twin pair (estimated using -funtype(wcluster)-). If there were missing values, and we only want to compare left and right sides in the same twin pair, then it might be a better idea to use -funtype(wcluster)-. And, if we only wanted to compare left and right sides in the same twin (excluding comparisons between 2 twins in the same pair), then we could use -funtype(wcluster) wstrata(twinseq)-, assuming that -twinseq- is a variable giving sequential order of twin within pair. However, if there are no missing data, all 3 of these methods should give the same result, because they are all jackknifing the same parameter (a difference between proportions).
```
```
In the case of a continuous outcome, we might use -cendif- or -censlope-, instead of -somersd-. In this case, the option -funtype(vonmises)- would estimate the median difference in the outcome between all left sides and all right sides, and the option -funtype(wcluster)- would estimate the median difference between left sides and right sides in the same twin pair, and the options -funtype(wcluster) wstrata(twinseq)- would give the median pairwise difference between the 2 sides of the same twin. These are 3 different parameters. However, I would expect to have more power to detect a positive value for the first parameter than to detect a positive value for the second parameter, and a bit more power to detect a positive value for the second parameter than to detect a positive value for the third parameter. This is because the first parameter is like inverting a clustered Wilcoxon test (and getting a clustered Hodges-Lehmann median difference), while the third parameter is like inverting a clustered sign test (and getting a clustered median pairwise difference), and the second parameter is intermediate betweein these 2 extremes.
```
I hope this helps. Let me know if you have any further queries.

Best wishes

Roger

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
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:

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

On 26/04/2010 19:12, Feiveson, Alan H. (JSC-SK311) wrote:
```
```Roger -

So in your proposed -somersd- analysis, would you use within, between or vonmises comparisons? With a continuous outcome, I would think that if you want to "remove" the twin effect, the comparisons should be within-cluster. However with a dichotomous predictor and outcome, there might be too many pairs with both responses the same, giving essentially no information. So in view of this would the vonmises comparisons with clustered standard errors be the best way? Or perhaps just  between-cluster comparisons?

Al Feiveson

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Roger Newson
Sent: Monday, April 26, 2010 12:52 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: McNemar's test with clustering

Yes, you could treat twin pairs as a block. However, as we are sampling
twin pairs from a population of twin pairs, I would still cluster by
twin pair, whether I was using -clogit- or -somersd-.

The -somersd- method has the advantage that it outputs a difference
between proportions. I think more people understand those than
understand odds ratios, although odds ratios are useful for estimating
relative risks in a case-control study.

Best wishes

Roger

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
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:

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

On 26/04/2010 18:36, Lachenbruch, Peter wrote:
```
```Could you treat the members of the twin pairs as a block in a randomized block fashion?  The clogit idea sounds pretty good

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Laura Gibbons
Sent: Monday, April 26, 2010 10:10 AM
To: 'statalist@hsphsun2.harvard.edu'
Subject: Re: st: RE: McNemar's test with clustering

Sorry this wasn't clear.  For this analysis, I'm just interested in the
men as individuals, are their right and left sides different.  If I had a
continous outcome (and no twinship to consider), I'd use a paired t-test.

But the sample happens to be (for other reasons) twins, so I need to
adjust errors (p-values) for the correlation between twins.

Pair	Twin	Left 	Right
-----------------------------
1	1	1	0
1	2	1	1
2	1	0	0
2	2	1	0

something like that, where I wan't to compare Left and Right, and Pair is
a nuisance variable to me.

thank you!  Laura

On Mon, 26 Apr 2010, Lachenbruch, Peter wrote:

```
```I seem to be missing something here.  If you take the within-pair
difference aren't you removing the pair effect? You can make the same
argument for a dichotomous response. In this case the difference will be
-1, 0, or 1.  You could do a t-test on this (variance would be slightly
off) or you could look at the table of responses and test if the
proportion of -1s is the same as the proportion of +1s.  May need to do
this by hand, but should be simple. What is the clustering variable if
not pairs?

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Laura Gibbons
Sent: Sunday, April 25, 2010 6:39 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: McNemar's test with clustering

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
in

reg difference, cluster(pair)

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

Any guidance would be appreciated, thanks!

-Laura

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*   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/

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

```
```
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*   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/

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

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