Comparing proportions in two populations
ht_2pop_prop(
x,
y,
n_x = NULL,
n_y = NULL,
delta = 0,
alternative = "two.sided",
conf_level = NULL,
sig_level = 0.05,
na_rm = FALSE
)a tibble with the following columns:
the value of the test statistic.
the p-value for the test.
critical value in the General Procedure for Hypothesis Testing.
critical region in the General Procedure for Hypothesis Testing.
a scalar value indicating the value of delta.
character string giving the direction of the alternative hypothesis.
lower bound of the confidence interval. It is presented only if !is.null(conf_level).
upper bound of the confidence interval. It is presented only if !is.null(conf_level).
a vector of 0 and 1, or a scalar of count of sucesses in the first group.
a vector of 0 and 1, or a scalar of count of sucesses in the first group.
a scalar of number of trials in the first group.
a scalar of number of trials in the second group.
a scalar value indicating the difference in proportions (\(\Delta_0\)). Default value is 0.
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".
a number indicating the confidence level to compute the confidence interval. If conf_level = NULL, then the confidence interval is not included in the output. Default value is NULL.
a number indicating the significance level to use in the General Procedure for Hypothesis Testing.
a logical value indicating whether NA values should be removed before the computation proceeds. Default value is FALSE.
ht_2pop_prop can be used for testing the null hipothesis that proportions (probabilities of success) in two groups are the same.
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 scalars and x <= n_x and y <= n_y.
x <- 3
n_x <- 100
y <- 50
n_y <- 333
ht_2pop_prop(x, y, n_x, n_y)
x <- rbinom(100, 1, 0.75)
y <- rbinom(500, 1, 0.75)
ht_2pop_prop(x, y)
Run the code above in your browser using DataLab