split_ci: Calculate nonparametric bias-corrected and accelerated...

View source: R/split_aggregations.R

split_ciR Documentation

Calculate nonparametric bias-corrected and accelerated bootstrap confidence intervals for coefficients averaged across split replications

Description

Calculates nonparametric bias-corrected and accelerated bootstrap confidence intervals via bcajack. Coefficients are 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 to fn_summary.

Usage

split_ci(
  ds,
  fn_coef,
  fn_average = function(values) {
     mean(values, na.rm = TRUE)
 },
  replications = 1000,
  ...
)

Arguments

ds

(data frame) a data frame with columns split, score_1, and score_2

fn_coef

(function) a function that calculates a bivariate coefficient.

fn_average

(function) a function that calculates an average across coefficients

replications

(integer) number of bootstrap replications

...

Additional arguments passed to bcajack

Details

For averaging internal consistency coefficients, see Feldt and Charter (2006). For more information about bias-corrected and accelerated bootstrap confidence intervals, see Efron (1987).

Value

Confidence interval

References

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")}

See Also

Other split aggregation functions: split_coefs()

Examples

# 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")
# Calculate confidence interval
split_ci(ds_splits, cor)

splithalfr documentation built on Sept. 15, 2023, 1:08 a.m.