[R] suggestion for proportions

John Sorkin JSorkin at grecc.umaryland.edu
Thu Sep 8 04:31:46 CEST 2011

Would the following strategy work?
numtests <- 20
# Create a data frame: test1 results from trial 1
#                      test2 results from trial 2
#                      agree indicagtor if trial1= trial2 (value =1) or
#                                          trial1<>trial2 (value =0)
data <- data.frame(test1 <-rbinom(numtests,1,0.5), test2<-rbinom(numtests,1,0.5),agree<-test1*test2)
cat("Fraction of times test1=test2",sum(data$test2)/numtests,"\n")

# Choose one of the following tests:


John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

>>> csrabak <cesar.rabak at gmail.com> 9/7/2011 8:31 PM >>>
Em 7/9/2011 16:53, array chip escreveu:
> Hi all, thanks very much for sharing your thoughts. and sorry for my describing the problem not clearly, my fault.
> My data is paired, that is 2 different diagnostic tests were performed on the same individuals. Each individual will have a test results from each of the 2 tests. Then in the end, 2 accuracy rates were calculated for the 2 tests. And I want to test if there is a significant difference in the accuracy (proportion) between the 2 tests. My understanding is that prop.test() is appropriate for 2 independent proportions,  whereas in my situation, the 2 proportions are not independent calculated from "paired" data, right?
> the data would look like:
> pid   test1    test2
> p1      1         0
> p2      1         1
> p3      0         1
> :
> :
> 1=test is correct; 0=not correct
> from the data above, we can calculate accuracy for test1 and test2, then to compare....
> So mcnemar.test() is good for that, right?
> Thanks

 From above clarifying I suggest you consider the use of kappa test. For 
a list of possible ways of doing it in R try: 


Cesar Rabak

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code.

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

More information about the R-help mailing list