binom.test
performs an exact test of a simple null hypothesis about the probability of success in a
Bernoulli experiment from summarized data or from raw data.
prop.test
performs an approximate test of a simple null hypothesis about the
probability of success in a Bernoulli or multinomial experiment
from summarized data or from raw data.binom.test(x, n, p=0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, ...)## S3 method for class 'default':
binom.test(x, n, p = 0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, ...)
## S3 method for class 'numeric':
binom.test(x, n, p = 0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'character':
binom.test(x, n, p = 0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'factor':
binom.test(x, n, p = 0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'formula':
binom.test(x, n , p = 0.5,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, data, ...)
prop.test(x, n, p=NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, ...)
## S3 method for class 'default':
prop.test(x, n, p = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, ...)
## S3 method for class 'numeric':
prop.test(x, n, p = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'character':
prop.test(x, n, p = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'factor':
prop.test(x, n, p = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, ...)
## S3 method for class 'formula':
prop.test(x, n , p = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success, data.name, data, ...)
n
may be a data frame)htest
objectbinom.test
to simplify its use
when the raw data are available.binom.test
, prop.test
# Several ways to get a confidence interval for the proportion of Old Faithful
# eruptions lasting more than 3 minutes.
binom.test( faithful$eruptions > 3 )
binom.test(97,272)
binom.test(c(97,272-97))
faithful$long <- faithful$eruptions > 3
binom.test( faithful$long )
binom.test( ~long , faithful )
Run the code above in your browser using DataLab