[R] Using McNemar's test to detect shifts in response from pre- topost-treatment

Peter Dalgaard pdalgd at gmail.com
Wed Sep 15 08:53:47 CEST 2010


On 09/14/2010 08:58 PM, Robert Baer wrote:
> McNemar is good for paired data. See
> ?mcnemar.test
> 
> You need to get your data into the form of a matrix (e.g., help example), 
> and you will need data organized by concordant and discordant pairing.
> 
> This means that you will need to organize your data differently than you 
> show us:
> # pairs YES YES pre-post
> # pairs YES NO pre-post
> # pairs NO-YES pre-post
> # pairs NO-NO pre-post0
> 
> Finally, you will need to decide whether to apply the usual continuity 
> correction with your sample size (TRUE by default).

Also notice that this is a group A vs. group B situation, whereas
McNemar is for whether there is a pre-post difference within a single group.

Curiously, there appears to be two different schools on how to handle
this sort of data:

(A) In cancer epidemiology you would say that this is like a matched
case-control study and that in a model with logit-additive effects of
pair and that the pre-post odds ratio is estimated by the ratio of the
off-diagonal terms. To compare two such ORs between two tables, it is a
fairly obvious idea to form the 2x2 table of the two sets of
off-diagonal terms and test for independence. Rather nicely, you can use
Fisher's exact test in small-sample situations, and its OR estimate is
really the "ORR" - the ratio of the two ORs.

(B) However, in clinical trial literature, people focus on the
probability _difference_ and correct that for correlations within pairs.
One advantage of this is that estimates have the same interpretation
whether the experiment was paired or unpaired. Technically, what you do
is little different from scoring +/-1 for increase, and 0 for no change,
and then compare the average scores with a t-test or a permutation test.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list