[R] mcnemar.test odds ratios, CI, etc.

2005-01-24 Thread Bliese, Paul D LTC USAMH
Does anyone know of another version of the Mcnemar test that provides:

 

1.  Odds Ratios

2.  95% Confidence intervals of the Odds Ratios

3.  Sample probability 

4.  95% Confidence intervals of the sample probability

 

Obviously the Odds Ratios and Sample probabilities are easy to calculate
from the contingency table, but I would appreciate any help on how to
calculate the confidence intervals.

 

Below is a simple example of the test, and the corresponding output with
the function mcnemar.test.

 

 xtabs(~PLC50.T1+PLC50.T2,data=LANCET.DAT)

PLC50.T2

PLC50.T1 0   1  

   0 464  22

   1   6   1

 mcnemar.test(xtabs(~PLC50.T1+PLC50.T2,data=LANCET.DAT))

 

McNemar's Chi-squared test with continuity correction

 

data:  xtabs(~PLC50.T1 + PLC50.T2, data = LANCET.DAT) 

McNemar's chi-squared = 8.0357, df = 1, p-value = 0.004586

 

Paul

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] mcnemar.test odds ratios, CI, etc.

2005-01-24 Thread Peter Dalgaard
Bliese, Paul D LTC USAMH [EMAIL PROTECTED] writes:

 Does anyone know of another version of the Mcnemar test that provides:
 
  
 
 1.  Odds Ratios
 
 2.  95% Confidence intervals of the Odds Ratios
 
 3.  Sample probability 
 
 4.  95% Confidence intervals of the sample probability
 
  
 
 Obviously the Odds Ratios and Sample probabilities are easy to calculate
 from the contingency table, but I would appreciate any help on how to
 calculate the confidence intervals.
 
  
 
 Below is a simple example of the test, and the corresponding output with
 the function mcnemar.test.
 
  
 
  xtabs(~PLC50.T1+PLC50.T2,data=LANCET.DAT)
 
 PLC50.T2
 
 PLC50.T1 0   1  
 
0 464  22
 
1   6   1
 
  mcnemar.test(xtabs(~PLC50.T1+PLC50.T2,data=LANCET.DAT))
 
  
 
 McNemar's Chi-squared test with continuity correction
 
  
 
 data:  xtabs(~PLC50.T1 + PLC50.T2, data = LANCET.DAT) 
 
 McNemar's chi-squared = 8.0357, df = 1, p-value = 0.004586


What is the sample probability in this context? The odds ratio is a
simple functional of the off-diagonal elements, and the conditional
distribution of those given their sum is just a binomial, so you can
use prop.test or binom.test to get estimate and confidence intervals
for the probability parameter and convert that to odds.

E.g.

 prop.test(6,28)

1-sample proportions test with continuity correction

data:  6 out of 28, null probability 0.5
X-squared = 8.0357, df = 1, p-value = 0.004586
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.09027927 0.41462210
sample estimates:
p
0.2142857


 ci.p - prop.test(22,28)$conf
 ci.odds - ci.p/(1-ci.p)
 ci.odds
[1]  1.411835 10.076740
attr(,conf.level)
[1] 0.95
 ci.p - binom.test(22,28)$conf
 ci.odds - ci.p/(1-ci.p)
 ci.odds
[1]  1.441817 11.053913
attr(,conf.level)
[1] 0.95



-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html