View source: R/split_aggregations.R
split_ci | R Documentation |
Generates bootstrap replicates via boot
. The parameter
ds
should be a data frame as returned by by_split
: Each
unique value of the column participant
is considered a independent
sample of the target population. For each unique value of the column
split
in ds
, it selects the corresponding rows in ds
,
and passes the values in the columns score_1
and score_2
as the
first and second argument to fn_coef
. Any row in ds
for which
score_1
or score_2
is NA is pairwise removed before passing the
data to fn_coef
. Any coefficient that is NA is removed before passing
the data to fn_summary
.
split_ci(
ds,
fn_coef,
fn_average,
bootstrap_replications = 1000,
parallel = "snow",
ncpus = detectCores(),
...
)
ds |
(data frame) a data frame with columns |
fn_coef |
(function) a function that calculates a bivariate (reliability) coefficient |
fn_average |
(function) a function that calculates an average across coefficients |
bootstrap_replications |
(integer) number of bootstrap replications |
parallel |
(character) Type of parallel processing (if any) used for bootstrapping. See |
ncpus |
(character) Number of cores for parallel processing. See |
... |
Additional arguments passed to |
For a practical example, see one of the vignettes for getting started with the splithalfr. Also, note that the boot package supports parallel processing via the parameters 'parallel' and 'ncpus'.
For averaging internal consistency coefficients, see Feldt and Charter (2006). For more information about bias-corrected and accelerated bootstrap confidence intervals, see Efron (1987).
Confidence interval
Efron, B. (1987). Better bootstrap confidence intervals. Journal of the American statistical Association, 82(397), 171-185. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.1987.10478410")}
Feldt, L. S., & Charter, R. A. (2006). Averaging internal consistency reliability coefficients. Educational and Psychological Measurement, 66(2), 215-227. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0013164404273947")}
Other split aggregation functions:
split_coefs()
# Import boot library
library(boot)
# Generate five splits with scores that are correlated 0.00, 0.25, 0.5, 0.75, and 1.00
library(MASS)
ds_splits = data.frame(V1 = numeric(), V2 = numeric(), split = numeric())
for (r in 0:4) {
vars = mvrnorm(10, mu = c(0, 0), Sigma = matrix(c(10, 3, 3, 2), ncol = 2), empirical = FALSE)
ds_splits = rbind(ds_splits, cbind(vars, r, 1 : 10))
}
names(ds_splits) = c("score_1", "score_2", "replication", "participant")
# Conduct bootstrap
bootstrap_result <- split_ci(ds_splits, cor, mean, parallel = "no")
# Get boosted and accelerated confidence intervals
print(boot.ci(bootstrap_result, type="bca"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.