Description Usage Arguments Value Background History/development log Author(s) See Also Examples
Title Function designed for use in dplyr (tidyverse) piping to return CSC and bootstrap CI around that
1 | getBootCICSC(formula1, data, bootReps = 1000, conf = 0.95, bootCImethod = "pe")
|
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 |
list of named values obsCSC, LCLCSC and UCLCSC
For general information about the CSC (Clinically Significant Change criterion), see getCSC
Started before 5.iv.21
Chris Evans
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()
,
getBootCIgrpMeanDiff()
,
getBootCImean()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
### 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.