Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: confidence intervals for differences between medians

From   Roger Newson <>
Subject   Re: st: confidence intervals for differences between medians
Date   Wed, 02 Jul 2003 16:18:43 +0100

At 16:11 02/07/03 +0200, Gerben ter Riet wrote:
Dear All,
Someone advised me the approach by Gardner and Altman to calculate 95%
CIs for differences between medians. I'd prefer to use Stat's qreg
command. Is this allowed? How do the results from qreg compare to the
results from the Gardner/Altman approach?
The Gardner-Altman approach is implemented in Duolao Wang's -npshift- command, and also in Patrick Royston's -cid- command.. (Type -findit npshift- or -findit cid- to find out more, including how to download them.)

A limitation of this method is that it assumes that the 2 population distributions differ only in location, which implies (among other things) equal variances. This assumption does not always hold. A way around this limitation is to use the -cendif- program in the -somersd- package, downloadable from SSC. (Type -ssc desc somersd- tofind out more about -somersd-.) -cendif- calculates confidence intervals for the median difference between values sampled from two groups. The median difference is not always equal to the difference between medians, but is equal to the difference between medians if the 2 population distributions are different only in location. The -cendif- program therefore is an unequal-variance version of -cid- or -npshift-. The methods of -cendif- and -somersd- are given in the manuals to the -somersd- package, and discussed in a Stata Juornal article (Newson, 2002). A pre-publication draft of this article can be downloaded by typing

net from

and following the instructions.

The Stata -qreg- package uses a slightly different method, which is based on M-estimation, and estimates beta-values which minimize a weighted sum of magnitudes of residuals. The beta-coefficients will not always be either median differences or differences between medians, but will be related to percentiles of residuals. I haven't compared -qreg- to -cendif-, -npshift- and -cid- on the same data, but the 3 methods measure slightly different parameters, and comparing them will therefore compare different questions, rather than different answers to the same question. (I would expect the 3 methods to give similar answers in the equal-variance case.)

I hope this helps.



Newson R. 2002. Parameters behind "nonparametric" statistics: Kendall's tau, Somers' D and median differences. The Stata Journal 2(1): 45-64.

Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605

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

* For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index