Title Function designed for use in dplyr (tidyverse) piping to return CSC and bootstrap CI around that

getBootCICSC(formula1, data, bootReps = 1000, conf = 0.95, bootCImethod = "pe")

Arguments

formula1

formula defining the two variables to be correlated as scores ~ group

data

data.frame or tibble with the data, often cur_data() in dplyr

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, minimum two letters 'pe', 'no', 'ba' or 'bc' for percentile, normal, basic or bca

Value

list of named values obsCSC, LCLCSC and UCLCSC

Background

For general information about the CSC (Clinically Significant Change criterion), see getCSC

History/development log

Started before 5.iv.21

See also

getCSC provides just the CSC if you don't need the CI around it. Much faster of course!

Other RCSC functions: classifyScoresVectorByRCI(), getCSC(), getRCIfromSDandAlpha()

Other bootstrap CI functions: getBootCICorr(), getBootCIalpha(), getBootCImean()

Author

Chris Evans

Examples

if (FALSE) { ### will need tidyverse to run library(tidyverse) ### create some data n <- 120 list(scores = rnorm(n), # Gaussian random base for scores ### now add a grouping variable: help-seeking or not grp = sample(c("HS", "not"), n, replace = TRUE), ### now add gender gender = sample(c("F", "M"), n, replace = TRUE)) %>% as_tibble() %>% ### next add a gender effect nudging women's scores up by .4 mutate(scores = if_else(gender == "F", scores + .4, scores), ### next add the crucial help-seeking effect of 1.1 scores = if_else(grp == "HS", scores + 1.1, scores)) -> tmpDat ### have a look at that tmpDat set.seed(12345) # to get replicable results from the bootstrap tmpDat %>% ### don't forget to prefix the call with "list(" to tell dplyr ### you are creating list output summarise(CSC = list(getBootCICSC(scores ~ grp, cur_data()))) %>% ### now unnest the list to columns unnest_wider(CSC) ### now an example of how this becomes useful: same but by gender tmpDat %>% group_by(gender) %>% ### remember the list output again! summarise(CSC = list(getBootCICSC(scores ~ grp, cur_data()))) %>% ### remember to unnnest again! unnest_wider(CSC) }