Description Usage Arguments Value History/development log Author(s) See Also Examples
View source: R/getBootCICorr.R
Function to return observed correlation between two variables with bootstrap CI
1 2 3 4 5 6 7 8 | getBootCICorr(
formula1,
data,
method = "p",
bootReps = 1000,
conf = 0.95,
bootCImethod = "pe"
)
|
formula1 |
formula defining the two variables to be correlated as var1 ~ var2 |
data |
data.frame or tibble with the data, often cur_data() in dplyr |
method |
string giving correlation method, can be single letter 'p', 's' or 'k' for pearson, spearman or kendall (in cor()) |
bootReps |
integer giving number of bootstrap replications |
conf |
numeric value giving width of confidence interval, e.g. .95 (default) |
bootCImethod |
string giving method to derive bootstrap CI, can be two letters 'pe', 'no', 'ba' or 'bc' for percentile, normal, basic or bca |
list of named values: obsCorr, LCLCorr and UCLCorr
Started before 5.iv.21
Chris Evans
Other bootstrap CI functions:
getBootCICSC()
,
getBootCIalpha()
,
getBootCIgrpMeanDiff()
,
getBootCImean()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
library(tidyverse)
data %>%
### don't forget to prefix the call with "list(" to tell dplyr
### you are creating list output
summarise(corr = list(getBootCICorr(score1 ~ score2,
cur_data(),
method = "p", # gets the Pearson correlation
bootReps = 1000,
### "pe" in next line gets the percentile bootstrap CI
bootCImethod = "pe"))) %>%
### now unnest the list output to separate columns
unnest_wider(corr)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.