Description Usage Arguments Value Aliases Examples
View source: R/get_confidence_interval.R
Only simulation-based methods are (currently only) supported.
1 2 3 4 |
x |
Data frame of calculated statistics or containing attributes of
theoretical distribution values. Currently, dependent on statistics being
stored in |
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 |
point_estimate |
A numeric value or a 1x1 data frame set to |
A 1 x 2 tibble with values corresponding to lower and upper values in the confidence interval.
get_ci()
is an alias of get_confidence_interval()
.
conf_int()
is a deprecated alias of get_confidence_interval()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # 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)
# To calculate std error, set the type and point estimate
bootstrap_distn %>%
get_confidence_interval(type = "se", point_estimate = d_hat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.