binom.test
Exact Binomial Test

Description

Performs a hypothesis test to determine if a given sample has a particular proportion parameter.

Usage

binom.test(x, n, p = 0.5, alternative = c("two.sided", "less", "greater"),
    conf.level = 0.95)

Arguments

x a numeric value that specifies the number of successes or a two-element numeric vector that specifies the number of successes and the number of failures. If you specify a two-element numeric vector, the n argument is ignored and the number of trials is computed by finding the sum of the two elements.
n a numeric vector that specifies the number of trials. Ignored if argument x is a two-element numeric vector.
p probability of success to be tested.
alternative a character string that specifies the alternative hypothesis. To test the hypothesis, type one of the following:

two.sided to specify that x and p are not equal.
greater to specify that x is greater than p.
less to specify that x is less than p.
Note: You only need to enter enough of the character string to create a unique match for the value.
conf.level a numeric vector in the range [0, 1] that specifies the confidence level for the returned confidence interval.

Details

The exact probabilities are computed for the binomial distribution.
Value
returns a list with class attribute htest, that represents the result of binomial test:
statistic number of successes.
parameter number of trials.
p.value the p-value.
conf.int a confidence interval for the true probability of success. The confidence level is recorded in the attribute conf.level.
estimate the sample estimate of the probability of success calculated by x / n.
null.value null hypothesis value of the probability of success.
alternative a character string that returns the alternative hypothesis (two.sided, greater, or less) as specified in the alternative argument.
method the string Exact binomial test.
data.name a character vector that describes the data used for the test. The substitute of x or n (not evaluated value) is displayed in data.name.
References
Clopper, C. J. & Pearson, E. S. (1934). "The use of confidence or fiducial limits illustrated in the case of the binomial." Biometrika, 26(4), 404--413.
Conover, W. J. (1980). Practical Nonparametric Statistics, 2nd ed. Wiley, New York.
See Also
Binomial
Examples
x <- rnorm(100)  
y <- sum(x>0) 
binom.test(y, 100) 

y <- rnorm(100) d <- x - y binom.test(sum(d>0),length(d))

binom.test(c(23, 27), alternative = "less", conf.level = 0.90) binom.test(23, 23 + 27, alternative = "less", conf.level = 0.90) # the same

Package stats version 6.1.4-13
Package Index