jmv

Proportion Test (2 Outcomes)

Binomial test

Example usage

dat <- data.frame(x=c(8, 15))

propTest2(dat, vars = 'x', areCounts = TRUE)

#
#  Binomial Test
#  ───────────────────────────────────────────────────────
#         Level    Count    Total    Proportion    p
#  ───────────────────────────────────────────────────────
#    x    1            8       23         0.348    0.210
#         2           15       23         0.652    0.210
#  ───────────────────────────────────────────────────────
#    Note. Hₐ is proportion ≠ 0.5
#

Arguments

data the data as a data frame
vars a vector of strings naming the variables of interest in data
areCounts TRUE or FALSE (default), the variables are counts
testValue a number (default: 0.5), the value for the null hypothesis
hypothesis 'notequal' (default), 'greater' or 'less', the alternative hypothesis
ci TRUE or FALSE (default), provide confidence intervals
ciWidth a number between 50 and 99.9 (default: 95), the confidence interval width

Returns

A results object containing:

results$table a table

Tables can be converted to data frames with asDF or as.data.frame(). For example:

results$table$asDF

as.data.frame(results$table)