prop_test: Tests for equality of proportions

Description Usage Arguments Details Value See Also Examples

Description

Conduct 1-sample tests of proportions and tests for equality of k proportions.

Usage

1

Arguments

x

a vector of counts, a one-dimensional table with two entries, or a two-dimensional table with 2 columns. Used to select method.

...

further arguments passed to or from other methods.

Details

Calculations are done using the methods described in 'stats::binom.test()' and 'stats::prop.test()'

Value

a list with class "prop_test" containing the following components:

x

number of successes

n

number of trials

p

null proportion

statistic

the value of Pearson's chi-squared test statistic

p_value

p-value corresponding to chi-squared test statistic

df

degrees of freedom

method

the method used to calculate the confidence interval

method_ci

confidence interval calculated using specified method

exact_ci

exact confidence interval

exact_p

p-value from exact test

See Also

[stats::binom.test()], [stats::prop.test()]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
prop_test(7, 50, method = "wald", p = 0.2)
prop_test(7, 50, method = "wald", p = 0.2, exact = TRUE)
prop_test(c(23, 24), c(50, 55))

vietnam <- data.frame(
   service = c(rep("yes", 2), rep("no", 2)),
   sleep = c(rep(c("yes", "no"), 2)),
   count = c(173, 160, 599, 851)
)

sleep <- xtabs(count ~ service + sleep, data = vietnam)
prop_test(sleep)

prop_test(vietnam, service, sleep, count)

catfun documentation built on June 14, 2019, 5:04 p.m.