tags:

views:

81

answers:

1

I have two random variables:

X ~ binom(n, p1)
Y ~ binom(n, p2)

n is a known parameter (the total number of trials), while p1 and p2 are unknown.

I have one sample from each distribution (x from X, and y from Y). To give some context, x and y are numbers of true positives from two different classifiers, at a fixed selectivity.

I would like to use R to test the null hypothesis p1=p2 against p1 > p2.

In particular, I would like to be able to find the p-value P(X-Y=x-y | p1=p2), and if possible, a confidence interval for the difference between p1 and p2.

What is the best way to go about this?

+6  A: 
prop.test(c(X,Y), c(n,n), alternative="greater")

does everything you want.

Rob Hyndman