Difference of binomial parameters in R

I have two random variables:

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

      

n is a known parameter (total number of trials), and 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 the 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 for p1> p2.

Specifically, I would like to find the p-value of P (XY = xy | p1 = p2) and, if possible, the confidence interval for the difference between p1 and p2.

What's the best way to do this?

+2


source to share


1 answer


prop.test(c(X,Y), c(n,n), alternative="greater")

      



does whatever you need.

+6


source







All Articles