prop.test
provides wrapper functions
around the function of the same name in 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.prop.test( x, n, p = NULL, alternative = c("two.sided",
"less", "greater"), conf.level = 0.95, ...) ## S3 method for class 'ANY':
prop.test(x, n, p=NULL, alternative =
c("two.sided", "less", "greater"), conf.level =
0.95,...)
## S3 method for class 'formula':
prop.test( x, n, p=NULL, alternative
= c("two.sided", "less", "greater"), conf.level = 0.95,
success=NULL, data.name, data, ...)
## S3 method for class 'numeric':
prop.test( x, n, p=NULL, alternative
= c("two.sided", "less", "greater"), conf.level = 0.95,
success=NULL, data.name, ...)
## S3 method for class 'character':
prop.test( x, n, p=NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, success=NULL, data.name, ...)
## S3 method for class 'logical':
prop.test( x, n, p=NULL, alternative
= c("two.sided", "less", "greater"), conf.level = 0.95,
success=NULL, data.name, ...)
## S3 method for class 'factor':
prop.test( x, n, p=NULL, alternative =
c("two.sided", "less", "greater"), conf.level = 0.95,
success=NULL, data.name, ...)
"two.sided"
(default), "greater"
or "less"
. You can
specify just the initial letter. Only used for testing
the null that a single proportn
may be a
data frame)htest
objectprop.test
to
simplify its use when the raw data are available, in
which case an extended syntax for prop.test
is
provided.binom.test
,
prop.test
# Several ways to get a confidence interval for the proportion of Old Faithful
# eruptions lasting more than 3 minutes.
prop.test( faithful$eruptions > 3 )
prop.test(97,272)
prop.test(c(97,272-97))
faithful$long <- faithful$eruptions > 3
prop.test( faithful$long )
prop.test( ~long , faithful )
Run the code above in your browser using DataLab