Learn R Programming

statBasics (version 0.2.3)

ci_1pop_general: Confidence interval for a population mean (general case)

Description

Confidence interval for a population mean (general case)

Usage

ci_1pop_general(x, conf_level = 0.95, type = "two.sided", na.rm = F)

Value

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 the confidence level, respectively.

Arguments

x

a (non-empty) numeric vector.

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 NA values should be removed before the computation proceeds.

Details

"lower_ci" and "upper_ci" are computed using the t.test function.

Examples

Run this code
x <- rpois(1000, lambda = 10)
ci_1pop_general(x)

Run the code above in your browser using DataLab