ci_2pop_bern | R Documentation |
Computes the interval for different in two proportions from two distinct and independent population.
ci_2pop_bern(
x,
y,
n_x = NULL,
n_y = NULL,
conf_level = 0.95,
type = "two.sided",
na.rm = F
)
x |
a (non-empty) numeric vector of 0 and 1 or a non-negative number representing number of successes. |
y |
a (non-empty) numeric vector of 0 and 1 or a non-negative number representing number of successes. |
n_x |
non-negative number of cases. |
n_y |
non-negative number of cases. |
conf_level |
confidence level of the returned confidence interval. Must be a single number between 0 and 1. |
type |
a character string specifying the type of confidence interval. Must be one of "two.sided" (default), "right" or "left". |
na.rm |
a logical value indicating whether |
type
specifies the type of confidence interval. If type
is "two.sided", the returned confidence interval is (lower_ci, upper_ci)
. If type
is "left", the returned confidence interval is (lower_ci, Inf)
. And, finally, is type
is "right", the returned confidence interval is (-Inf, upper_ci))
.
If is.null(n_x) == T
and is.null(n_y) == T
, then x
and y
must be a numeric value of 0 and 1 and the proportions are computed using x
and y
. If is.null(n_x) == F
and is.null(n_y) == F
, then x
, y
, n_x
and n_y
must be non-negative integer scalar and x <= n_x
and y <= n_y
.
A 1 x 3 tibble with 'lower_ci', 'upper_ci', and 'conf_level' columns. Values correspond to the lower and upper bounds of the confidence interval, and to the confidence level, respectively.
x <- 3
n_x <- 100
y <- 50
n_y <- 333
ci_2pop_bern(x, y, n_x, n_y)
x <- rbinom(100, 1, 0.75)
y <- rbinom(500, 1, 0.75)
ci_2pop_bern(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.