Solved – Binom.test error in R: ” formal argument “p” matched by multiple actual arguments”

I'm running a binom.test on the data set UCBAdmissions (comes with R) and am stuck on an error message.

About the data:

> str(UCBAdmissions) table [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ... - attr(*, "dimnames")=List of 3 ..$ Admit : chr [1:2] "Admitted" "Rejected"     ..$ Gender: chr [1:2] "Male" "Female" ..$ Dept  : chr [1:6] "A" "B" "C" "D" ... 

*Number of females: 1835

*Number of femaled Admitted: 557

*Number of males: 2691

*Number of males Admitted: 1198

I'm trying to answer this question:

"Do you think there was gender discrimination?"

It's a Bernoulli distribution so I am using the binom.test, however I get an error message that I can't make sense of:

no.w <- sum(UCBAdmissions[1,2,]) no.acc.w <- sum(UCBAdmissions[1,2,]) binom.test(no.acc.w,no.w, p = .304, c="two-sided", p=.95) Error in binom.test(no.acc.w, no.w, p = 0.304, c = "two-sided", p = 0.95) :  formal argument "p" matched by multiple actual arguments 

In advance, thanks for poking holes in this and pointing me in the right direction.

Jen

You set two different values for p in the arguments of the fonction binom.test. Maybe you wanted to write

binom.test(no.acc.w,no.w, p = 0.304, c="two-sided", conf.level=0.95) 

You can find the description of this function on this site : http://stat.ethz.ch/R-manual/R-patched/library/stats/html/binom.test.html

Similar Posts:

Rate this post

Leave a Comment