Only simulation-based methods are (currently only) supported.

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

get_ci(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 1 x 2 tibble with values corresponding to lower and upper values in the confidence interval.

Aliases

get_ci() is an alias of get_confidence_interval(). conf_int() is a deprecated alias of get_confidence_interval().

Examples

# Prepare the dataset mtcars_df <- mtcars %>% dplyr::mutate(am = factor(am)) # Calculate the difference in means in the dataset d_hat <- mtcars_df %>% specify(mpg ~ am) %>% calculate(stat = "diff in means", order = c("1", "0")) # Same calculation on 100 bootstrap replicates bootstrap_distn <- mtcars_df %>% specify(mpg ~ am) %>% generate(reps = 100, type = "bootstrap") %>% calculate(stat = "diff in means", order = c("1", "0")) # Use level to set the confidence level bootstrap_distn %>% get_confidence_interval(level = 0.9)
#> # A tibble: 1 x 2 #> `5%` `95%` #> <dbl> <dbl> #> 1 4.27 10.1
# To calculate std error, set the type and point estimate bootstrap_distn %>% get_confidence_interval(type = "se", point_estimate = d_hat)
#> # A tibble: 1 x 2 #> lower upper #> <dbl> <dbl> #> 1 3.56 10.9