Learn R Programming

infer (version 0.3.1)

conf_int: Compute the confidence interval for (currently only) simulation-based methods

Description

get_confidence_interval() and get_ci() are both aliases of conf_int()

Usage

conf_int(x, level = 0.95, type = "percentile", point_estimate = NULL)

get_ci(x, level = 0.95, type = "percentile", point_estimate = NULL)

get_confidence_interval(x, level = 0.95, type = "percentile", point_estimate = NULL)

Arguments

x

data frame of calculated statistics or containing attributes of theoretical distribution values. Currently, dependent on statistics being stored in stat column as created in calculate() function.

level

a numerical value between 0 and 1 giving the confidence level. Default value is 0.95.

type

a string giving which method should be used for creating the confidence interval. The default is "percentile" with "se" corresponding to (multiplier * standard error) as the other option.

point_estimate

a numeric value or a 1x1 data frame set to NULL by default. Needed to be provided if type = "se".

Value

a 2 x 1 tibble with values corresponding to lower and upper values in the confidence interval

Examples

Run this code
# NOT RUN {
mtcars_df <- mtcars %>%
    dplyr::mutate(am = factor(am))
d_hat <- mtcars_df %>%
    specify(mpg ~ am) %>%
    calculate(stat = "diff in means", order = c("1", "0"))
bootstrap_distn <- mtcars_df %>%
    specify(mpg ~ am) %>%
    generate(reps = 100) %>%
   calculate(stat = "diff in means", order = c("1", "0"))
bootstrap_distn %>% conf_int(level = 0.9)
bootstrap_distn %>% conf_int(type = "se", point_estimate = d_hat)
# }

Run the code above in your browser using DataLab