Hi, I am wondering if anyone can suggest how to test the equality of 2 proportions. The caveat here is that the 2 proportions were calculated from the same number of samples using 2 different tests. So essentially we are comparing 2 accuracy rates from same, say 100, samples. I think this is like a paired test, but don't know if really we need to consider the "paired" nature of the data, and if yes then how? Or just use prop.test() to compare 2 proportions? Any suggestion would be greatly appreciated. Thanks John
>From you description, you should not used a paired Student's t-test. One uses a paired test when pairs of observations come from the same experimental unit (and thus are correlated). You describe a study where each experimental unit is tested once and where there are two independent groups of experimental units. Look at t.test (i.e. enter ?t.test).John 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 GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> array chip <arrayprofile at yahoo.com> 9/7/2011 4:11 AM >>>Hi, I am wondering if anyone can suggest how to test the equality of 2 proportions. The caveat here is that the 2 proportions were calculated from the same number of samples using 2 different tests. So essentially we are comparing 2 accuracy rates from same, say 100, samples. I think this is like a paired test, but don't know if really we need to consider the "paired" nature of the data, and if yes then how? Or just use prop.test() to compare 2 proportions? Any suggestion would be greatly appreciated. Thanks John ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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}}
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: prop.test(sum(data$agree),20) binom.test(sum(data$agree),20) John 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 GRECC (BT/18/GR) 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 >John, From above clarifying I suggest you consider the use of kappa test. For a list of possible ways of doing it in R try: RSiteSearch("kappa",restrict="functions") HTH -- Cesar Rabak ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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}}
Let my try again, but this time with corrected R code: would the following strategy work: numtests <- 2000 # 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$agree)/numtests,"\n") # Choose one of the following tests: prop.test(sum(data$agree),numtests) binom.test(sum(data$agree),numtests) 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 GRECC (BT/18/GR) 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 >John, From above clarifying I suggest you consider the use of kappa test. For a list of possible ways of doing it in R try: RSiteSearch("kappa",restrict="functions") HTH -- Cesar Rabak ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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}}
Correction. It won't work. Please ignore.>>> John Sorkin 9/7/2011 10:41:46 PM >>>Let my try again, but this time with corrected R code: would the following strategy work: numtests <- 2000 # 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$agree)/numtests,"\n") # Choose one of the following tests: prop.test(sum(data$agree),numtests) binom.test(sum(data$agree),numtests) 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 GRECC (BT/18/GR) 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 >John, From above clarifying I suggest you consider the use of kappa test. For a list of possible ways of doing it in R try: RSiteSearch("kappa",restrict="functions") HTH -- Cesar Rabak ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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}}