ci_2pop_norm | R Documentation |
Computes the confidence interval for the difference in two population means or
computes the confidence interval for the ratio of two population variances
according to the parameter
argument.
ci_2pop_norm(
x,
y,
sd_pop_1 = NULL,
sd_pop_2 = NULL,
var_equal = FALSE,
parameter = "mean",
conf_level = 0.95,
type = "two.sided",
na.rm = F
)
x |
a (non-empty) numeric vector. |
y |
a (non-empty) numeric vector. |
sd_pop_1 |
a number specifying the known standard deviation of the first population. Default value is |
sd_pop_2 |
a number specifying the known standard deviation of the second population. Default value is |
var_equal |
a logical variable indicating whether to treat the two variances as being equal. If |
parameter |
a character string specifying the parameter in the normal distribution. Must be one of "mean" (confidence interval for mean difference) or "variance" (confidence interval for variance ratio). Default value is "mean". |
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)
when parameter
is "mean" or "variance". If type
is "left", the returned confidence interval is (lower_ci, Inf)
when parameter
is "mean" or "variance". And, finally, is type
is "right", the returned confidence interval is (-Inf, upper_ci))
when parameter
is "mean", and the returned confidence interval is (0, upper_ci)
when parameter
is "variance".
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 <- rnorm(1000, mean = 0, sd = 2)
y <- rnorm(1000, mean = 0, sd = 1)
# confidence interval for difference in two means, unknown variances
ci_2pop_norm(x, y)
x <- rnorm(1000, mean = 0, sd = 2)
y <- rnorm(1000, mean = 0, sd = 3)
# confidence interval for difference in two means, known variances
ci_2pop_norm(x, y, sd_pop_1 = 2, sd_pop_2 = 3)
x <- rnorm(1000, mean = 0, sd = 2)
y <- rnorm(1000, mean = 0, sd = 3)
# confidence interval for the ratoi of two population variance
ci_2pop_norm(x, y, parameter = "variance")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.